disable inventory - how?

Started by Hadjiguru, Mon 05/04/2004 19:13:20

Previous topic - Next topic

Hadjiguru

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)?

ElectricMonk

#1
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);

Hadjiguru

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)?

Scorpiorus

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.


Hadjiguru

yes, that s what im looking for. i ll try it. thanks.

SMF spam blocked by CleanTalk