Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: HandsFree on Thu 15/03/2012 11:45:20

Title: Change @OVERHOTSPOT@ description [solved]
Post by: HandsFree on Thu 15/03/2012 11:45:20
I'm using a label with @OVERHOTSPOT@. According to the manual that should give the hotspot name (but instead it gives the description, which is fine).

But I like the description to change during gameplay. Is that possible?
hotspot.description = "new name" doesn't work cause it's read only.

thanks
Title: Re: Change @OVERHOTSPOT@ description
Post by: Khris on Thu 15/03/2012 12:57:49
A quick search for "change @OVERHOTSPOT@":

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=42329.0
Title: Re: Change @OVERHOTSPOT@ description
Post by: HandsFree on Thu 15/03/2012 13:19:46
Thanks, I searched but got an error as usual.  :(
I can see the code you provided returns a new description, but how do I make that appear in the @OVERHOTSPOT@ label?

I assume the code goes in GlobalScript.asc. But where do I put lblHotspotDesc = OtherName(Game.GetLocationName(mouse.x, mouse.y));?
And do I need to set it back to @OVERHOTSPOT@ somehow for all the hotspots that don't change?

Title: Re: Change @OVERHOTSPOT@ description
Post by: Khris on Thu 15/03/2012 15:38:36
Just put the line inside the repeatedly_execute function.

If you use this function, you don't need @OVERHOTSPOT@ any longer.
What the function call does is get the name of whatever is under the mouse and pass it on to OtherName().
That function in turn can now replace the description with another String (or append something to it), and the result is then set as the label's text.
Title: Re: Change @OVERHOTSPOT@ description
Post by: HandsFree on Fri 16/03/2012 13:36:40
Yes, I have to experiment with it some more but at first glance it seems to work.
Thanks.