Change exit link color during the game.

Is it possible to change the exit link colors e.g "go west" during the game?
So that on one page for instance the exit link is red while on another page the color would be blue.


It seems that links will always use the color specified in game.defaultlinkforeground at the time they are created. So changing that attribute will change the colour of all object and exit links.

If you want to change the colour of a link that's already on the screen, you'll need to use some javascript.
You could add a function to your UI Initialisation script like this:

JS.eval("changeExitLinkColor=function(i,n){$.isArray(i)||(i=[i]),$('.exitlink').each(function(){i.includes($(this).data('elementid'))&&$(this).css('color',n)})};")

and then whenever you want to change the colour of an exit, you could do:

JS.changeExitLinkColor("backdoor", "red")

or:

JS.changeExitLinkColor(GetExitByName(lounge, "north"), "green")

or even:

JS.changeExitLinkColor(Split("exit24;exit29;exit40"), "pink")

After some fiddling I got it to work.
Thanks a lot!


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

Support

Forums