Hi there!
See, I tried making this Lucasart-style status bar (a GUI with a label, lAction), that shows the action you can do with every object or hotspot in the room. The thing is, I also want , with certain objects, characters or hotspots, the status bar to display a different text (for example, if the mouse is in Interact mode on a door, instead of the usual "Use Door" there would be a "Open Door")
So, I writed this on the global script:
function repeatedly_execute()
{
GetGlobalInt(1);
if (GetLocationType(mouse.x,mouse.y) == eLocationNothing) {
SetGlobalInt(1, 0);
lAction.Visible=false;}
else {lAction.Visible=true;
if (Mouse.Mode==eModeWalkto){lAction.Text = "Go to";}
if (Mouse.Mode==eModeLookat) {lAction.Text = "Look at";}
if (Mouse.Mode==eModeTalkto){lAction.Text= "Talk with";}
if (Mouse.Mode==eModePickup){lAction.Text="Pick";}
if(Mouse.Mode==eModeInteract){if(GetGlobalInt(1)==0){lAction.Text="Use";}else if (GetGlobalInt(1)==1){lAction.Text=Game.GlobalStrings[1];}}
}
I made it work with hotspots, using the "Hotspot_Mousemove" function... but the problem comes with Objects and Characters. I tried using this code in one Room with an object:
function repeatedly_execute()
{if (Object.GetAtScreenXY(mouse.x,mouse.y) == oescultura){SetGlobalInt(1, 1);Game.GlobalStrings[1]="Mess with";}}
But it doesn't work, the Status Bar displays "Use" instead of "Mess with". What did I do wrong? Any solution or alternative? Thanks in advance, folks!
You can't just add a repeatedly_execute function to the room script, you have to create the room_RepExec() function from the room's events pane.
Keep in mind though that your way isn't ideal; right now you can only change the eModeInteract verb, and adding more special verbs required more and more scripting.
I'd use custom properties, one for each cursor mode, and set their default values to "Look at", "Use", etc.
In the global rep_ex, determine what the mouse is over using GetLocationType, then get the object's/hotspot's/character's relevant custom property depending on the cursor mode.
Now you can simply enter the alternative verb into the property boxes.
Thanks a lot!I may try what you sugest, although using the room_RepExec function worked just fine!! :D
Btw, you could set the verb string, then call
lAction.Text = String.Format("%s @OVERHOTSPOT@", verb_string);
That way, you could center the complete action text.
(I assume you're displaying the verb string aligned to the right in one label and "@OVERHOTSPOT@" in a second label next to it.)
That's correct, thanks again :)