Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Wed 10/02/2010 19:26:16

Title: Timer query SOLVED
Post by: barefoot on Wed 10/02/2010 19:26:16
Hi


UPDATE...

I went throught the manual again only this time i found what i was looking for...
If at first you dont see.. read read and read again... SORRY


function cChris_UseInv()
{
if ((cChris.x - cEgo.x <= 90 && cChris.x >= cEgo.x) || (cEgo.x - cChris.x < 90 && cEgo.x > cChris.x))

{
cChris.Say("Ouch!");

{
 cEgo.Say("sorry mate");
 Display("You drag him off and hide him in the bushes");
SetTimer(2,0);
cChris.ChangeRoom(25);
 
{

{

}
}
}
}

}















I have set up a Timer with RepExe and it works ok...

The query I have is that once you have put another character out of action I need to quit that Timer... The other character is put out of the game yet Timer errors saying not in room.  I can't quite find the answer I'm looking for.

PS  I am trying to repeat this for another character as well.

Here's my code:



function room_Load()
{

 player.SpeechView = 5;
  cEgo.ChangeView(4);
 
  cEgo.SetWalkSpeed(3, 3);
 
cEgo.ManualScaling = true;
cEgo.Scaling = 80;

cChris.ManualScaling = true;
cChris.Scaling = 80;

cHank.ManualScaling = true;
cHank.Scaling = 80;

player.FaceLocation(165, 357);
SetTimer(1, 1600);
 
   SetTimer(2, 2800);

}



function room_RepExec()
{
if (IsTimerExpired(1)){
   cHank.Walk(96, 458, eBlock);
   cHank.Say("Nothing here");
   cHank.Walk(414, 318, eNoBlock);
   cHank.Say("Wish I had me fags now!");
   SetTimer(1, 1600);
 }

if (IsTimerExpired(2)){
   cChris.Walk(96, 458, eBlock);
   cChris.Say("All quiet here");
   cChris.Walk(414, 318, eNoBlock);
   SetTimer(2, 2800);

}
 }
}





Help very much appreciated

barefoot


Title: Re: Timer query SOLVED
Post by: monkey0506 on Wed 10/02/2010 19:39:41
Uhm...glad you got it solved...but...what is:

{

{

}
}


That doing?? :o

There's no point to randomly adding braces that you don't need.
Title: Re: Timer query SOLVED
Post by: barefoot on Wed 10/02/2010 20:18:01
You're proberbly right there monkey...

but it works...     I will look at and take out unwanted braces..

cheers

barefoot