Object and Hotspot name to appear on mouse hover.

Started by markbilly, Wed 14/02/2007 16:47:33

Previous topic - Next topic

markbilly

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:

Code: ags
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.
 

Ashen

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.
I know what you're thinking ... Don't think that.

markbilly

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?
 

monkey0506

@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.

markbilly

I just realised that yes, when it displayed the name of my character.

Thanks :)
 

SMF spam blocked by CleanTalk