Clear Previous Turn and Scrollbars
GregC
18 Aug 2017, 10:12Sometimes 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.
18 Aug 2017, 18:44I am currently investigating this as well. (ShowMenu is making my game ugly, but it's also freaking awesome! (C'est la vie! ))
GregC
18 Aug 2017, 22:49Let 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.
18 Aug 2017, 23:21You 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!")
}
GregC
21 Aug 2017, 10:08That'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.
19 Sept 2017, 09:03EDIT:
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
The Pixie
19 Sept 2017, 10:18K.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.
19 Sept 2017, 10:30Oh, cool. I'll edit the post (and the code in my game) then.
Thanks, Pix!