Toribash
Original Post
mircbot 1.0
Hey guys, this is the first iteration of mircbot, a very simple bot that will allow you to join any Toribash server from mirc. To utilize it, you simply type:

/botset (username) (password)

The username and password being the info from your Toribash account. After setting up the bot, you then go:

/botjoin (servername)

The servername is just that, the name of the server you want to join.

For those that still don't understand, say I wanted to join judo1. I'd type:

/botset Charlie fakepassword
/botjoin judo1

And boom, it'd open a new window in mirc.

To install, go into Tools>Script Editor
Make sure you go to the Remote tab.
Then paste this:

alias botset {
  %bot.name = $1
  %bot.pass = $2
}

alias botjoin {
  if (%bot.connected == 1) {
    window -c %bot.window
    sockwrite -n bt QUIT
    sockclose bt
  }
  %bouting = 0
  %bot.connected = 0
  %bot.type = 0
  %bot.s_name = $1
  %bot.window = @ $+ $1
  window -aek[1]l20 %bot.window
  echo 1 %bot.window Resolving $1...
  sockopen bt 66.230.224.102 22001
}


on *:sockopen:bt: {
  if ($sockerr) {
    %bot.connected = 0
    window -c %bot.window
    return
  }
  else {
    if (%bot.type == 0) {
      sockwrite -n bt join %bot.s_name
    }
    else {
      %bot.mdpass = $md5(%bot.pass)
      sockwrite -n bt mlogin %bot.name %bot.mdpass
      unset %bot.mdpass
      %bot.connected = 1
      timer75 0 10 sockwrite -n bt PING
      echo 1 %bot.window Connected to %bot.s_ip $+ : $+ %bot.s_port
      sockwrite -n bt SPEC
    }
  }
}

on *:sockclose:bt: {
  echo 1 %bot.window %bot.type
  if (%bot.type == 1) {
    timer75 off
    window -c %bot.window
    %bot.connected = 0
  }
}

on *:sockread:bt: {
  if ($sockerr) {
    %bot.connected = 0

    return
  }
  sockread %data
  tokenize 32 %data
  if ($1 == FORWARD) {
    sockclose bt
    tokenize 59 %data
    tokenize 58 $2
    %bot.s_ip = $1
    %bot.s_port = $2
    %bot.type = 1
    echo 1 %bot.window Connecting to %bot.s_ip $+ : $+ %bot.s_port
    sockopen bt %bot.s_ip %bot.s_port
  }

  if ($1 == DISCONNECT) {
    %l = $len(%data) - 11
    %data = $right(%data, %l)
    tokenize 59 %data
    %parsed = $2-
    echo 2 %bot.window %parsed
    unset %parsed
    unset %l
  }

  if ($1 == BOUT) {
    if (%bouting == 0) {
      clear -l %bot.window
      %bouting = 1
    }
    var %badge
    if ($8 < 0) %badge = @
    if ($8 == 1) %badge = +
    if (($8 == 2) || ($8 == 3)) %badge = *
    if (($8 > 3) && ($8 < 8)) %badge = #
    if (($8 > 7) && ($8 < 16)) %badge = ~
    if ($8 > 15) %badge = @
    if ($9 != 0) aline -l 1 %bot.window %badge $+ $9
    unset %badge
  }

  if ($1 == SPECS) {
    %l = $len(%data) - 8
    %data = $right(%data, %l)
    %l = $numtok(%data, 9)
    if (%l > 0) {
      tokenize 9 %data | aline -l 1 %bot.window (S) $* 
    }
    %bouting = 0
    unset %l
  }

  if ($1 == SAY) {
    %l = $len(%data) - 4
    %data = $right(%data, %l)
    tokenize 59 %data
    %p_channel = $1
    if (%p_channel = 0) echo 2 %bot.window $2-
    else {
      %parsed = $2-
      tokenize 58 %parsed
      %p_name = $1
      %p_msg = $2-
      %l = $len(%p_msg) - 1
      %p_msg = $right(%p_msg,%l)
      if (%p_name == BotFramew) echo 4 %bot.window < $+ %p_name $+ > %p_msg
      else {
        echo 3 %bot.window < $+ %p_name $+ > %p_msg
      } 
      unset %p_msg
      unset %l
      unset %p_name
      unset %p_channel
      unset %parsed
    }
  }

  unset %data
}

on 1:INPUT:%bot.window:{
  %p = $left($1, 1)
  if (%p == $) {
    %l = $len($1-) - 1
    %p = $right($1-,%l)
    sockwrite -n bt %p
    unset %l
  }
  else sockwrite -n bt SAY $1-
  unset %p
}

on 1:CLOSE:%bot.window: {
  if (%bot.connected == 1) {
    sockclose bt
    timer75 off
    %bot.connected = 0
  }  
}
hm, this looks interesting. If I used mirc as my irc application, I would give it a try. Good luck with it.
Since when did I become Asian?
I'm a bit suspicious here, mainly because this is your first post ever ron0ald.


I'm suggesting anyone who does decide to use this to use extreme caution.

EDIT: Veb has confirmed this to be legit. nice script ron0ald, I'm sure this will be of use to many people
Last edited by Stupinator; Jan 12, 2009 at 03:55 AM.
Former Item Forger
Originally Posted by Stupinator View Post
I'm a bit suspicious here, mainly because this is your first post ever ron0ald.


I'm suggesting anyone who does decide to use this to use extreme caution.

EDIT: Veb has confirmed this to be legit. nice script ron0ald, I'm sure this will be of use to many people

I was worried about the same thing, thanks for checking it out for us veb!