Clear Previous Turn and Scrollbars

Sometimes I use 'clear previous turn' which generally works pretty well, except in one situation:

If the previous turn was much longer than the text I'm about to display, it doesn't seem to change the length of the scrollbar. So if I clear 3 pages of text and add a line of text - the game clears and displays that text admirably - but follows the line with 3 pages of blank and scrolls to the bottom of that so that the player needs to scroll up to read the new text.

Worse the scrollbar will stay at that length and scroll to the end of pages of blank space every time I display anything new in that area until I do a full 'clear screen'

How can I fix that?


K.V.

I am currently investigating this as well. (ShowMenu is making my game ugly, but it's also freaking awesome! (C'est la vie! ))


Let me know if you find a solution. I've solved my other issue, but I think this is something embedded into the engine so I'm struggling to find a solution (besides carefully manage everything to make sure that I never print a page that's larger than the screen so the scrollbar doesn't appear in the first place)


K.V.

You can use show menu rather than ShowMenu for a pop-up prompt:

show menu ("Pick one", Split("yes;no;maybe", ";"), true) {
  msg ("Good job, cheese!")
}

image

image


That's neat - but for me it doesn't fix the scrollbar issue.

If I show a couple of images such that it's necessary to scroll through them, then when I clear previous turn and they go away the scrollbar remains (and scrolls to the bottom) even if the new turn is just one line of text.

I can see how I can make the scrollbar a couple of lines shorter by switching to the alternate show menu but it doesn't solve my issue completely.


K.V.

EDIT:

This probably doesn't really help you, either, really, but you can make the scrollbar disappear and reappear...

--

Add this JavaScript function:

function unloadScrollBars() {
    document.documentElement.style.overflow = 'hidden';  // firefox, chrome
    document.body.scroll = "no"; // ie only
}

It appears that it only needs to be called once (meaning you need another JavaScript function to bring it back):

JS.unloadScrollBars()


If you'd like it to reappear, add this JavaScript function:

function reloadScrollBars() {
    document.documentElement.style.overflow = 'auto';  // firefox, chrome
    document.body.scroll = "yes"; // ie only
}

Call it with

JS.reloadScrollBars()


https://stackoverflow.com/a/10811680


K.V. a better way to run JavaScript is with the JS object.

JS.reloadScrollBars()

The request script command is weird, using "not-strings" and I would like to steer people away from it where possible with a view to deprecating it.


K.V.

Oh, cool. I'll edit the post (and the code in my game) then.

Thanks, Pix!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums