wait command

guzmere
Hi 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 :D Happy Adventuring :D

george
yes, look here:

viewtopic.php?f=10&t=3682#p24555

guzmere
George 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 :D Happy Adventuring :D Terry P. S. It looks better now.

Liam315
I use

 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
Liam315 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
Sora574 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
Liam 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? :D Happy Adventuring :D Terry

Liam315
I'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
Does 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? :D Happy Adventuring :D

Sora574
guzmere 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? :D Happy Adventuring :D

Where it says
style="width: 50%;"
Change it to this
style="width: 50%; height: X;"
Where X is the height you want.

guzmere
Sora 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 :D Happy Adventuring :D

psymann
Did 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

guzmere
Yes 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

Pertex
There 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
Thanks Pertex Gulp! :shock: Terry
:D Happy Adventuring :D
By the by is there a way yet to right align a picture?

psymann
That'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

Sora574
psymann 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
I thought (using CSS) it was

input:focus {
outline:none;
}


That controlled the orange border...

psymann
Ah, 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:

<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
For the focus problem, you could try adding this line in your startup script:

      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
Thanks Jay, works like a charm!

psymann
Jay, 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

guzmere
Thanks 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 :lol: :lol: 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 :D Happy Adventuring :D

george
What 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? :)

Liam315
I'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.

guzmere
George, 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 :D Happy Adventuring :D

guzmere
Managed to do it without a text box at all have a look and see what you think


Terry :D Happy Adventuring :D

jaynabonne
guzmere 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
Jay 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 :D Happy Adventuring :D
P. S. What happened to the game you wanted testing?

Sora574
guzmere 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
K-rap I forgot about that thanks a lot :oops: Terry :D Happy Adventuring :D

george
Liam315 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
george 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
Thanks 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
Actually, 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]

george
Oh that's great!

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

Support

Forums