grey out inventory-button

Started by Hadjiguru, Sat 23/06/2007 14:04:38

Previous topic - Next topic

Hadjiguru

im using for my game the iconbar-gui similar to the default game gui template, AGS version: 2.62.
at a certain situation in the game i want only the walk-function to work. disable look/use/talk is easy with the disablecursormode-function.
also i disabled the inventory with disablecursormode (mode_useinv), but now i want the inventory-button also to grey out and the inventory-window not to open, similar to the other buttons. how can i easy acchieve this? thanks!

GarageGothic

You just set:

Code: ags
btnIconInv.Enabled = false;


If the "When interface disabled" property in the game options screen is set to "GUIs grey out", which it is by default, the button should now be greyed out as well as unclickable.

Hadjiguru

thanks for helping!
where do i code this and how can i can i enable the button again?

GarageGothic

Well, you said you had a certain situation where you wanted it disabled, right? So that event must trigger the function. Without knowing what it is, I can't tell you exactly where to put the code.

I assume you're using the interaction editor, so when the player/game performs the interaction you want to trigger the code, you choose "Run script" from the interaction editor menu, then click "Edit script" and paste the code I gave you.

When you need to activate the button again, do the same except with the code:

Code: ags
btnIconInv.Enabled = true;

Hadjiguru

when testing the game this error message is shown: undefined token 'btnIconInv'

GarageGothic

Ah, sorry, I didn't notice that you were using AGS version 2.62. I don't think buttons had script-o-names back then. I don't have the older versions of AGS around, but the function you want to use is called SetGUIObjectEnabled in AGS 2.62. Look it up in the manual to see the correct parameters for it.


Hadjiguru

GREAT! It's working. Really spectacular. Thank you!

SMF spam blocked by CleanTalk