I'm creating a GUI and I can easily make it so the GUI runs scripts when I click the GUI buttons.Ã, However, I can't figure out how to get the GUI to run scripts when the mouse simply rolls over a GUI button.Ã, And to be really specific as to what I'm trying to accomplish with all this, when the mouse rolls over a certain spot on the GUI,Ã, I would like a script to run that makes the GUI close and other GUI's open.Ã, P.S.Ã, I'm very new to scripting.Ã, Thanks.
(Cute avatar!)
Try this (AGS v2.7 required):
- Give the GUI button a script name in the GUI editor, I use "NameOfYourButton" for this example
- Choose menu "Script", "Edit global script...".
- Paste this to the very end:
function repeatedly_execute_always() {
GUIControl *theControl = GUIControl.GetAtScreenXY(mouse.x, mouse.y); // get the GUI control at the current mouse cursor position
if (theControl == null) { /* do nothing */ } // if no GUI control there, do nothing
else if (theControl.AsButton == NameOfYourButton) { // but if the GUI control is the button
gOldgui.Visible = false; // turn off the old GUI
gNewgui.Visible = true; // and turn on the new GUI
}
}
(If there is already a repeatedly_execute_always function in your global script (use the script editor's search function to check), just paste the code in between in there.)
Also, you'll have to adjust "gOldgui" and "gNewgui" to the actual names of your GUIs, for example "gBlargh" if your GUI is called "BLARGH" etc.
It works!Ã, Thank you so much, Strazer.Ã, I am now a witness to the might of the repeatedly execute function.
Cool! Glad I could help. :)