Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: HandsFree on Thu 14/03/2013 11:17:44

Title: room_RepExec() continues when game is paused [solved]
Post by: HandsFree on Thu 14/03/2013 11:17:44
In room_RepExec() I add one to a counter every loop and when the counter is 600 a character enters the room, walking, eBlock.
This is ok, but when there's a gui visible like the inventory, apparently the repexec continues and the game freezes when the counter is 600. The gui is set to 'pause game when shown'.

How can I make sure the game repexec doesn't execute when there's a gui visible? Note this is not repexec_always.

thanks
Title: Re: room_RepExec() continues when game is paused
Post by: Khris on Thu 14/03/2013 11:37:09
Only blocking events prevent room_RepExec from running; pausing the game has no effect. If you look at the default game's global script, you'll find this in repeatedly_execute:

Code (ags) Select
  // Put here anything you want to happen every game cycle, even when
  // the game is paused. This will not run when the game is blocked
  // inside a command like a blocking Walk()
 
  if (IsGamePaused() == 1) return;

  // Put here anything you want to happen every game cycle, but not
  // when the game is paused.
Title: Re: room_RepExec() continues when game is paused
Post by: HandsFree on Thu 14/03/2013 12:30:34
Yes, I put that line in the room's repexec and it works. So I suppose this should go in all the rooms repexec's? Never realized that.
thanks
Title: Re: room_RepExec() continues when game is paused [solved]
Post by: Khris on Thu 14/03/2013 13:06:10
Well, not really, it depends on how you're using the function, doesn't it?
That line isn't specific to rep_ex, it could be anywhere else, too.

Sure, you could add it each time you're adding the room_RepExec, but there won't always be a reason to do so.