Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: geork on Fri 03/04/2009 22:43:58

Title: Timer doesn't seem to do much
Post by: geork on Fri 03/04/2009 22:43:58
Hey all!
  I'm trying to give the player time for 3 seconds to move the mouse before the narrator starts to talk again, as part of a tutorial. But my code is simply not using the if statement for the timer, here's the code:
 
    function room_AfterFadeIn()
{
Mouse.Visible = false;
gIconbar.Visible = false;
gStatusline.Visible = false;
cEgo.Say("&19 hello world!");
Wait(40);
cNarr.Say("&1");
             //continues with Narr talking
Mouse.Visible = true;
  gIconbar.Visible = true;
  gStatusline.Visible = true;
SetTimer(2, 120);  //heres the timer
if(IsTimerExpired(1)){  //here is where it is meant to go onto the
                                     //next bit
   Mouse.Visible = false;
    gIconbar.Visible = false;
    gStatusline.Visible = false;
   cNarr.Say("&7");
   Wait(40);
   Mouse.Visible = true;
   gIconbar.Visible = true;
   gStatusline.Visible = true;
   SetTimer(3, 280);
   if(IsTimerExpired(3)){
     Mouse.Visible = false;
      gIconbar.Visible = false;
      gStatusline.Visible = false;
     cNarr.Say("&8");
     Wait(40);
                   //more Narr talking
     Mouse.Visible = true;
     gStatusline.Visible = true;
     gIconbar.Visible = true;
   }
}
}

  thankyou
Title: Re: Timer doesn't seem to do much
Post by: RickJ on Fri 03/04/2009 22:55:26
The function room_AfterFadeIn() runs only once.  You proably want to check the timer's in the RepExecute() event handler function.  Use the lightning bolt icon to create the event.