This is how i have the script at present and all works superb with the exception of the !away function.
on *:start: {
hmake AwayTable 50
}
on *:text:!afk*:#Simons-Forums: {
var %time = $ctime
if (!$hget(AwayTable)) { hmake AwayTable 50 }
hadd AwayTable $nick $iif($2,$2-,Unknown) %time
msg $chan $nick is away @ $+ $time(%time,hh:nn mmm dd yyyy)
}
on *:text:!back:#Simons-Forums: {
if ($hget(AwayTable,$nick)) {
msg $chan $nick is back from $gettok($v1,1- $calc($gettok($v1,0,32) - 1),32) $+ . $nick was gone for $duration($calc($ctime - $gettok($v1,$gettok($v1,0,32),32))) $+ .
hdel AwayTable $nick
}
else msg $chan You're not away.
}
on *:text:!away:#Simons-Forums: {
var %cnt = 1
var %total = $hget(AwayTable,0).item
while (%cnt <= %total) {
var %name = $hget(AwayTable,%cnt).item
var %data = $hget(AwayTable,%cnt).data
write afk.tmp %name is away $chr(40) $+ $gettok(%data,1- $calc($gettok(%data,0,32) -1),32) $+ $chr(41) since $time on $date($gettok(%data,$gettok(%data,0,32),32)) $+ .
inc %cnt
}
.play $chan afk.tmp 1500
.remove afk.tmp
}
on *:text:*:#Simons-Forums: {
if ($hget(AwayTable,$remove($strip($1),?)) && !$2) {
var %data = $hget(AwayTable,$remove($strip($1),?))
msg $chan $remove($strip($1),?) is away $chr(40) $+ $gettok(%data,1- $calc($gettok(%data,0,32) -1),32) $+ $chr(41) since $time($gettok(%data,$gettok(%data,0,32),32)) $+ .
}
}
on *:action:*:#Simons-Forums: {
if ($hget(AwayTable,$remove($strip($1),?)) && !$2) {
var %data = $hget(AwayTable,$remove($strip($1),?))
msg $chan $left($1,-1) is away $chr(40) $+ $gettok(%data,1- $calc($gettok(%data,0,32) -1),32) $+ $chr(41) since $time on $date($gettok(%data,$gettok(%data,0,32),32)) $+ .
}
}
on *:part:#Simons-Forums: {
if ($hget(AwayTable,$nick)) {
hdel AwayTable $nick
}
}
on *:quit: {
if ($hget(AwayTable,$nick)) {
hdel AwayTable $nick
}
}
I took onbaord comments earlier about time commands and edited and comments about changing lin structures.
I have just tested it and this is the result.
[01:14] <^Silent_Runner^> testing 3I Am Away From Keyboard script
[01:14] <^Silent_Runner^> !afk testing script
[01:14] <^Merlin> ^Silent_Runner^ is away @01:14 Jan 09 2007
[01:15] <^Silent_Runner^> right 01:14
[01:15] <^Silent_Runner^> give it a few mins and i'll check if it has recorded correct time
[01:15] <Tallulah> ok
[01:17] * ChanServ sets mode: +o ^Silent_Runner^
[01:17] -ChanServ:#Simons-Forums- OP command used for ^Silent_Runner^ by ^Silent_Runner^
[01:17] -ChanServ- Opped ^Silent_Runner^ on channel #Simons-Forums.
[01:17] * ^Silent_Runner^ sets mode: -o ^Silent_Runner^
[01:18] * ChanServ sets mode: +o ^Silent_Runner^
[01:18] -ChanServ:#Simons-Forums- OP command used for ^Silent_Runner^ by ^Silent_Runner^
[01:18] -ChanServ- Opped ^Silent_Runner^ on channel #Simons-Forums.
[01:18] * ^Silent_Runner^ sets mode: -o ^Silent_Runner^
[01:18] * ChanServ sets mode: +o ^Silent_Runner^
[01:18] -ChanServ:#Simons-Forums- OP command used for ^Silent_Runner^ by ^Silent_Runner^
[01:18] -ChanServ- Opped ^Silent_Runner^ on channel #Simons-Forums.
[01:18] * ^Silent_Runner^ sets mode: -o ^Silent_Runner^
[01:20] <^Silent_Runner^> nagh i give up with that one, i can not get it too work
[01:20] <^Silent_Runner^> !away
[01:20] <^Merlin> ^Silent_Runner^ is away (testing script) since 01:20:27 on 09/01/07.
As you can see it is still posting on the !away command the time that command is issued and not the time the !afk command was issued.
So i am none the wiser about what to do, any help would be greatly appreciated as this is a cool script thus far, i love it
Many Thanks