exit links different color than object links?
deroesi
09 Apr 2014, 02:09is it possible to set a different link color specificly for EXITs? I keep encountering myself searching for exits in the text, different colors would help a lot.
/edit: ahh and I forgot: the script "wait for keypress" seems to ignore the link colour at all.. its always plain html blue.. is there a way to fix this, or is this a bug which'll be fixed soon?
thanks!
--stephan
/edit: ahh and I forgot: the script "wait for keypress" seems to ignore the link colour at all.. its always plain html blue.. is there a way to fix this, or is this a bug which'll be fixed soon?
thanks!
--stephan

jaynabonne
09 Apr 2014, 06:33For the latter, add this line somewhere early on (e.g. a game "start" script):
This will set the color to red (HTML "#ff0000"). You could set other RGB-style colors or use a HTML color value like "blue".
(For completeness: http://www.w3schools.com/tags/ref_colornames.asp)
Unfortunately, the exit link color is hard-coded to be the same as all the other link colors. You can work around that by pulling a piece of the core code into your game and modifying it. Add the code below into your game. It's a copy of the core function:
The line that's commented out (//'s in the front) is the old line. The one below it is the new one, and right now it jams the color to "#00c000" which is a fairly unattractive green.
Change it to what you like.
JS.eval("getCSSRule('a.cmdlink').style.color='#ff0000'")
This will set the color to red (HTML "#ff0000"). You could set other RGB-style colors or use a HTML color value like "blue".
(For completeness: http://www.w3schools.com/tags/ref_colornames.asp)
Unfortunately, the exit link color is hard-coded to be the same as all the other link colors. You can work around that by pulling a piece of the core code into your game and modifying it. Add the code below into your game. It's a copy of the core function:
<function name="ProcessTextCommand_Exit" type="string" parameters="section, data">
<![CDATA[
exitname = Mid(section, 6)
exit = GetObject(exitname)
if (exit = null) {
return ("{" + ProcessTextSection(section, data) + "}")
}
else {
verbs = GetDisplayVerbs(exit)
alias = GetDisplayAlias(exit)
command = LCase(StringListItem(verbs, 0)) + " " + alias
//style = GetCurrentLinkTextFormat()
style = GetCurrentTextFormat("#00c000")
return ("<a style=\"" + style + "\" class=\"cmdlink exitlink\" data-elementid=\"" + exit.name + "\" data-command=\"" + command + "\">" + alias + "</a>")
}
]]>
</function>
The line that's commented out (//'s in the front) is the old line. The one below it is the new one, and right now it jams the color to "#00c000" which is a fairly unattractive green.

deroesi
09 Apr 2014, 13:53very cool, thanks! it works like a charm 
best,
--stephan

