wait command

guzmere
19 May 2013, 18:03Hi hope all is ok hopefully an easy question. When you put in a wait command upon playing the game a message appears saying continue. Is there a way to change that colour. Thanks Terry
Happy Adventuring 


george
19 May 2013, 18:55
guzmere
19 May 2013, 20:01George thanks a lot it took a while for me to understand but eventually the penny dropped and I got it working. Once again a million thanks
Happy Adventuring
Terry P. S. It looks better now.


Liam315
20 May 2013, 01:44I use
My next goal is to learn a bit of javascript to cancel the fade in/out effects it has. I've already located the elements that control it, just need the scripting...
a.cmdlink {
text-decoration: none;
color: black;
cursor: text;
}
My next goal is to learn a bit of javascript to cancel the fade in/out effects it has. I've already located the elements that control it, just need the scripting...
Sora574
20 May 2013, 02:21Liam315 wrote:My next goal is to learn a bit of javascript to cancel the fade in/out effects it has. I've already located the elements that control it, just need the scripting...
This would be fairly simple, but if you don't mind me asking, why would you ever need to do that?
Liam315
20 May 2013, 06:20Sora574 wrote:This would be fairly simple, but if you don't mind me asking, why would you ever need to do that?
Partly for aesthetics, I'm trying to keep everything as plain and straightforward as possible and I'd rather have the text appear and disappear instantly rather than fade in and linger on the fade out. But also I have a couple of instances where the wait for key press is in the same script as a "run script after x seconds" and (at least on my computer) it creates a noticeably jerky effect with the text scrolling up.

guzmere
20 May 2013, 07:22Liam it used to be that using the delay script after a few seconds when playing the on-line version didn't work correctly. All sorts of anomalies cropped up. Is it not the same now?
Happy Adventuring
Terry


Liam315
20 May 2013, 08:13I'm not sure, I only use the desktop version and haven't tested my game online at all. I'm not 100% certain I'll be keeping those elements anyway so if that is the case, it might be an incentive to get rid of them.

guzmere
20 May 2013, 21:23Does anyone know a quick fix to this
<script>document.getElementById('txtCommandDiv').innerHTML = ' <b>></b><input type="text" x-webkit-speech="" id="txtCommand" onkeydown="return commandKey(event);" style="width: 50%;" autofocus><a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none"> press a key</a>';</script>
At the moment I get either width to the command bar or height but not the both. Where can I place the other in?
Happy Adventuring 
<script>document.getElementById('txtCommandDiv').innerHTML = ' <b>></b><input type="text" x-webkit-speech="" id="txtCommand" onkeydown="return commandKey(event);" style="width: 50%;" autofocus><a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none"> press a key</a>';</script>
At the moment I get either width to the command bar or height but not the both. Where can I place the other in?


Sora574
20 May 2013, 23:03guzmere wrote:At the moment I get either width to the command bar or height but not the both. Where can I place the other in?Happy Adventuring
Where it says
style="width: 50%;"
Change it to thisstyle="width: 50%; height: X;"
Where X is the height you want.
guzmere
21 May 2013, 05:59Sora thanks a million I tried that before but I put a different variation in eg:-style="width: 40%; style = height: X;" and never got it to work. But many thanks Terry
Happy Adventuring 



psymann
21 May 2013, 11:49Did you end up with a bit of code in the end that did the task of changing the colour/style/size of the "Continue..."?
If so, if you'd be willing to post here so I can just copy-and-paste it into mine, and then tweak the variables for colour and size, that would be very kind. I'd quite like to make it smaller and less blue, but I don't care enough to invest the time that it would require for me to get to grips with any of the code that's been discussed in this thread so far, and put together the relevant snippets of code into something complete I can use!
Thanks,
psy
If so, if you'd be willing to post here so I can just copy-and-paste it into mine, and then tweak the variables for colour and size, that would be very kind. I'd quite like to make it smaller and less blue, but I don't care enough to invest the time that it would require for me to get to grips with any of the code that's been discussed in this thread so far, and put together the relevant snippets of code into something complete I can use!

Thanks,
psy

