Link foreground

guzmere
26 Jul 2012, 06:40
Hi everyone hope all is ok. You know they say it comes in threes it's like round here you wait for ages for a bus and then three come along together. It's just that I've done three posts now in such a short time.LOL Anyway How can you change the colour of a link foreground for one location. I have tried
<defaultlinkforeground>Black</defaultlinkforeground> to no avail it gives a long error mesage. Does anyone know the syntax for this please.Thanks Terry :D :D :D :D

sonic102
26 Jul 2012, 06:48
If you mean a diffrent colour for just one link, that's kind of complex.

But if all the links of a room are diffrent from the other room, that's simple.

before entering room [room_that_has_diffrent_link]
--set variable [game.defaultlinkforeground] = ["newcolour"]
before leaving room [room_that_has_diffrent_link]
-- set variable [game.defaultlinkforeground] = ["oldcolour"]

guzmere
26 Jul 2012, 07:31
Hi Sonic102 thanks for that, although I've tried to put it in set variable,
[game.defaultlinkforeground] = [Expression] ["Black]
I hope this is correct. If it is then it hasn't changed the colour.
I was trying to change the colour of the object text just for that one room.
All the others have a black background and a white Smoke foreground.Thanks Terry :D :D :D :D

sgreig
27 Jul 2012, 05:47
Where in the script are you trying to change the color? That could account for why it's not working. That being said, it seems like it's a pretty complicated thing to do, so if I were in your position I would take a good, hard look at it and determine whether this feature is something that is absolutely necessary for the enjoyment of the game. If it's not, I'd just leave it - at least until the game is finished. Once it's done if you decide you want to devote some more time to it then by all means... but it's generally not a good idea to let yourself get bogged down on trivial details when you're still trying to finish the game itself. Save that for "polish" afterwards.

Just my 2 cents.

guzmere
27 Jul 2012, 06:11
Hi sgreig wise words indeed, you are right in what you say ,its just that in this certain room I had a white background and the object text in that room is the same colour. For eg. I'm in a white room [objects are pencil] but because i have set all the game in a black background and the link foreground for the objects in white you could not see the white text. However thinking about afterwards i moved the pencil to another location. Thanks for that have a good day :D :D :D :D Terry

Thierry
22 Apr 2013, 19:18
Sorry to up this post, but I'm really interested in this feature... Quest allows to change link foreground for each object, and I do wish it could do the same with the exits (I mean, displaying exit links with one colour for each in the same room). Is there any plan to add this feature in a future version of Quest, or can I do that with some scripting ?

homeeman
22 Apr 2013, 21:46
This should demonstrate how to do what you want it to. If not, just say so!

Thierry
22 Apr 2013, 21:58
Thank you very much ! But in your game, there isn't any room with two or more exits... So I can't see how you give two colors to two different exits in the same room ?

jaynabonne
22 Apr 2013, 22:24
This doesn't really apply to exits (sadly), but for objects, a "linkcolour" attribute sets the link colo(u)r for that object. Of course, if you want the link color for the same object to change across rooms (depending on where you are), then that won't be useful. Just an aside...

homeeman
23 Apr 2013, 00:54
Yeah, if you wanted to do different exits, or if you wanted this to cover objects that are in the "You can see" list, you'd have to dig around in those seperate (hidden) functions. None of it would be too too difficult, but it's slightly more trouble than what I showed you.

Thierry
23 Apr 2013, 10:19
OK, thank you very much guys ! What I wanted is, for example, a room with 2 exits : one with a red foreground link, and one with a black foreground link :wink:
Homeeman, could you tell me which hidden function you're talking about ?

homeeman
23 Apr 2013, 20:11
There are two. For the objects list there is FormatObjectList() and for the exits there is FormatExitList().
To do what you're saying, the easiest method would be to copy the FormatExitList() function and put an additional if statement in the beginning of the foreach loop which would check to see if the exit it was currently handling was your exit, and if it was, would change the link color as it does in the example when the switch is on.

To avoid checking for that every time you walk into a room, it would be best to copy the code of the FormatExitList() function, but into a different function.
Then, for any rooms in question make the description a script, and turn off the setting to automatically display the list of available exits (game.autodescription_youcango = 0) in the "Before entering" section of the room's script. Print your own version of the FormatExitList() wherever it would go in your description (before or after) and concatenate that together with the rest of your description in that msg() or a separate one.
After you've displayed your text, make sure you set the position of your exits list back to where it was (1-4).

Obviously, that's a little more work, but it's a better way if you're someone who values good code as much as I do. Admittedly, in this application, doing it the hard way is pretty much completely thankless. But if you ever find yourself coding something bigger, you'll take care to cut down on unnecessary processes wherever you can!

Let me know if I went to quick anywhere. I am not a teacher, which is why I normally just stick to making a examples and letting you play with those.

Thierry
23 Apr 2013, 20:41
Thank you homeeman ! But I have to say I didn't really understand what you wrote :lol: I'm really sorry, I'm pretty bad with Scripting (and English is not my native language, which doesn't help :wink: ).
If it's possible, could you make an exemple in the game you upload yesterday ? I think that would really help me, but if it bothers you then no problem... Thank you again for all your explanations :wink:

homeeman
23 Apr 2013, 21:34
That's fine. Like I said I'm not a teacher. I actually discovered while putting it together that the easy way... might not be so easy. So I did it the "hard" way, which works great. A nasty typo kept from getting it right for a while, though...

Thierry
23 Apr 2013, 21:44
Thank you so much, I think I've understood how you process now :-) By the way, what's the nasty typo you mentionned ?

homeeman
23 Apr 2013, 21:53
At the end of the "if" statements to process when to use the certain colors, I used:
game.defaultlinkforground

instead of

game.defaultlinkforeground

Which didn't give me an error message, it just failed to change the link color back. Which was annoying.

Thierry
24 Apr 2013, 11:46
OK, it works for me now, thanks again homeeman ! :wink: