Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: LeChuck on Wed 18/04/2007 03:37:28

Title: Ingame screensaver?
Post by: LeChuck on Wed 18/04/2007 03:37:28
Is there an easy way to trigger a screensaver, being sent to another room, after a certain period of time? It probably has go to somewhere in the global rep exec script but I have no idea how to find out whether the player moved his or her mouse and hit any buttons the last five minutes or now.

I tried snooping about the forums with little luck. Cheers!

Edit: The code below with a few additions made the screensaver work perfectly! Thanks a lot.
Title: Re: Ingame screensaver?
Post by: Gilbert on Wed 18/04/2007 04:00:49
Something like this (not polished)?

On top of global script:

int idletime=0, lastmx=0, lastmy=0;


In rep. exec. of the global script:

if (player.Room != 4) { //Say, room 4 is the "screensaver" room
  if (mouse.x==lastmx&&mouse.y==lastmy) {
    idletime++;
    if (idletime>=12000) player.ChangeRoom(4); //5 minutes
  } else idletime=0;
  lastmx=mouse.x;
  lastmy=mouse.y;
}


In on_mouse_click() function add the line:

idletime=0;