ID:158150
 
Alright So im Trying to make an Auto AFK Proc, i've got the proc itself for that set up but how would i set up the proc that checks if they havent Moved or Said Anything in say 10 minutes or Sleep(600)?

Please help, Its Greatly appreciated.
I don't want to kick them i want them to be unable to Train until they move around for abit. because for instance i Code. and if i get busy or have to go afk i don't wanna have to re log on its just a hassle.
I have thats the thing i've read it but i want them completly frozen until they click a verb to unfreeze themselves.
Its Cool Thanks for Trying to help. i really appreciate it.
You might find this useful.
mob
var/tmp/activity = 0


Whenever they do A Thing, set activity to world.time. Have your proc loop infinitely, and sleep for (AFKTIME - (world.time - activity)), or basically until the first moment at which they could possibly have been AFK for the amount of time (IE: if you want them to go AFK after 10 minutes, and they last took an action 7 minutes ago, you'll want to sleep for 3 minutes). At that point, if world.time >= (activity + AFKTIME), then do whatever you want to make them AFK.

Ideally, you then break out of the loop and end the proc at that point, and then have your Things call the proc again when a player returns from being AFK.
In response to Garthor
Don't forget about client.inactivity
The Great Sabin wrote:
If you want it to sleep() for 10 minuets, Then do

sleep(1000) //Ex, 600 is 1 minuet, 1000 is ten minuets


I don't mean to be degrading, but I thought it might brighten some peoples' day if I pointed this out.

600*10 = 1000? QED
In response to Rikvdv2
Rikvdv2 wrote:
I don't want to kick them i want them to be unable to Train until they move around for abit. because for instance i Code. and if i get busy or have to go afk i don't wanna have to re log on its just a hassle.

You could, for example, block every training-related verb or proc when the player is AFK, and having them unblock it by using a verb which will ask the player to type a randomly generated word/number displayed on their screen, so that they can't just make their autoclicker or whatever do the unblocking thing.

client/var/isAFK

proc/afk_checker()
while(1)
sleep(1200) // check for AFK players every 2 minutes
for(var/client/C)
if(!C.isAFK && C.inactivity >= 3000) // AFK for 5 minutes
C.isAFK = 1

world/New()
..()
spawn()
afk_checker()

mob/verb
some_training_verb()
if(client.isAFK)
src << "You wish!"
return
// training stuff

unblock_self()
if(client.isAFK)
var
random_number = rand(1000,9999)
input_number = input("Enter the following number to unblock your verbs: [random_number]","Unblock self") as null|num
if(input_number && input_number == random_number)
client.isAFK = null
src << "Unblocked!"
else
src << "The numbers did not match."
There're a few methods, so I'll give you a bad one.

Make all player mobs be born with the procedure.
In response to Loduwijk
Loduwijk wrote:
Don't forget about client.inactivity

Presumably this is to prevent unattended macroing, so inactivity is useless.

Of course, then again, so is my solution. The only good solution is to make unattended macroing itself useless, which is a design problem rather than a programming problem.
In response to Nielz
Thank You all for your Help I think i got it now