guzmere
21 May 2013, 13:40Yes of course this is from George, he pointed me to the right area and because I'm too thick to do the same I have copied and pasted here.
1. add a new object in the Quest GUI called "CSS'
2. go to the 'Attributes' tab of the CSS object and add an attribute called 'custom'
3. look up at the toolbar and hit the 'Code View' button (to the right of the 'Play' button). Or, just hit 'F9'.
4. find the 'CSS' object (if the file is big just hit control-F to search), and make it look like this:
CODE: SELECT ALL
<object name="CSS">
<inherit name="editor_object" />
<custom type="string">
<![CDATA[
<style type = "text/css">
a.cmdlink {color: red;}
</style>
]]>
</custom>
</object>
5. make a game start Print Message script that looks like this:
CODE: SELECT ALL
{CSS.custom}
(note the { } 's)
And you're good to go. Some notes:
1. make sure the {CSS.custom} runs before any wait scripts of course . Best to put it first in the game start scripts.
2. Sometimes you'll see people referring to things like msg (object.attribute). That's the same as doing a Print Message script of {object.attribute}.
Also have seen the way to alter the input box
<script>document.getElementById('txtCommandDiv').innerHTML = ' <b>></b><input type="text" x-webkit-speech="" id="txtCommand" onkeydown="return commandKey(event);" style="width: 50%; height: X" autofocus><a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none"> press a key</a>';</script>
Where X is the height you want.
The > in bold at the top is for symbol at the begining of the box. It looks pretty cool
From Sora thanks to all who have helped
1. add a new object in the Quest GUI called "CSS'
2. go to the 'Attributes' tab of the CSS object and add an attribute called 'custom'
3. look up at the toolbar and hit the 'Code View' button (to the right of the 'Play' button). Or, just hit 'F9'.
4. find the 'CSS' object (if the file is big just hit control-F to search), and make it look like this:
CODE: SELECT ALL
<object name="CSS">
<inherit name="editor_object" />
<custom type="string">
<![CDATA[
<style type = "text/css">
a.cmdlink {color: red;}
</style>
]]>
</custom>
</object>
5. make a game start Print Message script that looks like this:
CODE: SELECT ALL
{CSS.custom}
(note the { } 's)
And you're good to go. Some notes:
1. make sure the {CSS.custom} runs before any wait scripts of course . Best to put it first in the game start scripts.
2. Sometimes you'll see people referring to things like msg (object.attribute). That's the same as doing a Print Message script of {object.attribute}.
Also have seen the way to alter the input box
<script>document.getElementById('txtCommandDiv').innerHTML = ' <b>></b><input type="text" x-webkit-speech="" id="txtCommand" onkeydown="return commandKey(event);" style="width: 50%; height: X" autofocus><a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none"> press a key</a>';</script>
Where X is the height you want.
The > in bold at the top is for symbol at the begining of the box. It looks pretty cool
From Sora thanks to all who have helped

Pertex
21 May 2013, 14:13There is only just a little problem. If you save and load your game while playing, all css changes are gone again. In Q5.5 there is a new function InitUserInterface which can be imported. There you should call all your css changes.

guzmere
21 May 2013, 14:23Thanks Pertex Gulp!
Terry
Happy Adventuring 
By the by is there a way yet to right align a picture?



By the by is there a way yet to right align a picture?

psymann
21 May 2013, 22:53That's useful, thanks; I've managed to get it to work

I don't suppose there's a way to remove the orange border as well? I tried adding in border-style: none; into the code just on the off-chance, but it didn't have any useful effect
psy


I don't suppose there's a way to remove the orange border as well? I tried adding in border-style: none; into the code just on the off-chance, but it didn't have any useful effect

psy
Sora574
22 May 2013, 01:01psymann wrote:I don't suppose there's a way to remove the orange border as well? I tried adding in border-style: none; into the code just on the off-chance, but it didn't have any useful effect
OPTION 1:
Go to the script 'Run JavaScript' and put this into the box
eval ("document.getElementById('txtCommand').style.outline = 'none'")
OPTION 2:
Of course, you could use CSS, too, if you have somewhere to put it. This would look like:
input#txtCommand {outline:none}
Both accomplish the same task.
Liam315
22 May 2013, 06:50I thought (using CSS) it was
That controlled the orange border...
input:focus {
outline:none;
}
That controlled the orange border...

psymann
22 May 2013, 08:59Ah, thanks, it was a mixture of both
outline: none
which took away the orange, and also
border: none
which took away the grey border it left behind after that.
So now I have the code that creates me a
> |
[ie a flashing cursor at a bold prompt to type against]
using the code from guzmere with a couple of alterations:
This is the "CSS" object added into the code:
And this is the startscript added to Game:
Those two together work perfectly for me (pefectly except it still flashes up a "type here" box right at the very start while it's loading the start script, but I can live with that!).
And as Pernix says, if you load it up from a saved game, it goes back to the original orange box from before, which is a shame, although that can be mainly fixed by putting the "msg ("{CSS.custom}")" bit into the turn script as well as the start script.
Last possible problem is that if you lose focus on the place where you're typing, you have to know to click back on the ">" to get the cursor back, and not just click back anywhere on the page which is what you'd more naturally do, which is less obvious to do if you can't see a box to click in. That's a problem a bit, because with my game, it has a "wait" right at the start, and pressing a key for "wait" loses focus on the text box for some reason, so it appears at the start of the game that you can't type anything, which is not very helpful.
So I changed it now to:
to put a very light grey border there for that. Which is a bit less pretty but probably more useable.
psy
outline: none
which took away the orange, and also
border: none
which took away the grey border it left behind after that.
So now I have the code that creates me a
> |
[ie a flashing cursor at a bold prompt to type against]
using the code from guzmere with a couple of alterations:
This is the "CSS" object added into the code:
<object name="CSS">
<inherit name="editor_object" />
<custom><![CDATA[
<script>document.getElementById('txtCommandDiv').innerHTML = ' <b>> </b><input type="text" x-webkit-speech="" id="txtCommand" onkeydown="return commandKey(event);" style="width: 50%; height: 14pt; font-size: 12pt; font-weight: bold; outline: none; border: none;" autofocus><a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none"> press a key</a>';</script>
<style type = "text/css">
a.cmdlink {
color: black;
}
</style>
]]></custom>
</object>
And this is the startscript added to Game:
<start type="script"><![CDATA[
msg ("{CSS.custom}")
]]>
</start>
Those two together work perfectly for me (pefectly except it still flashes up a "type here" box right at the very start while it's loading the start script, but I can live with that!).
And as Pernix says, if you load it up from a saved game, it goes back to the original orange box from before, which is a shame, although that can be mainly fixed by putting the "msg ("{CSS.custom}")" bit into the turn script as well as the start script.
Last possible problem is that if you lose focus on the place where you're typing, you have to know to click back on the ">" to get the cursor back, and not just click back anywhere on the page which is what you'd more naturally do, which is less obvious to do if you can't see a box to click in. That's a problem a bit, because with my game, it has a "wait" right at the start, and pressing a key for "wait" loses focus on the text box for some reason, so it appears at the start of the game that you can't type anything, which is not very helpful.
So I changed it now to:
<object name="CSS">
<inherit name="editor_object" />
<custom><![CDATA[
<script>document.getElementById('txtCommandDiv').innerHTML = ' <b>> </b><input type="text" x-webkit-speech="" id="txtCommand" onkeydown="return commandKey(event);" style="width: 50%; height: 14pt; font-size: 12pt; font-weight: bold; outline: none; border-color: #eeeeee; border-width: 1; border-style: solid;" autofocus><a id="endWaitLink" onclick="endWait();" class="cmdlink" style="display: none"> press a key</a>';</script>
<style type = "text/css">
a.cmdlink {
color: black;
}
</style>
]]></custom>
</object>
to put a very light grey border there for that. Which is a bit less pretty but probably more useable.
psy

jaynabonne
22 May 2013, 10:28For the focus problem, you could try adding this line in your startup script:
This will force the focus to the input field (if it's visible) whenever the player clicks in the main game area. It doesn't work along the edges for some reason, but it will pick up where the text is.
JS.eval("$('#gameBorder').click(function() { if ($('#txtCommand').css('display') != 'none') { $('#txtCommand').focus(); }});")
This will force the focus to the input field (if it's visible) whenever the player clicks in the main game area. It doesn't work along the edges for some reason, but it will pick up where the text is.
Liam315
22 May 2013, 11:06Thanks Jay, works like a charm!

psymann
22 May 2013, 13:26Jay, I will raise you up a peg on my list of favourite Gods.
I don't have a clue how you worked that out, but it does indeed work a treat!
Thanks!
psy
I don't have a clue how you worked that out, but it does indeed work a treat!
Thanks!
psy

guzmere
22 May 2013, 14:16Thanks to all for sorting the input bar out especially to Jay for the focus coding that does work a treat. It does look far better now. Right enough of the buttering up
I have tried to put (background transparent) or (background false) in Psy's coding but it just ignores it and leaves the box white. Is there a way to make the box transparent. Terry
Happy Adventuring 




george
22 May 2013, 15:19What do you guys think about the flashing issue (where you see the 'Type Here' text right before the start script kicks in). Someone was talking about an init function in 5.4, would that possibly fix it?
How does one get 5.4 anyway?
How does one get 5.4 anyway?

Liam315
22 May 2013, 15:34I'm not a huge fan of the flashing because all the panes etc. that I've disabled flash also, but at the end of the day it's not that big of a deal. Half a second flash at the beginning of the game is the least of my worries.
As for 5.4.1, you can get it here - http://textadventures.co.uk/quest/desktop
I think the init function was for the as yet unreleased 5.5 though.
As for 5.4.1, you can get it here - http://textadventures.co.uk/quest/desktop
I think the init function was for the as yet unreleased 5.5 though.

guzmere
22 May 2013, 16:14George, it's as Liam says a split second flash and it's almost forgotten straight away. It's just that you are creating the game and that tends to stick in your mind more than the player would notice. Terry
Happy Adventuring 



guzmere
22 May 2013, 16:33Managed to do it without a text box at all have a look and see what you think
Terry
Happy Adventuring 
Terry



jaynabonne
22 May 2013, 16:58guzmere wrote:By the by is there a way yet to right align a picture?
Just saw this question. You can make it sit up and beg with the right HTML code...

Here's one way to do right-aligned. Notice that any subsequent text will flow down beside the image.
msg("<div style='float:right'>{img:mypic.gif}</div>")
If you want to keep the left side clear, you can do something like this (wrap it in a larger div - the overflow:hidden is to force it to the right height, given the floating element within):
msg("<div style='width:100%; overflow:hidden'><div style='float:right'>{img:mypic.gif}</div></div>")

guzmere
22 May 2013, 19:26Jay that's absolutely marvellous I can't thank you enough. Just one little thing please. When you arrange the Room layout like
room name [0]
objects list [3]
exits list [2]
description [1]
even when the room name is 0 why does it show the room name in the header? But not all the time Thanks Terry
Happy Adventuring
P. S. What happened to the game you wanted testing?
room name [0]
objects list [3]
exits list [2]
description [1]
even when the room name is 0 why does it show the room name in the header? But not all the time Thanks Terry


P. S. What happened to the game you wanted testing?
Sora574
22 May 2013, 20:21guzmere wrote:even when the room name is 0 why does it show the room name in the header?
If you're referring to the blue bar at the top with the room name in it, add this to your start script (this can only be done in code)
request (Hide, "Location")
That will take away the room name.

guzmere
22 May 2013, 21:06K-rap I forgot about that thanks a lot
Terry
Happy Adventuring 



george
22 May 2013, 23:42Liam315 wrote:
I think the init function was for the as yet unreleased 5.5 though.
Oh right, 5.5 is what I meant. I take it I'd have to build that release myself from the source?
Sora574
23 May 2013, 00:12george wrote:Oh right, 5.5 is what I meant. I take it I'd have to build that release myself from the source?
You could do that.
You need Visual Studio to compile the source (click here)
Keep in mind that the WebPlayer, WebEditor, and Setup folders won't compile, though. But you don't need them -- Just use everything else.
If you don't feel like doing all the work, you could always have someone else do it for you. Or just wait until the final version comes out.
P.S. Remember: Even if you do compile your game in 5.5, nobody else has it yet, so nobody else will be able to use it!
george
23 May 2013, 02:10Thanks Sora574. That init function just sounds really sweet, and if 5.5 comes out by the time my game is ready for testing it would be perfect timing
.

Sora574
23 May 2013, 02:44Actually, george, you don't need to wait for 5.5... If all you want is the init function, just do this:
[list=1][*]At the bottom-left side of the screen, click 'Filter', and then 'Show Library Elements'[/*:m]
[*]Search through the functions for 'InitInterface'[/*:m]
[*]Click on it and a yelllow bar should appear at the top. Click 'Copy'[/*:m]
[*]At the very bottom, add a new script that runs the function 'InitUserInterface'[/*:m]
[*]Now create a new function name 'InitUserInterface' and add all your scripts/styles to it.[/*:m][/list:o]
[list=1][*]At the bottom-left side of the screen, click 'Filter', and then 'Show Library Elements'[/*:m]
[*]Search through the functions for 'InitInterface'[/*:m]
[*]Click on it and a yelllow bar should appear at the top. Click 'Copy'[/*:m]
[*]At the very bottom, add a new script that runs the function 'InitUserInterface'[/*:m]
[*]Now create a new function name 'InitUserInterface' and add all your scripts/styles to it.[/*:m][/list:o]
george
23 May 2013, 03:31Oh that's great!