I tried creating this ultracool floating statusline that I've seen at least in a couple of AGS games "La Croix Pan" for example.
It displays the name of the hotspot / character / object when the mouse cursor is over one of them (duh).
I think I've read every post that I thought would have helped me, but it has been no help, same for the Ags's otherwise very useful help file.
I'm about to script a goddamn noose over here so any help is appreciated.
Thank you.
There are many, many threads dealing with this already.
A forum search for "hotspot name cursor" turned up this:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=21681.0
Shit, if I only knew those words...
But many lines of the script in that discussion don't work with 2.72, and oh boy have I tried to find the alternatives for those commands.
Well I'll try some more, thanks anyways.
Just search the helpfile for the old command.
The explanation of a new command always mentions the old one at the beginning.
Ok, what the heck:
GUI:
// inside rep_ex
gCurs.X=mouse.x+5-30*(mouse.x>290);
gCurs.Y=mouse.y+2-14*(mouse.y>185);
Use a small GUI, call it "Curs", put a label in it, enter "@OVER_HOTSPOT@" as its text.
I think you mean the emerging text, don't you?
There have been templates like the FOA template which had such a textline(MAPS GUI) but I will try to make a step by step tutorial how to make it.
In general it isn't that hard:
1. Create a new gui and name it something sensible.
2. Create a label with the text: "@OVERHOTSPOT@". Don't remove that AT's.
3. Then in global script create a new function above all the eventsections. You could write it direct into repeatedly execute but then its not that clear.
function SetGUILabelPosition(int x, int y)
{
int guiposx, guiposy, height, width, offset;
guiposx=x;
guiposy=y;
String buffer = Game.GetLocationName(x, y);
width = GetTextWidth(buffer, FONT); //replace FONT with the font you use in your label
if (width>=LABELWIDTH) offset=LABELWIDTH/2; //replace LABELWIDTH with the width of your gui.
else offset=width/2;
height=GetTextHeight(buffer, FONT, LABELWIDTH);
if (x>320-offset) guiposx=320-offset;
if (x<offset) guiposx=offset;
if (y>200-height) guiposy=200-height;
gGUI.SetPosition(guiposx-(LABELWIDTH/2), guiposy);
}
4. Put this in repeatedly execute:
SetGUILabelPosition(mouse.x, mouse.y);
If you want to disable it sometimes just make a bool:
bool OvermouseGUI_Enabled=false; //top of your global script
OvermouseGUI_Enabled=true; //to start it
if(OvermouseGUI_Enabled==true) SetGUILabelPosition(mouse.x, mouse.y); //in rep exec instead of Nr. 4
[edit] Khris was faster than me >:(
Thank you very much, both of you.
If I can't get it working with these then I should just suck on a shotgun muzzle =)
Hell yeah it works! Cool shit! I just copypasted your code Smash and altered a little, and there it is!
Thank you!
Now just a little tuning here and there.
I'm done here.
Smash~
You edited your post with "Khris was faster than me >:( ". Does that mean that his way is better or easier or what?
~Sirus
No, they've basically provided the same thing, Lt. Smash's code uses a function to do the work which means he can also make sure the label fits into the screen. By saying Khris was faster, Lt. Smash was simply saying that Khris beat him to the punch in posting an answer.