Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: j-Hed on Fri 26/12/2003 23:27:06

Title: Inventory window problem!
Post by: j-Hed on Fri 26/12/2003 23:27:06
I run AGS 2.6.

On GUI1 there is an inventory button, when you press it GUI3 comes up. GUI3 is 400x300 in size (covering the whole screen) and I have a inventory window in the middle of the screen and I have also added a button. In the global script I have written:

"if (button == 1) InterfaceOff(3);"

But the button won't work, it won't exit the inventory window.

If anyone knows a way please help!

THANKS!!!
Title: Re:Inventory window problem!
Post by: Scorpiorus on Sat 27/12/2003 00:28:28
Have you set button's option to Run Script?
Title: Re:Inventory window problem!
Post by: Ginny on Sat 27/12/2003 02:09:00
yeah either that or maybe GUIOff will work instead of InterfaceOff.
Title: Re:Inventory window problem!
Post by: j-Hed on Sun 28/12/2003 14:57:20
I've tried to use GUIOff instead of InterfaceOff but it doesn't make any difference. The button IS set to Run Script by the way. I've also tried to make the button display a message but that doesn't work either, what is the problem?

I have written the script under interface_click maybe thats wrong?

function interface_click(int interface, int button) {
 if (interface == 1) { // the menu with options, inventory etc.
 if (button == 2)   //  see options
     InterfaceOn(2);  
 if (button == 0)   // see inventory
     GUIOn(3);       // inventory GUI
 if (button == 1)
     GUIOff(3); // exit inventory (this doesn't work!)

If you have an idea whats wrong I would be happy!
THANKS!
Title: Re:Inventory window problem!
Post by: Scorpiorus on Sun 28/12/2003 15:54:19
hmm, something like:
...
if (button == 1)
Display("button 1"); // exit inventory (this doesn't work!)

should definitely work, check for the button number to correspond its actual GUI object.


Also try putting the next line into interface_click():

function interface_click(int interface, int button) {

Display("Interface: %d; Button: %d;", interface, button);

if (interface == 1) { // the menu with options, inventory etc.
if (button == 2) // see options
InterfaceOn(2);
if (button == 0) // see inventory
GUIOn(3); // inventory GUI
if (button == 1)
GUIOff(3); // exit inventory (this doesn't work!)

This way whenever you click on any GUI's button a message telling that GUI and button numbers appears. So, when you click on the button number 1 it should display Interface: 1; Button: 1;. Is it working?
Title: Re:Inventory window problem!
Post by: j-Hed on Sun 28/12/2003 16:29:28
When I press the button to exit the inventory the display message says: "interface:3; Button:1;"

but it won't exit the inventory.
Title: Re:Inventory window problem!
Post by: Scorpiorus on Sun 28/12/2003 16:34:55
ok, caught it. Interface 3 not 1:


function interface_click(int interface, int button) {
if (interface == 1) { // the menu with options, inventory etc.
if (button == 2) // see options
InterfaceOn(2);
if (button == 0) // see inventory
GUIOn(3); // inventory GUI
if (button == 1)
GUIOff(3); // exit inventory (this doesn't work!)

} // end of interface 1

if (interface == 3) {

if (button == 1) GUIOff(3);

}


should work now

~Cheers
Title: Re:Inventory window problem!
Post by: j-Hed on Sun 28/12/2003 16:52:16
THANKS A LOT MAN!

It works now but I had to remove a "}" to make it work, that usually happens.