two gui questions (solved)

Started by viktor, Sun 04/07/2004 21:00:31

Previous topic - Next topic

viktor

I have to a bit stoopid questions. I used the AGS tutorial to make my own quit GUI.
But when I use that quit gui it will only apear when I pres on the quit button. I wan't it to apear when for instance Esc or Ctrl+Q is pressed. How can I do that?

And is there any way to simply change the look of the defoult save load and quit GUIs?
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Mr Jake

look in the manual of details of 'on_key_press' and for the ACSII code table.

Hollister Man

All you can 'quickly and easily' change about it is the message displayed.  It is stored in one of the global messages and can be changed in the editor.

Any other way you have to make your own GUI for it.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

viktor

crap. Maybee that could be in  the naxt version of AGS. The posibility to change these guis I mean.
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Goot

It's not too hard to change. Go into the global script into on_key_press. Wherever it says: QuitGame(1); replace it with InterfaceOn(int GUI); int GUI=the number GUI that the quit thing is.

viktor

#5
is there any tutorial on how to make a custom save and load gui. Becouse I think that would be a bit more complicated than the quit gui. 

EDIT: Oh. Thanks BTW. I fixed the gui and it works perfectly now.

EDIT: I found a tutorial. But this mesage keeps poping up:


and this is the script I used:

string text;

int index;



