Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Hadjiguru on Mon 05/04/2004 19:13:20

Title: disable inventory - how?
Post by: Hadjiguru on Mon 05/04/2004 19:13:20
i want to disable every player-option besides the "walk"-option in a single room.
i managed to disable the "use"-, the "look"- and the "talk"-button with

DisableCursorMode(MODE_USE);
DisableCursorMode(MODE_LOOK);
DisableCursorMode(MODE_TALK);

--> it works perfect.

but how can i disable the use of the inventory (an of course enable it again later on)?
Title: Re:disable inventory - how?
Post by: ElectricMonk on Mon 05/04/2004 21:51:19
You'll have to do a bit of scripting there.

Open the Global Script.

You should see something like
Quote
function game_start() {
 // called when the game starts, before the first room is loaded

Now add a line like
Quote
SetGlobalInt(42, 0); // inventory disabled? default is no

The global variable no. 42 will now be responsible for checking if the inventory can be displayed or not. The next step is to tell the inventory button to stop working if global variable 42 is not set to 0.

Select the menu for GUIs and select the GUI called ICONBAR (I'm assuming you're working with the standard template).

Click on "Edit script" and look for this part:
Quote
 if (interface == ICONBAR) {
   if (button == 4) {  // show inventory

Now below that line add the line
Quote
if (GetGlobalInt(42) !=0) return; // if global variable 42 is not zero, don't display inventory

Whenever you want to disable the inventory now, use
Quote
SetGlobalInt(42, 1);

To enable it, use
Quote
SetGlobalInt(42, 0);
Title: Re:disable inventory - how?
Post by: Hadjiguru on Sun 11/04/2004 12:40:25
yes, its working. is there maybe a possibility to grey out the disabled object-buttons of the iconbar (besides the walk- and the look-button)?
Title: Re:disable inventory - how?
Post by: Scorpiorus on Sun 11/04/2004 14:32:28
No, not now but the next AGS version will come with a SetGUIObjectEnabled(GUI, int object, int enable) function that does exactly what you are looking for. You could check out a beta but be sure to backup your game before trying.

Title: Re:disable inventory - how?
Post by: Hadjiguru on Thu 15/04/2004 11:18:45
yes, that s what im looking for. i ll try it. thanks.