7. AFK Script
It automatically changes your nickname from "nickname" to "afk|nickname" after some inactivity period.
[SELECT ALL] Code:
//AFK Script
//by CiD
//TODO: make a settings menu
//User Settings
//This is what will be added to your name when you are AFK.
afkstr = "|afk"
//If set to 1, it will display a message to other players when you go AFK. Set to 0 to disable.
afkshowmessage = 1
//This will be placed after your name and sent to other players.
afkmessage = "is no longer available."
//This is how long (in seconds) the script will wait if you are idle before changeing you to AFK.
timeuntilafk = 20
//DO NOT EDIT BELOW HERE
curafk = 0
afktime = 0
alias afk [
if $arg1 [
if (= $curafk 0) [
oldname = $curname
name (concatword $oldname $afkstr)
curafk = 1
echo "You are now set to: AFK"
if $afkshowmessage [say (concat "AFKScript:" $oldname $afkmessage )]
]
] [
if $curafk [
name $oldname
curafk = 0
echo "You are now set to: ONLINE"
]
]
]
alias notafk [
if (= $afktime 0) [afkcheck]
afktime = 0
if (= $curafk 1) [afk 0]
]
alias afkcheck [
afktime = (+ $afktime 5)
if (= 2 (+ (> $afktime (* $timeuntilafk 1000)) (= $curafk 0))) [afk 1]
sleep 5 afkcheck
]
bind w [forward;notafk]
bind a [left;notafk]
bind s [backward;notafk]
bind d [right;notafk]
//END of AFK Script