Personal AFK checker/Guard

Discussion about the technical aspects of scripting. Ask about all issues involving your freelance projects here.
Locked
User avatar
bearman
Master Scribe
Reactions:
Posts: 68
Joined: Mon Feb 28, 2011 6:09 pm

Personal AFK checker/Guard

Post by bearman »

Hi

I wrote this as someone I know lost his wep whilst being afk due to absent mindedness. It monitors your position
and if it doesn't change for more than a minute it will sacred journey you to a preset safe location and hides you.
So if you fall asleep or you drop a cup of hot coffee on yourself then if will get you out of there so you spend
as little time possible breaking the rules and hopefully saving your wep and your good name. Obviously this won't
work for recall levelers. Please let me know what you think or spot any bugs. Instructions are in the top part of the script.

Code: Select all

;=================================================================
; Script Name: Personal AFK Checker/Saver
; Author: Bearman (Excelsior Shard)
; Version: 1.0
; Client Tested with: 5.0.9.1
; EUO version tested with: 1.5 Version 176
; Shard FS:
; Public Release: 9th May 2012
;=================================================================
; This is for manual weapon levelers to use. It's really no good for the player that
; recall levels. It's purpose is to save you when you fall asleep or something really
; bad happens in real like your grans choking on a peice of bacon and don't have time
; stop what you are doing. It works by making sure you are active and monitors your possition
; in game and if you stand still for 50 seconds it will give you a 10 second warning
; followed by 5 seconds one and if you have not taken a step then it will sacred journey you
; out to a preset location and attempt to hide you thus stopping you from afk leveling.
; For this to work properly you will need a rune book titled safety with the default
; rune set as somewhere safe for example TC. It needs to be in your main backpack.
; The variable at the beggining called %wait is adjustable it's default is 60 seconds
; I think that's more than enough so I'd advise not to raise it.
;=================================================================

set %wait 60

;*****************************************************************
; Looks for book
;*****************************************************************
finditem ZBN C_ , #backpackid
For #findindex 1 #findcnt
{
finditem ZBN #findindex C_ , #backpackid
event property #findid
if safety in #property
set %safetybook #findid
}
if %safetybook = N/A
{
Display No safety Book Found. Halting
halt
}
;*****************************************************************
; Main loop
;*****************************************************************
main:
while H in #CHARSTATUS || no notin #CHARGHOST
      {
      }
set %posx #CHARPOSX
set %posy #CHARPOSY
set %idletime #SCNT + %wait - 10
while %posx = #CHARPOSX && %posy = #CHARPOSY && %idletime > #SCNT
      {
      }
if %posx = #CHARPOSX && %posy = #CHARPOSY
   goto countdown
if %posx <> #CHARPOSX || %posy <> #CHARPOSY
   goto main
countdown:
event ExMsg #charID 2 70 10 Seconds
while %posx = #CHARPOSX && %posy = #CHARPOSY && %idletime + 5 > #SCNT
      {
      }
if %posx <> #CHARPOSX || %posy <> #CHARPOSY
   goto main
event ExMsg #charID 2 70 5 Seconds
while %posx = #CHARPOSX && %posy = #CHARPOSY && %idletime + 10 > #SCNT
      {
      }
if %posx <> #CHARPOSX || %posy <> #CHARPOSY
   goto main
event ExMsg #charID 2 70 Going to safety
;*****************************************************************
; Gets you out of there
;*****************************************************************
recall:
set #ltargetid %safetybook
event macro 15 210
target
event macro 22 0
wait 2
if %posx = #CHARPOSX && %posy = #CHARPOSY
   goto recall
;*****************************************************************
; tries to hide you
;*****************************************************************
while H notin #charstatus
     {
     if #time >= %hide + 11
        {
        event macro 13 21
        set %hide #time
        }
     }
goto main
Locked