Ingame screensaver?

Started by LeChuck, Wed 18/04/2007 03:37:28

Previous topic - Next topic

LeChuck

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.

Gilbert

Something like this (not polished)?

On top of global script:
Code: ags

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


In rep. exec. of the global script:
Code: ags

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:
Code: ags

idletime=0;

SMF spam blocked by CleanTalk