Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mr Jake on Sun 01/06/2003 18:34:34

Title: Whats wrong with this GUI script?
Post by: Mr Jake on Sun 01/06/2003 18:34:34
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
Title: Re:Whats wrong with this GUI script?
Post by: Spyros on Sun 01/06/2003 22:03:03
Have you set the buttons to "run script"?
Title: Re:Whats wrong with this GUI script?
Post by: Mr Jake on Mon 02/06/2003 08:10:18
I should have said that, yes I have,
sry
Title: Re:Whats wrong with this GUI script?
Post by: Ishmael on Mon 02/06/2003 13:08:19
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....
Title: Re:Whats wrong with this GUI script?
Post by: Mr Jake on Mon 02/06/2003 13:13:41
numbers are right, all thats right.....  Shall I provide a export of my GUIs?
Title: Re:Whats wrong with this GUI script?
Post by: Ishmael on Mon 02/06/2003 13:17:07
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
Title: Re:Whats wrong with this GUI script?
Post by: Mr Jake on Mon 02/06/2003 13:39:49
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)
Title: Re:Whats wrong with this GUI script?
Post by: Gilbert on Tue 03/06/2003 02:52:25
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
Title: Re:Whats wrong with this GUI script?
Post by: on Tue 03/06/2003 11:53:31
k, Im at school atm, Ill try after school, thxs