Whats wrong with this GUI script?

Started by Mr Jake, Sun 01/06/2003 18:34:34

Previous topic - Next topic

Mr Jake

I used the orginall and edited it a bit and the tag appeared to have disappeared, none of the buttons bound to this (which worked the first time I tried) work anymore

if (interface == 0) {
   if (button == 5)   // see inventory
     InventoryScreen();
   }
   else if (button == 7)    // save game
     SaveGameDialog();
   else if (button == 8)   // load game
     RestoreGameDialog();
   else if (button == 9)   // quit
     QuitGame(1);
   else if (button == 10)    // about
     Display("Jack Morgon: The cured books, made with Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2003 Chris Jones");
     
That is Copy-pasted from the script editor in GUI. any ideas?
PS- GUI 0 is the GUI in question

Spyros

Have you set the buttons to "run script"?

Mr Jake

I should have said that, yes I have,
sry

Ishmael

Um... was that problem solved allready? Anyway, have you got the button numbers right? I mean do you have any extra objects in the GUI, or just those buttons? If you have only the buttons, the the numbers would start from 0 and go upwards....
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Mr Jake

numbers are right, all thats right.....  Shall I provide a export of my GUIs?

Ishmael

Maybe... do you get any errors, or dont the buttons just work? Do you have any other GUI's on? Maybe you should paste your global script here if there is something wrong there... dunno
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Mr Jake

#6
something really odd just hit me... the buttons on GUI 1 do this when it should be the the ones on GUI 0???? I didnt notice before
no errors


// main global script file

function game_start() {
 // called when the game starts, before the first room is loaded
}

function repeatedly_execute() {
 // put anything you want to happen every game cycle here
}

function on_key_press(int keycode) {
 // called when a key is pressed. keycode holds the key's ASCII code
 if (IsGamePaused() == 1) keycode=0;  // game paused, so don't react to keypresses
 if (keycode==17)  QuitGame(1);   // Ctrl-Q
 if (keycode==363) SaveGameDialog();   // F5
 if (keycode==365) RestoreGameDialog();  // F7
 if (keycode==367) RestartGame();  // F9
 if (keycode==434) SaveScreenShot("scrnshot.bmp");  // F12
 if (keycode==9)   InventoryScreen();  // Tab, show inventory
 if (keycode==19)  Debug(0,0);  // Ctrl-S, give all inventory
 if (keycode==22)  Debug(1,0);  // Ctrl-V, version
 if (keycode==1)   Debug(2,0);  // Ctrl-A, show walkable areas
 if (keycode==24)  Debug(3,0);  // Ctrl-X, teleport to room
}

function on_mouse_click(int button) {
 // called when a mouse button is clicked. button is either LEFT or RIGHT
 if (IsGamePaused() == 1) {
   // Game is paused, so do nothing (ie. don't allow mouse click)
 }
 else if (button==LEFT) {
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }
 else {   // right-click, so cycle cursor
   SetNextCursorMode();
 }
}

function interface_click(int interface, int button) {
 if (interface == 0) {
   if (button == 5)   // see inventory
     InventoryScreen();
     }
   else if (button == 7)    // save game
     SaveGameDialog();
   else if (button == 8)   // load game
     RestoreGameDialog();
   else if (button == 9)   // quit
     QuitGame(1);
   else if (button == 10)    // about
     Display("Jack Morgon: The cursed books, made with Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2003 Chris Jones");
     
}  
 
 // end if interface 0
 

/\Global script (small game so far  ;D)

Gilbert

See the difference?

function interface_click(int interface, int button) {
if (interface == 0) {
if (button == 5) // see inventory
InventoryScreen();
//}
else if (button == 7) // save game
SaveGameDialog();
else if (button == 8) // load game
RestoreGameDialog();
else if (button == 9) // quit
QuitGame(1);
else if (button == 10) // about
Display("Jack Morgon: The cursed books, made with Adventure Game Studio v2 run-time engine{<{Copyright (c) 1999-2003 Chris Jones");
}
}

// end if interface 0

Hotshot, lazy

k, Im at school atm, Ill try after school, thxs

SMF spam blocked by CleanTalk