Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Kimbra on Fri 28/10/2011 12:10:07

Title: restore, restart and quit
Post by: Kimbra on Fri 28/10/2011 12:10:07
well.. the game I'm working on has only 3 rooms:

R1 Starting room
R2 The game
R3 Death Room

I created three objects in the death room for restart, restore and quit functions.
my question is: should I copy/paste their code from global? I'm afraid the restore may have bad effects later???

help  ???
Title: Re: restore, restart and quit
Post by: Arjunaz78 on Fri 28/10/2011 13:51:18
Did you mean GUIs or Object?and why you need to copy/paste from Global script instead of room script?

for what i know..global script for whole your game action script,if you only want the effect just to your room only,just edit the room script instead of global script..don't just copy/paste the code,or you can finally facing a doubling same script/function or make conflict with room script & global script..

correct it if im wrong..
Title: Re: restore, restart and quit
Post by: AnasAbdin on Fri 28/10/2011 14:27:55
kimbobo could you explain more?

correct me if I'm wrong... you want to make a 'death' room with three gui buttons or objects to restore, restart and quit game?

in this case, create the three objects. Go to their events list and put the code in 'Anyclick on object'...
the code can be as simple as that (assuming the button names are Restore, Restart and Quit)
function restore_AnyClick()
{
RestoreGameDialog();
}

function restart_AnyClick()
{
RestartGame();
}


for the quit button, if you want a confirmation dialog when clicked do this:

function quit_AnyClick()
{
  gPanel.Visible = false;
  Wait(1);
  QuitGame(1);
  gPanel.Visible = true;
  gIconbar.Visible = false;
  mouse.UseModeGraphic(eModePointer);
}


I'm not sure what cursors you use in your single room game, but if you want to disable or change cursors they are as easy as:
mouse.UseModeGraphic(eModePointer);
mouse.DisableMode(eModeLookat);
mouse.DisableMode(eModeTalkto);
//.........


by the way, the code above are taken from the global script. I'm sure someone will soon notice your thread and laugh at me hehehhe
Title: Re: restore, restart and quit
Post by: Kimbra on Fri 28/10/2011 16:07:47
Arjunaz78: thank you I won't copy paste anything :)

AnasAbdin: Woohoo! That's exactly what I wanted!  :-*  :-*  :-*  :-* and  :-*