mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
B
BritishGent
BritishGent
B
Thank you. i think i understand now, thank you for your patience. smile

#168681 12/01/07 01:48 AM
L
Lucan
Lucan
L
So I'm using this and loving it. But I had another idea (not sure how hard it would be to implement): changing the syntax to "!afk <time expected back> <reason>" then at the time entered the bot would message the chan "Nick expected back soon." then the rest would be like normal. Or maybe it could just be an option. Just hit me and i figured id post.

#168695 12/01/07 01:47 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
What do you do with people in different time zones?

L
Lucan
Lucan
L
Well i guess they could input it as hours they expect to be away (idk about minutes), but it was just an idea

#168709 12/01/07 09:21 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Try this. To include the estimated time away, a user would type:

For 2 hours:
!afk -t2 reason for being away

For 30 minutes (0.5 hours):
!afk -t.5 reason for being away
!afk -t0.5 reason for being away

Etc. This is only in hours, so decimals are needed for minutes... or, you could enter it as:

For 30 minutes (30 minutes * 60 minutes in an hour):
!afk -t30*60 reason for being away

Code:
on *:start: {
  hmake AwayTable 50
}

on *:text:!afk*:#Simons-Forums: {
  var %time = $ctime
  if (!$hget(AwayTable)) { hmake AwayTable 50 }
  if ($left($2,2) == -t) {
    if ($len($2) == 2) {
      var %reason = $iif($4,$4-,Unknown)
      .timerAway. $+ $nick 1 $calc($3 * 3600) msg $chan $nick should be back soon.
    }
    else {
      var %reason = $iif($3,$3-,Unknown)
      .timerAway. $+ $nick 1 $calc($right($2,-2) * 3600) msg $chan $nick should be back soon.
    }
  }
  else var %reason = $iif($2,$2-,Unknown)
  hadd AwayTable $nick %reason %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
    .timerAway. [ $+ [ $nick ] ] off
  }
  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($gettok(%data,$gettok(%data,0,32),32)) on $date($gettok(%data,$gettok(%data,0,32),32)) $+ .
  }
}

on *:part:#Simons-Forums: {
  if ($hget(AwayTable,$nick)) {
    hdel AwayTable $nick
    .timerAway. [ $+ [ $nick ] ] off
  }
}

on *:quit: {
  if ($hget(AwayTable,$nick)) {
    hdel AwayTable $nick
    .timerAway. [ $+ [ $nick ] ] off
  }
}


As a note, you can enter it using a space after the -t if you want to:

For 3.5 hours:
!afk -t 3.5 Reason for being away.

Page 2 of 2 1 2

Link Copied to Clipboard