I was browsing the help file, and I found out how to make an entire GUI non-clickable. My question is: Is it posible to make a single button on a GUI non-clickable? I.E.: the selected item icon on the GUI when no item is selected.
Thanks!
SetGUIObjectEnabled
Thanks for the quick reply!
Good news: It worked.
Bad news: It's permanently disabled.
Now I'm looking for a way to re-enable it after an inventory item is chosen, then make it default back to disabled after the item is used. How can I make this disabling temporary, and dependant on whether an inventory item is active?
I tried SetGUIObjectEnabled(ICONBAR, 5, 1) in my INVENTORY GUI script, but I must not be using it correctly. Is there a variable I should be using?
Sorry to be a bother, I'm honestly looking everywhere to find a solution to this!
Script:
-----------------
if (button == 1) {
// They pressed SELECT, so switch to the Get cursor
SetCursorMode (2);
SetGUIObjectEnabled(ICONBAR, 5, 1);
// But, override the appearance to look like the arrow
SetMouseCursor (6);
}
------------------
Any suggestions?
QuoteI tried SetGUIObjectEnabled(ICONBAR, 5, 1) in my INVENTORY GUI script, but I must not be using it correctly. Is there a variable I should be using?
What exactly isn't working?
Have you set the button's "Left click" property to "Run script"? Otherwise the interface_click function isn't called.
Otherwise it should be working fine. Are you sure that the button is indeed control number 5?
If you delete GUI controls, it's possible the other ones get re-numbered (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=371). Check that.
QuoteNow I'm looking for a way to re-enable it after an inventory item is chosen, then make it default back to disabled after the item is used. How can I make this disabling temporary, and dependant on whether an inventory item is active?
Hm, not sure. Try this:
// main global script file
function repeatedly_execute() {
if (character[GetPlayerCharacter()].activeinv == -1) // if no item selected
SetGUIObjectEnabled(ICONBAR, 5, 1); // enable inv item button
else // if an inv item is selected
SetGUIObjectEnabled(ICONBAR, 5, 0); // disable inv item button
}
Thanks again, you've been a great help!
I'm pleased to say I did get it to work, but I had to tweak the code slightly:
function repeatedly_execute() {
// put anything you want to happen every game cycle here
if (character[EGO].activeinv == -1) // if no item selected
SetGUIObjectEnabled(ICONBAR, 5, 0); // enable inv item button
else // if an inv item is selected
SetGUIObjectEnabled(ICONBAR, 5, 1); // disable inv item button
}
Minor things make the biggest difference sometimes! ;D
Hehe, right. Of course the button should be disabled when there's no inv item selected. Silly me. :P
Remember to update the comments to avoid confusion.
Glad I could help. :)