Where is the save/resume function controlled in game UI?

OurJud
10 Dec 2016, 02:30All my (and other's) attempts over the last few years to get the resume/css problem resolved have come to nothing. Alex supposedly fixed the bug about 12 months ago, but on testing it still persists.
With Quest's continuation now in the balance I would dearly love to get to the bottom of this once and for all.
Just to recap (this is all related to playing online)
- I hide the command bar and > icon with CSS - resulting in a simple flashing cursor below the descriptions.
- When the game is started from the beginning all is as it should be (this is because I have a bunch of clever JS in the start script which calls my CSS)
- If a game is saved and then resumed, both the > icon and command box are rendered, meaning the CSS is not being called.
Below is everything (that I know of) that supposedly handles things.
In my game code CSS I have:
body { overflow-x: hidden; line-height: 23px; text-align: justify; }
a.cmdlink { color: #777 !important; text-decoration: none !important; }
div#gamePanel { z-index: 99999; }
#titleimage { display: none; }
div#txtCommandDiv { border: none; background: no-repeat; font-size:12px; font-family:'Courier New', Courier, monospace; color: #fff; }
br { display: block; content: ""; margin-top: .5em; }
element.style { display: none; }
input#txtCommand { float: left !important; outline: none !important; border: none !important; font-size:12px; margin: 0; padding: 0; max-width: 660px; }
#status { display: none !important; visibility: hidden !important; }
In my game's Start Script I have:
JS.eval ("getCSSRule('a.cmdlink').style.color='#555f'")
JS.setCommandBarStyle (GetCurrentTextFormat("") + ";border:" + game.defaultbackground)
JS.addText (game.css)
JS.eval ("$('#txtCommand').css('background-color', '#ddd');")
I have a Clear Screen function with the script:
request (ClearScreen, "")
OutputTextNoBr (game.css)
And finally in the InitUserInterface I have this script:
JS.setCommandBarStyle (GetCurrentTextFormat("") + ";border:" + game.defaultbackground)
JS.eval ("$('#status').hide();")
JS.SetBackgroundCol ("white")
JS.eval ("$('#txtCommandDiv').prepend('> ')")
JS.OutputTextNoBr (game.css)
OutputTextNoBr (game.css)
request (SetInterfaceString, "TypeHereLabel=")
if (GetBoolean(game, "inprogress")) {
}
else {
game.inprogress = true
}
Can any of you coders out there see if there's ANYTHING that may be causing the issue - anything missing, anything that shouldn't be there, typos, bad code??
If it is a bug, then I'm stuffed, but this has been bugging me for years.
The Pixie
10 Dec 2016, 09:20At a quick glance, I would suggest moving the stuff from the game start script into InitUserInterface, apart from the JS.addText line, and see how that works.

OurJud
10 Dec 2016, 15:15Thanks. I'll give that a go now and get back with the results.
[edit] Nope, didn't work.
Here's the link so you can see it an action. Obviously you need to load the game, type Save, close, reopen and Resume.
http://textadventures.co.uk/games/view/bf002clwwui4-1ynmgkhsq/command-box-test

OurJud
10 Dec 2016, 16:02In actual fact some headway HAS been made.
I took your idea and played around with the position of the stuff from the Start Script. Initially I just put it right at the top of the InitUserInterface and it made no difference at all. But I then moved the three lines to after the OutputTextNoBr (game.css) line, and even though the command box still returns on resume, some of my CSS is at least being rendered on resume.
Before the move, the command box stretched right off the right side of the screen (I suspect this is due to a z-index: 99999 line I have to hide the game panels) but now with the adjustments my text box width is being called on resume.
You can see the differences here:
http://textadventures.co.uk/games/view/bf002clwwui4-1ynmgkhsq/command-box-test (old)
http://textadventures.co.uk/games/view/ypmra07z2esvii25rqjola/command-box-test4 (new)
I'm off to play around with the code's positioning again.
This doesn't make sense. If the command box width is now successfully being called on resume with this from my CSS:
input#txtCommand { float: left !important; outline: none !important; border: none !important; font-size:12px; margin: 0; padding: 0; max-width: 660px; }
Why aren't the other rules for outline and border being called too?
The Pixie
10 Dec 2016, 16:51Just to check, does you CSS start and end with style
tags, like this:
<css><![CDATA[
<style>
body { overflow-x: hidden; line-height: 23px; text-align: justify; }
a.cmdlink { color: #777 !important; text-decoration: none !important; }
div#gamePanel { z-index: 99999; }
#titleimage { display: none; }
div#txtCommandDiv { border: none; background: no-repeat; font-size:12px; font-family:'Courier New', Courier, monospace; color: #fff; }
br { display: block; content: ""; margin-top: .5em; }
element.style { display: none; }
input#txtCommand { float: left !important; outline: none !important; border: none !important; font-size:12px; margin: 0; padding: 0; max-width: 660px; }
#status { display: none !important; visibility: hidden !important; }
</style>
]]></css>
Also, delete this line from 'InitUserInterface', this is what is giving the > (not sure why only sometimes).
JS.eval ("$('#txtCommandDiv').prepend('> ')")
I had a quick try, and that should work.

OurJud
10 Dec 2016, 17:00Yes, the CSS is between the correct tags.
I'll get rid of the > line. Thanks again.
Still playing around with the position of the stuff you told me to move from the Start Script.

OurJud
10 Dec 2016, 17:07Well that got rid of the >, so thanks for that, but the command box persists on resume.
I'm wondering if I need to include a shadow rule in the CSS as that seems to be the setting for the command box. It has very strong top and left borders and very faint bottom and right borders.

OurJud
10 Dec 2016, 17:18Maybe this will help your diagnosis.
When I resume a save, the following JS line from the InitUserInterface is called:
JS.eval ("$('#txtCommand').css('background-color', '#000');")
In other words the command box has a black background.
And now the weird part. If I do nothing and just wait, the black background is removed after about 4 seconds, leaving the shadowed border I describe in the last post.
So in a nutshell my JS/css is being called on resume, but only for a few seconds??
Would it be possible to put a global Get Input in somewhere, and uncheck the Show command bar in the game interface tab?
The Pixie
10 Dec 2016, 17:58Here is the test so you can see it works for me (still has the > but not the border):
http://textadventures.co.uk/games/view/mdlva17_duoizkorxfakrw/test
I did have an issue with Deeper like this. My suspicion was that InitUserInterface was called whilst the game was still loading, and so its effects got overwritten. I got around it by doing it all again 2 second later. Try this in your InitUserInterface :
JS.setCommandBarStyle (GetCurrentTextFormat("") + ";border:" + game.defaultbackground)
JS.eval ("$('#status').hide();")
JS.SetBackgroundCol ("white")
JS.eval ("$('#txtCommandDiv').prepend('> ')")
JS.OutputTextNoBr (game.css)
OutputTextNoBr (game.css)
request (SetInterfaceString, "TypeHereLabel=")
SetTimeout(2) {
JS.setCommandBarStyle (GetCurrentTextFormat("") + ";border:" + game.defaultbackground)
JS.eval ("$('#status').hide();")
JS.SetBackgroundCol ("white")
JS.eval ("$('#txtCommandDiv').prepend('> ')")
JS.OutputTextNoBr (game.css)
OutputTextNoBr (game.css)
request (SetInterfaceString, "TypeHereLabel=")
}

OurJud
10 Dec 2016, 18:08Your game does exactly the same, TP. No border when I start, but if I save then resume, the border's there.
When you do the resume are you coming right out of the game, refreshing then going back?
What browser are you using?
Just tried it in IE - same result.
I'm using Quest 5.6.3 - which are you using?
The Pixie
10 Dec 2016, 18:28Works for me with both Firefox and IE. Maybe I have a better internet connection, so the timing problem is not an issue with a small game. The trick in my last post is not in that test game, so still worth trying.

OurJud
10 Dec 2016, 18:34Just let me get this straight. You say that with your test game, you start the game from the beginning with no border around the command box. Then you type Save, close the game, go back to the launch page and press Resume, and on Resume, even after you type L to bring up the last location, the border around the command box is STILL hidden??
I tried your method with the SetTimout and it didn't work. On resume it started with the > and then two seconds later another > popped up by it's side. When I typed L to bring up the location that's when it throws up the border on the command box.

OurJud
10 Dec 2016, 18:43None of this makes sense. Your method is also ignoring my command box width rule, so it stretches right off the the right side of the screen.
The Pixie
10 Dec 2016, 19:00Sorry, my bad. Just checked, and there is no border to start with, but it does appear when I do anything.

OurJud
10 Dec 2016, 19:01^ Well that's something at least. Thought I was going mad.
If you can spare five minutes to talk me through, step by step, what you see with this test game.
- Is the > and border around the command box hidden when you first start the game?
- After a Save / Resume, what do you see on screen? If you do nothing, does anything change after a number of seconds?
- When you type L to bring up the location, does the border around the command box show up?
- If the border does show up, is it about the same width as the text, or does it endlessly stretch off the right side of the screen?
Thanks in advance.
http://textadventures.co.uk/games/view/_ecmdtfhy0qrkfnbaplrra/command-box-test8
The Pixie
10 Dec 2016, 19:22-
Yes.
-
Yes, when I reload your test game, the screen is blank; previous text is missing. The border appears after a while; looking at ther console this may be when it fails to play airsupply.mp3.
-
Yes.
-
Same width.
The console indicates some issues with the JavaScript, which just possible could be the problem.
SetBackgroundCol is not defined
OutputTextNoBr (game.css) is not defined
I guess these refer to lines 3 and 5 of InitUserInterface. Its a long shot, but try deleting them.

OurJud
10 Dec 2016, 19:26Okie dokie.
Thanks for testing. Seems you're seeing the same behaviour as me, so I'm not losing my mind after all.

OurJud
10 Dec 2016, 19:37Removed - makes no difference. Although I'm not sure what you mean when you say they're not defined.
JS.SetBackgroundCol ("white") is defined as 'white', no?
And OutputTextNoBr (game.css) is defined as game.css, no?
I also removed all those timers in the Start Script for the oxygen levels to see if that was messing things up, but no.

OurJud
10 Dec 2016, 22:49I scoured one of my old threads on this and found that one of Jay's hacks works. A confirmation would be appreciated.
It works on the same principle as your own SetTimeout method, but Jay's method places it in a different position.
Whereas you had the SetTimeout between two blocks of the same JS, Jay suggests it goes right at the very top of my InitUserInterface JS block.
This results in the following behaviour:
- On first load the game displays as it should.
- On resume of a Save, both the command box border and the blue 'Save' bar across the top of the screen are shown, but then after the SetTimeout delay, my CSS is called and the page displays as desired.
I have the SetTimeout set at 1 second, and don't know if bigger games would require a longer delay.
Anyway, another confirmation would be appreciated when you have five.
http://textadventures.co.uk/games/view/_ecmdtfhy0qrkfnbaplrra/command-box-test8
The Pixie
11 Dec 2016, 10:31Yes, that is what I see (in Firefox).

OurJud
11 Dec 2016, 15:01Thank you.