Torn.com Bot Away Script

By Defenestration on Jul 10, 2012

Copy and paste into remotes, This is for irc.torn.com bots.
away/brb/bbiab/bbl/afk/bbs/breb [reason optional]
back/bk unsets away

;---- Away Script by Defenestration 271320, Thanks to Izzy, Onions, and Cloney for helping.

on *:TEXT:*:#: {
  if ($regex($1,/(^b(rb|biab|bl|bs|reb)|away|afk)($|,$|.$|!$)/i)) {
    if (!$2) {
      write -s $+ $read(ids.txt,s,$nick) away.txt $read(ids.txt,s,$nick) $ctime $1
      .msg $chan See you later $nick
    }
    else {
      write -s $+ $read(ids.txt,s,$nick) away.txt $read(ids.txt,s,$nick) $ctime $2-
      .msg $chan See you later $nick $+ , Enjoy $2-
    }
  }
  if ($regex($1,(^back$)|(^back[\.\, ]))) || ($1 == bk) {
    if (!$read(away.txt, s, $read(ids.txt,s,$nick))) {
      .msg $chan You're back?? I didn't notice you even left $nick $+ ...
    }
    else {
      .msg $chan Welcome back $nick  - you were away for $duration($calc($ctime - $gettok($read(away.txt,s,$read(ids.txt,s,$nick)),1,32)))
      write -ds $+ $read(ids.txt,s,$nick) away.txt
    }
  }
  var %a = $numtok($1-,32), %b = 1
  while (%b <= %a) {
    if ($read(away.txt,s,$read(ids.txt,s,$gettok($1-,%b,32)))) {
      .msg $chan $gettok($1-,%b,32) has been away $duration($calc($ctime - $gettok($read(away.txt,s,$read(ids.txt,s,$gettok($1-,%b,32))),1,32))) - Reason: $gettok($read(away.txt,s,$read(ids.txt,s,$gettok($1-,%b,32))),2-,32)
    }
    inc %b
  }
}

Comments

Sign in to comment.
Stewie1k94   -  Jul 31, 2012

Nice snippet. :)

 Respond  
Defenestration   -  Jul 11, 2012

this is for Torn.com webgame.. needed files are ids.txt and away.txt.

 Respond  
Kilim   -  Jul 11, 2012

What are the required files? Where do they go etc. Not working on it's own.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.