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!!!
Have you set button's option to Run Script?
yeah either that or maybe GUIOff will work instead of InterfaceOff.
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!
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?
When I press the button to exit the inventory the display message says: "interface:3; Button:1;"
but it won't exit the inventory.
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
THANKS A LOT MAN!
It works now but I had to remove a "}" to make it work, that usually happens.