Sign in to follow this  
Followers 0
SpookMeister

Simple anti-auto-logout script

3 posts in this topic

I created this script to keep from being logged out of a game called Runescape. They have an annoying "feature" that auto logs you off of the game if you are idle for more than 90 seconds. I found that moving the mouse even a little periodically is enough to abort that, so here was my solution. I went to extra lengths to keep it unobtrusive during active use and random in its timing and activity to avoid raising flags from the Game Gestapo.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        SpookMeister <myemail@nowhere.com>
;
; Script Function:
;   Periodically moves the mouse to avoid being auto logged out of games 
;   (screensavers too).
;
; ----------------------------------------------------------------------------


; Press ESC to terminate program
HotKeySet("{ESC}", "Terminate")

Global $LastPosX
Global $LastPosY
Global $CurPosX
Global $CurPosY

$pos = MouseGetPos()
$LastPosX = $pos[0]
$LastPosY = $pos[1]

; Main loop
WHILE 1
   $sec = Random(30,45,1)
   sleep($sec * 1000)
   CheckMove()
WEND

; See if the mouse has moved since the last time checked
Func CheckMove()
   $pos = MouseGetPos()
   $CurPosX = $pos[0]
   $CurPosY = $pos[1]
   IF $CurPosX = $LastPosX AND $CurPosY = $LastPosY THEN DoSomeThing()
  ; Update vars to be able to detect changes on next iteration 
   $LastPosX = $CurPosX 
   $LastPosY = $CurPosY
EndFunc


Func DoSomething()
  ; Make sure you don't get a null movement if random returns 0 for both coords
   Do
      $ranX = Random(-1,1,1)
      $ranY = Random(-1,1,1)
   Until $ranX <> 0 AND $ranY <> 0
   MouseMove($CurPosX + $ranX, $CurPosY + $ranY)
   MouseMove($CurPosX , $CurPosY)
EndFunc

Func Terminate()
   EXIT
EndFunc

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites



Welcome to the forums!

Nicely written script -- I like how it doesn't intervene if there has been activity and I like the way you've broken it down into functions.

Share this post


Link to post
Share on other sites

nice script, useful!

- Matt :whistle:


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0