best,
--stephan
GiannisG
24 Sept 2014, 06:49I, too, have the same question (in regard to links in general)
Namely, how one can have links that are:
- not underlined
- same font with rest of text (I'm using Courier New)
- but different colour.
In post http://forum.textadventures.co.uk/viewtopic.php?f=10&t=3859&p=25857&hilit=link+color#p25837, jaynabonne writes about global game link color, which I would love to lay my hands on. But where are its settings?
Cheers,
G.
Namely, how one can have links that are:
- not underlined
- same font with rest of text (I'm using Courier New)
- but different colour.
In post http://forum.textadventures.co.uk/viewtopic.php?f=10&t=3859&p=25857&hilit=link+color#p25837, jaynabonne writes about global game link color, which I would love to lay my hands on. But where are its settings?
Cheers,
G.

jaynabonne
24 Sept 2014, 06:58Have you checked out the "Display" tab on the "game" object? You can turn off underlines for hyperlinks and set the color.
GiannisG
24 Sept 2014, 07:37Oh, I don't see this, probably because I have deactivated "Hyperlinks" from the Features tag.
My problem is with the "Continue..." link, which seems to have a mind of its own.
OK, here's what I do:
- Features Tab>activate "Hyperlinks"
- Display Tab>deactivate "Underline"
- Display Tab>Link Colour "White"
- Features Tab> deactivate "Hyperlinks" again.
Now, the "Continue..." link is not underlined anymore. But it is still Blue! I have used your suggestion above to change its colour, by adding:
to a start script, which works.
Now, what I want is to change the font, too, to my Courier New. Is there a similar script line that I can add to change the font, too?
How come this link is different to the rest? Why does "Continue..." even have to be a link?
Thanks again, jaynabonne!
My problem is with the "Continue..." link, which seems to have a mind of its own.
OK, here's what I do:
- Features Tab>activate "Hyperlinks"
- Display Tab>deactivate "Underline"
- Display Tab>Link Colour "White"
- Features Tab> deactivate "Hyperlinks" again.
Now, the "Continue..." link is not underlined anymore. But it is still Blue! I have used your suggestion above to change its colour, by adding:
JS.eval("getCSSRule('a.cmdlink').style.color='#ff0000'")
to a start script, which works.
Now, what I want is to change the font, too, to my Courier New. Is there a similar script line that I can add to change the font, too?
How come this link is different to the rest? Why does "Continue..." even have to be a link?
Thanks again, jaynabonne!

jaynabonne
24 Sept 2014, 19:34Try this:
And I'm not the one to answer questions about "why".
JS.eval("getCSSRule('a.cmdlink').style['font-family']='Courier New'")
And I'm not the one to answer questions about "why".

GiannisG
25 Sept 2014, 07:06Yep! Works like a charm!
Thanks again (and again and again...) jaynabonne!
Thanks again (and again and again...) jaynabonne!

OurJud
03 Dec 2014, 23:30jaynabonne wrote:For the latter, add this line somewhere early on (e.g. a game "start" script):JS.eval("getCSSRule('a.cmdlink').style.color='#ff0000'")
This will set the color to red (HTML "#ff0000"). You could set other RGB-style colors or use a HTML color value like "blue".
The above is some code you supplied for changing the hyperlink colour of the 'continue' hyperlink which appears when a 'key press' command is set.
I have added this to the game's start script using 'run java' from the scripts, but it makes no difference to the link.
I then thought of another way, and enabled hyperlinks in the game's set-up, but set the link colour to black so that it wouldn't show, and that didn't have any effect either - the link still shows in blue (although it did accept my instruction to remove the underline, so something is working there)
Any ideas?

OurJud
03 Dec 2014, 23:56I did it!
I just added:
to the game's CSS section and it worked! I couldn't believe it worked because I thought you'd provided java as some kind of trick to get round the hard coding or something.
I just added:
a.cmdlink {display: none; visibility: hidden; }
to the game's CSS section and it worked! I couldn't believe it worked because I thought you'd provided java as some kind of trick to get round the hard coding or something.

jaynabonne
04 Dec 2014, 07:46When you say you added it to the game's CSS section, what do you mean? Where is that? (I might be missing something important!) I usually offer Javascript as most people don't have a CSS block set up. But if there is a standard way to do it in Quest that I've been missing... 


OurJud
04 Dec 2014, 16:43jaynabonne wrote:When you say you added it to the game's CSS section, what do you mean? Where is that? (I might be missing something important!) I usually offer Javascript as most people don't have a CSS block set up. But if there is a standard way to do it in Quest that I've been missing...
It may well be an addition, Jay, but if I hit the code button in Quest (next to the play button), I have a short section of CSS right at the top of the code.

jaynabonne
04 Dec 2014, 16:59Could that have been something put in with an earlier fix? It sounds like something I would have offered for a different problem. 


OurJud
04 Dec 2014, 17:07jaynabonne wrote:Could that have been something put in with an earlier fix? It sounds like something I would have offered for a different problem.
I'll just a quick look to see what's in there. Hold on.
The only things in that CSS block that I haven't added myself are 'div#txtCommandDiv' and 'input#txtCommand' - which I think hide the input border.