Another code problem. IF and globalint... (SOLVED)

Started by poc301, Tue 09/11/2004 19:53:06

Previous topic - Next topic

poc301

I am trying to put a simple IF statement in the main statusbar GUI.Ã,  Essentially, when the user clicks on the Spellbook icon, the Spell GUI opens, and they can go about their business.

The IF statement I put in runs a check to make sure the user has Magic Use ability.Ã,  If the user has magic use ability, the spellbook will open.Ã,  If not, they get a message stating they don't have magic ability (to keep non-casters from accessing spells).

The code works fine.Ã,  The non-magic people can't view it, and the magic users can.Ã,  However, when the non-magic users click the icon, it just goes back to the normal game.Ã,  The message I told it to put up doesn't show.Ã,  Any ideas?

CODE :
---------


#sectionstart interface_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
if (interface == 4 && button == 18) {
Ã,  Ã,  GUIOn(1);
Ã,  Ã,  GUIOff(4);
Ã,  Ã,  Ã, }


if (interface == ICONBAR) {
Ã,  Ã,  if (button == 4) {Ã,  // show inventory
Ã,  Ã,  Ã,  Ã,  Ã,  show_inventory_window();
Ã,  Ã, 
Ã,  Ã, }
Ã,  Ã,  else if (button == 5) {Ã,  Ã, // use selected inventory
Ã,  Ã,  Ã,  if (character[ GetPlayerCharacter() ].activeinv >= 0)
Ã,  Ã,  Ã,  Ã,  SetCursorMode(4);
Ã,  Ã,  }
Ã,  Ã,  else if (button == 6)Ã,  Ã,  // save game
Ã,  Ã,  Ã,  SaveGameDialog();
Ã,  Ã,  else if (button == 7)Ã,  Ã, // load gameÃ,  = RestoreGameDialog();
Ã,  Ã,  Ã,  GUIOn(4);
Ã,  Ã,  else if (button == 8)Ã,  Ã, // quit
Ã,  Ã,  Ã,  QuitGame(1);
Ã,  Ã,  else if (button == 9) {Ã,  Ã, // SPELLS

if (GetGlobalInt(16) > 0){Ã,  //If Magic Use skill is greater than 0.....
SetPlayerCharacter (4);Ã,  //switch to Char 4, the SPELL char
Ã,  Ã,  Ã,  GUIOn(6);Ã,  Ã,  //SPELLS GUI
Ã,  }
else if (GetGlobalInt(16) < 0) {

Display("You don't have any magical ability");
}
}Ã,  // end if interface ICONBAR
}


Thanks

BIll Garrett

Ashen

Try
else if (GetGlobalInt(16) <= 0) {

Just < 0 won't accept values of 0, which I assume is what it's set to.
I know what you're thinking ... Don't think that.

poc301


SMF spam blocked by CleanTalk