Opening another GUI (solved)

Started by Tarlash, Sun 20/06/2004 09:22:58

Previous topic - Next topic

Tarlash

I want to open/close new GUI, after pressing a button. Code:

if(button==16){
if(IsGUIOn(1)==1){
GUIOff(1);}
else {GUIOn(1);}}

I checkedÃ,  it many times, there is chosen right button in the right GUI, GUI wchich I want to open exists, in button preferences runs script after left clicking it is checked, GUI with button is clickable...

And it still don't work. Why?
My hands are shaking...
I cannot concetrate...
I need AGS!!!

strazer

First off, you may want to make your code more readable by indenting it properly and placing brackets more prominently:

  if (button == 16) {
    if(IsGUIOn(1) == 1) {
      GUIOff(1);
    }
    else {
      GUIOn(1);
    }
  }

Since you don't need the brackets if you only execute one command after the condition, you can compact that to:

  if (button == 16) {
    if(IsGUIOn(1)) GUIOff(1);
    else GUIOn(1);
  }

The way you have it now, it's easy to miss opening/closing brackets IMO.

But from a technical standpoint, I can see nothing wrong with it and you eliminated most common causes.
It would help if you posted the surrounding code, for example your whole interface_click function.

Tarlash

#2
if (interface==STATUS){
Ã,  if(button==0){SetPlayerCharacter(2);}
if (button==1){SetPlayerCharacter(3);}
if (button == 16) {
Ã,  Ã,  if(IsGUIOn(1)) GUIOff(1);
Ã,  Ã,  else GUIOn(1);}
Ã,  }

Rest of GUIs are still standard AGS templates

EDIT: Oh, solved already. I just have not set GUI 1 visibility to popup modal
My hands are shaking...
I cannot concetrate...
I need AGS!!!

SMF spam blocked by CleanTalk