Small GUI problem ...

Started by Darth Mandarb, Sun 10/08/2003 17:37:45

Previous topic - Next topic

Darth Mandarb

Whenever I use the Save, Load, or Inventory buttons on my GUI the Quit box comes up after I click.  For instance, if I click on an inventory item, once it's selected the inventory window goes away but the quit gui pops open.  I can't figure out why it's doing that.  I'm sure it's just a missing bracket or something.


This is the code I think is causing it:

function interface_click(int interface, int button) {
 if (interface == 1) {
   if (button == 4)   // see inventory
     InventoryScreen();
   else if (button == 5)    // save game
     Display("This feature is unavailable at this time");
     // SaveGameDialog();
   else if (button == 6)   // load game
     Display("This feature is unavailable at this time");
     // RestoreGameDialog();
   else if (button == 7)   // quit
     GUIOff(1);
     GUIOn(2);
     SetMouseCursor(6);
    // QuitGame(1);
 }  // end if interface 1

// InterFace 2

if (interface == 2) {
if (button == 1)
QuitGame(0);
else if (button == 2)
GUIOff(2);
SetCursorMode(1);
GUIOn(1);
}

}

Thanks for any help!

cheers,
dm

Scummbuddy

#1
For any functions inwhich you will have two or more events happening, you need to bracket them together.




function interface_click(int interface, int button)
{
 if (interface == 1)
 {
   if (button == 4)                  // see inventory
     InventoryScreen();
   else if (button == 5)           // save game
   {
     Display("This feature is unavailable at this time");
      SaveGameDialog();
    }
   else if (button == 6)              // load game
     {
     Display("This feature is unavailable at this time");
     RestoreGameDialog();
    }
   else if (button == 7)   // quit
    {
     GUIOff(1);
     GUIOn(2);
     SetMouseCursor(6);
     QuitGame(1);
     }
 }  // end if interface 1

// InterFace 2

if (interface == 2)
{
    if (button == 1)
          QuitGame(0);
   else if (button == 2)
    {
         GUIOff(2);
         SetCursorMode(1);
         GUIOn(1);
    }
}

}
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Darth Mandarb

Awesome!  Worked totally :)

Much thanks!

cheers,
dm

SMF spam blocked by CleanTalk