room_RepExec() continues when game is paused [solved]

Started by HandsFree, Thu 14/03/2013 11:17:44

Previous topic - Next topic

HandsFree

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

Khris

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
  // 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.

HandsFree

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

Khris

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.

SMF spam blocked by CleanTalk