Hotspot descriptions SOLVED

Started by JRock, Thu 20/04/2006 20:33:35

Previous topic - Next topic

JRock

I checked thru the manual and I can't find anything on this and I tried everything I could, but I cant figure it out:

How do I make it so that the name of a hotspot or object will appear on the screen when the cursor is over it?

I know it has something to do with the GUI labels or something, but Im stumped.

If anyone could help me, that would be awesome!

Thanks a bunch!!!

strazer

If you need a quick, simple solution, try Gilbot's OverHot script module.

JRock

lol sorry.  that wont work cuz I dont have internet on the pc I am using ags on.  i cant download the module.

Anyone else have a solution?

thx  ;D

strazer

- Create a new GUI, name it "MOUSEOVER"
- Remove its "Clickable" checkbox
- Put a label on it
- Set the label's text to "@OVERHOTSPOT@"
- Go to menu "Script" -> "repeatedly_execute" and put these two lines in:
Code: ags

function repeatedly_execute() {

  gMouseover.x = mouse.x; // move GUI to mouse position
  gMouseover.y = mouse.y;

}


You could've easily found something like this searching the forum.

Ishmael

#4
Here's a bit I did as a test some time ago. Retrieving the hotspot name with script was proven to be better than using @OVERHOTSPOT@ some time ago. Anyway, if you find this bit too hard to implement, strazer's code works just fine, and is much easier to put in :)

GUI is called "Ovh" and the label in it is "Overhp".

Beginning of global script:
string buffer;
int width;

function UpdateStatus() {
Ã,  GetLocationName(mouse.x, mouse.y, buffer);
Ã,  Overhp.SetText(buffer);
Ã,  width = GetTextWidth(buffer, Overhp.Font);
Ã,  Overhp.Width = width + 1;
Ã,  gOvh.Width = width + 1;
Ã,  gOvh.X = mouse.x;
Ã,  gOvh.Y = mouse.y;
Ã,  if(gOvh.X>(320-width)) {
Ã,  Ã,  gOvh.X=(320-width);
Ã,  }
}


And then in repeadetly_execute just add:
Ã,  UpdateStatus();


The stausline will behave a bit better when close to the right screen edge. Correcting it's behaviour near the bottom edge is easy too, but for my project it wasn't neccesary so I haven't put it into the code.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

JRock

#5
thanks guys!Ã,  with your help, i figured it out!Ã,  Ã, ;) ;D

SMF spam blocked by CleanTalk