Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: markbilly on Wed 14/02/2007 16:47:33

Title: Object and Hotspot name to appear on mouse hover.
Post by: markbilly on Wed 14/02/2007 16:47:33
I want the name of a hotspot or object to appear when the mouse hovers over it.

Currently I am focusing on the hotspot...

At the moment, I have used a GUI (gMouselabel) with a label in it (label text: @OVERHOTSPOT@)

and in "repeatedly execute" part of global script I have:

function repeatedly_execute() {

if (gMouselabel.Visible == true) {
UnPauseGame ();
}

gMouselabel.SetPosition(mouse.x, mouse.y);

}


This should display the gui (following the mouse) all the time, however the game should not be paused. It should also display the name of the hotspot the mouse hovers over, in the gui.

When tested, the GUI does appear and follow the mouse, however the game appears to be paused and the hotspot name does not appear.

What am I doing wrong, or is there a better way to achieve this?

I have read all the possible topics on this to no avail (in fact, that is where most of my current ideas have come from)

I know this is possible as a vast number of AGS games I have played do it.



Thankyou.
Title: Re: Object and Hotspot name to appear on mouse hover.
Post by: Ashen on Wed 14/02/2007 16:55:14
Try setting the GUI to unclickable, or adding a slight offset to the GUI position (e.g. gMouselabel.SetPosition (mouse.x+1, mouse.y+1); - you'll also need to add checks so the GUI isn't moved off screen, as that'd cause a crash). Since the GUI is directly under the mouse, it could be reading that instead of the Object/Hotspot under the GUI, and so not updating the Label.
Title: Re: Object and Hotspot name to appear on mouse hover.
Post by: markbilly on Wed 14/02/2007 17:08:54
I set it to unclickable and it works, thanks!

Any ideas on objects now? Can I just create another gui on top, with @OVEROBJECT@ instead? Is that possible?
Title: Re: Object and Hotspot name to appear on mouse hover.
Post by: monkey0506 on Wed 14/02/2007 17:17:11
@OVERHOTSPOT@ is somewhat ambiguous in that it generally implies that it only works with Hotspots, but this isn't actually the case. @OVERHOTSPOT@ works with Characters, Hotspots, and Objects. I don't remember off the top of my head, but I believe it works with InventoryItems as well.
Title: Re: Object and Hotspot name to appear on mouse hover.
Post by: markbilly on Wed 14/02/2007 17:21:24
I just realised that yes, when it displayed the name of my character.

Thanks :)