Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Hadjiguru on Sat 23/06/2007 14:04:38

Title: grey out inventory-button
Post by: Hadjiguru on Sat 23/06/2007 14:04:38
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!
Title: Re: grey out inventory-button
Post by: GarageGothic on Sat 23/06/2007 14:18:47
You just set:

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.
Title: Re: grey out inventory-button
Post by: Hadjiguru on Sat 23/06/2007 14:51:54
thanks for helping!
where do i code this and how can i can i enable the button again?
Title: Re: grey out inventory-button
Post by: GarageGothic on Sat 23/06/2007 15:02:13
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:

btnIconInv.Enabled = true;
Title: Re: grey out inventory-button
Post by: Hadjiguru on Sat 23/06/2007 15:16:38
when testing the game this error message is shown: undefined token 'btnIconInv'
Title: Re: grey out inventory-button
Post by: GarageGothic on Sat 23/06/2007 15:22:46
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.

Title: Re: grey out inventory-button
Post by: Hadjiguru on Sat 23/06/2007 15:37:11
GREAT! It's working. Really spectacular. Thank you!