function on_key_press(int keycode) {



if (keycode==363) {
   

// Press F5

SetTextBoxText(1,0,"");
   

// Clear Text box

ListBoxSaveGameList(1,3);
   

// Fill List Box with saved games

index=ListBoxGetNumItems(1,3);
   

// Count how many saved games there are         

if (index>19){
   

// If saved games 20 (maximum)

Display("You must overwrite a previous saved game");
   

// Display warning

}

InterfaceOn(1);
   

// Bring Save interface on             

}



if (keycode==365) {
   

// Press F7

ListBoxSaveGameList(0,0);
   

// Fill List box with saved games

InterfaceOn(0);
   

// Bring restore Interface on

}





function interface_click(int interface, int button) {

if (interface==0) {
   

// if Restore interface

if (button==1) {
   

// if cancel is pressed

InterfaceOff(0);
   

// Close interface

else { index=ListBoxGetSelected(0,0);
   

// else get the selected game

RestoreGameSlot(savegameindex[index]);}
   

// restore the game

}
}



if (interface==1) {
   

// if save interface

if (button==0) {
   

// if enter is pressed

index=ListBoxGetNumItems(1,3);
   

// Count saved games

if (index<20) {
   

// if less than 20

GetTextBoxText(1,0,text);
   

// Get the typed text

InterfaceOff(1);
   

// Close interface

SaveGameSlot(index+1,text); }
   

// Save game (text as description)

else {
   

// if saved games are 20

index=ListBoxGetSelected(1,3);
   

// Get the selected save game

GetTextBoxText(1,0,text);
   

// Get the typed text

InterfaceOff(1);
   

// Close the interface

SaveGameSlot(savegameindex[index],text); }
   

// Overwrite the selected game



}

if (button==2) InterfaceOff(1);
   

// if cancel is pressed close interface
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Gilbert

That means, you're not adding the content to be added to on_key_press() in the on_key_press() function already defined, but started making a new one.

Just move the content to be added to that function into the ORIGINAL function and delete your new definition of it.

viktor

Quote from: Gilbot V7000a on Mon 05/07/2004 09:51:09
That means, you're not adding the content to be added to on_key_press() in the on_key_press() function already defined, but started making a new one.

Just move the content to be added to that function into the ORIGINAL function and delete your new definition of it.

I'm going to pretend I understood that and ask you politely to eksplain it to me again 
slowly.
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Alynn

on_key_press already exists in the global script... you need to place your code in that function... not create a new function called on_key_press

viktor

what about that string text and index? Where do I put that in?
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Sam.

Go onto the script menu and then click on_key_press

then change this line: 
if (keycode==17)  QuitGame(1);   // Ctrl-Q
to:  if (keycode==17)  GUIon(intGUInumber);   // Ctrl-Q

then at the bottom of the list add this line:
if (keycode==27)  GUIon(intGuinumber);   // Escape

Then your gui will open when ctrl-Q is pressed and escape. (change intGUINUmber to the number of your gui)
Bye bye thankyou I love you.

Ashen

if (interface==0) {// if Restore interface
  string text;
  int index;
  if (button==1)

and:

if (interface==1) { // if save interface
  string text;
  int index;
  if (button==0)

Also, you might want to call the GUIs by name instead of number, e.g. LOADGUI and SAVEGUI, as it's easier to tell which bit of the script refers to which GUI then.
I know what you're thinking ... Don't think that.

viktor

Ok now I don't know anithing. What's with all theese scripts.

Zootfruit: Thanks for your efort, but I fixd that problem. Now I need help with the LOAD and QUIT GUI.

ASHEN: What will that script do. I already have a script. I got all confused now. I took a good look at your script but I here is a little problem with it. I'm missing the button functions. The buttons in the GUI have no function. Do you understand what I mean?
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ashen

Sorry, Viktor, should've been clearer. The 'string text;' and 'int index;' line go at the beginning of the script you've alread got. In full (but cleaned up a little):

function interface_click(int interface, int button) {

if (interface==0) { // if Restore interface
Ã,  string text;
Ã,  int index;
Ã,  if (button==1) {// if cancel is pressed
Ã,  Ã,  InterfaceOff(0); // Close interface
Ã,  }

Ã,  else {
Ã,  Ã,  Ã, index=ListBoxGetSelected(0,0); // else get the selected game
Ã,  Ã,  Ã, RestoreGameSlot(savegameindex[index]);
Ã,  } // restore the game
}

if (interface==1) { // if save interface
Ã,  string text;
Ã,  int index;
Ã,  if (button==0) { // if enter is pressed
Ã,  Ã,  index=ListBoxGetNumItems(1,3);Ã,  // Count saved games
Ã,  Ã,  if (index<20) { // if less than 20
Ã,  Ã,  Ã,  GetTextBoxText(1,0,text); // Get the typed text
Ã,  Ã,  Ã,  InterfaceOff(1); // Close interface
Ã,  Ã,  Ã,  SaveGameSlot(index+1,text);
Ã,  Ã,  } // Save game (text as description)

Ã,  Ã,  else { // if saved games are 20
Ã,  Ã,  Ã,  index=ListBoxGetSelected(1,3); // Get the selected save game
Ã,  Ã,  Ã,  GetTextBoxText(1,0,text); // Get the typed text
Ã,  Ã,  Ã,  InterfaceOff(1); // Close the interface
Ã,  Ã,  Ã,  SaveGameSlot(savegameindex[index],text);
Ã,  Ã,  } // Overwrite the selected game
Ã,  }

  if (button==2) InterfaceOff(1); // if cancel is pressed close interface
}

I know what you're thinking ... Don't think that.

viktor

so I just copy this in to the global scriot?
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ashen

Yes, replacing any

if (interface == 0) {
  //whatever
}

if (interface == 1) {
  //whatever
}

that might already be there. Another point: make sure they refer to the right GUIs, by default 0 and 1 are the STATUSLINE and ICONBAR GUIs.
I know what you're thinking ... Don't think that.

viktor

well this is what I+ve got in now. (I hawen't added a the lines you gave me)

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)  InterfaceOn(3);    // 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)   show_inventory_window();  // 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


Do I have to delete anithing of this?
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ashen

Looks fine, except you'll want to change:

  if (keycode==363) SaveGameDialog();   // F5
  if (keycode==365) RestoreGameDialog();  // F7

to

  if (keycode==363) GUIOn(1);   // F5 Save GUI
  if (keycode==365) GUIOn(0);  // F7 Load GUI

Or what ever numbers the save and load GUIs are. The rest of it goes under:

function interface_click(int interface, int button) {
I know what you're thinking ... Don't think that.

viktor

I think I'm never gona get this right.

This mesage pops up

signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ashen

Can you post the lines around line 89? It looks like you've missed a } somewhere.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk