Simple BRB and Back script -- For mIRC bots

By iProTopia on Jun 21, 2011

Simple BRB and Back script for bots. To make this script work is simple, someone has to say brb and a reason

[16:31] <~Justin> brb I need to get water [16:31] <&iRobin> » Justin will be right back. Reason: I need to get water. «

[16:31] <~Justin> back [16:31] <&iRobin> » Justin is back from: I need to get water. «

PS: This is not my script; I kind of edited this.

on *:TEXT:brb*:#:{
  if ($2 == $null) {
    writeini brb.ini $nick Brb none
    writeini brbonoff.ini $nick brb on
    msg $chan » $nick will be right back. Reason: none. «
  }
  else {
    writeini brb.ini $nick Brb $2-
    writeini brbonoff.ini $nick brb on
    msg $chan » $nick will be right back. Reason: $2- $+ . «
  }
}
on *:TEXT:back:#:{
  if ($readini(brbonoff.ini,$nick,brb) == off) { HALT }
  elseif ($readini(brbonoff.ini,$nick,brb) == on) {
    msg $chan » $nick is back from: $readini(brb.ini,$nick,Brb) $+ . «
    remini brb.ini $nick Brb
    writeini brbonoff.ini $nick brb off
  }
} 
Sign in to comment.
Xpl0reR   -  Jun 26, 2011

this was a script i used, and Tom- on Swiftirc did for me. exactly the same regex line in the event.

 Respond  
blackvenomm666   -  Jun 21, 2011

ty jethro for that information as im sure you noticed im pretty new to doing any regex haha. so i was not away of that

 Respond  
iProTopia   -  Jun 21, 2011

What a debate lol Ty again for the snippets :)

 Respond  
Jethro   -  Jun 21, 2011

Venom, by using on text regex like you've done, you can drop the parentheses...and you have to know that only $1 will get control codes stripped. $1 equals to $regml(1).

 Respond  
blackvenomm666   -  Jun 21, 2011

i dont remember who originally did it i found it here but i edited it

on $*:TEXT:/^(brb|gone|afk|bbiab|bbiac|bbiaf|bbl)/Si:#:{
  if (!$readini(away.ini, $nick, time)) && (!$2) {
    set %away $nick
    writeini away.ini $nick time $ctime
    writeini away.ini $nick Reason no reason
    msg $chan $nick is now away
  }
  elseif ($readini(away.ini, $nick, time) >= 1) {
    msg $chan $nick $+ ,your already on brb to return please say back
  }
  else { if (!$readini(away.ini, $nick, time)) && ($2) {
      set %away $nick
      writeini away.ini $nick time $ctime
      writeini away.ini $nick Reason $2-
      msg $chan $nick is now away
    }
    elseif ($readini(away.ini, $nick, time) >= 1) {
      msg $chan $nick $+ ,your already on brb to return please say back
    }
  }
}
on $*:TEXT:/^(back)/Si:#:{
  if ($readini(away.ini, $nick, time) >= 1) {
    unset %away
    msg $chan Welcome back $nick you were gone for $duration($calc($ctime -$readini(away.ini, $nick, time) ))  away reason Reason $readini(away.ini, $nick, Reason)
    remini away.ini $nick
  }
}
on $*:TEXT:/^(!clearaway)/Si:#:{
  if (!$2) { msg $chan you must give a nick for the info to be deleted
  }
  else { 
    unset %away
    remini away.ini $2
    msg $chan $2 $+ 's away info has been deleted
  }
}
On *:TEXT:*:#: {
  if (%away isin $1-) {
    msg $chan hello $nick %away is away right now reason $readini(away.ini, $nick, Reason)
  }
}
 Respond  
blackvenomm666   -  Jun 21, 2011

true but meh im just saying some people forget haha. i have one of someones that i edited to suit my mood more added some stuff an such and half the time i forget to say back

 Respond  
napa182   -  Jun 21, 2011

then there would be no point in saying back at all =P

 Respond  
blackvenomm666   -  Jun 21, 2011

i mean lets say someone is away but forgets about the bot when they start talking it would auto bring them back soooo like

on *:TEXT:*:#:{
 if ($readini(brbonoff.ini,$nick,brb) == on) {
      msg $chan » $nick is back from: $readini(brb.ini,$nick,Brb) $+ . «
      remini brb.ini $nick Brb
      writeini brbonoff.ini $nick brb off
    }
  } 
}
 Respond  
Jethro   -  Jun 21, 2011

Venom, that doesn't seem like a good idea. If you may elaborate, make your point more clearly.

 Respond  
blackvenomm666   -  Jun 21, 2011

or an on text where if the persons == the away person it auto says they are back

 Respond  
Jethro   -  Jun 21, 2011

Oh yeah there is a probability that he or she will never say back...lol

But it's an easy fix to include a part, quit event to unset the variables! I don't reckon the departed people will come back and say back again...that just doesn't make sense.

Last but not least, change $nick to $wildsite in case he or she changes their nickname.

 Respond  
napa182   -  Jun 21, 2011

yes to keep it simple as so the author can understand you can do as an example: I still wouldn't go with global vars cuz you will tend to get people setting them selvs brb an never saying back then you will have unwanted global vars

on *:TEXT:*:#:{
  tokenize 32 $strip($1-)
  if (!$($+(%,f,$wildsite),2)) { inc -u4 $+(%,f,$wildsite)
    if ($1 = brb) {
      if ($readini(brbonoff.ini,$nick,brb)) { 
        .notice $nick you are already set as brb 
      }
      else {
        writeini brb.ini $nick Brb $iif(!$2,none,$2-)
        writeini brbonoff.ini $nick brb on
        msg # » $nick will be right back. Reason: $iif(!$2,none,$2-) «
      }
    }
    if ($1 = back) {
      if ($readini(brbonoff.ini,$nick,brb)) { 
        msg # » $nick is back from: $readini(brb.ini,$nick,Brb) $+ . «
        remini brb.ini $nick Brb
        remini brbonoff.ini $nick brb on
      }
    }
  }
}
 Respond  
Jethro   -  Jun 21, 2011

blackvenomm666, the use of

Reason: $iif($2,$2-,none.) 

eliminates the else condition.

 Respond  
blackvenomm666   -  Jun 21, 2011

<<doesnt even understand jethro_'s

 Respond  
blackvenomm666   -  Jun 21, 2011
on *:TEXT:*:#:{
  tokenize 32 $strip($1-)
  if ($1 == brb) {
    if ($2 == $null) {
      writeini brb.ini $nick Brb none
      writeini brbonoff.ini $nick brb on
      msg $chan » $nick will be right back. Reason: none. «
    }
    else {
      writeini brb.ini $nick Brb $2-
      writeini brbonoff.ini $nick brb on
      msg $chan » $nick will be right back. Reason: $2- $+ . «
    }
  }
  if  ($1 == back) {
    if ($readini(brbonoff.ini,$nick,brb) == off) { HALT }
    elseif ($readini(brbonoff.ini,$nick,brb) == on) {
      msg $chan » $nick is back from: $readini(brb.ini,$nick,Brb) $+ . «
      remini brb.ini $nick Brb
      writeini brbonoff.ini $nick brb off
    }
  } 
}
 Respond  
Jethro   -  Jun 21, 2011

Well ok, for starters, this:[quote]if ($2 == $null) {

writeini brb.ini $nick Brb none
writeini brbonoff.ini $nick brb on
msg $chan » $nick will be right back. Reason: none. «

} else {

writeini brb.ini $nick Brb $2-
writeini brbonoff.ini $nick brb on
msg $chan » $nick will be right back. Reason: $2- $+ . «

} }[/quote]can just be:

writeini brb.ini $nick Brb none
    writeini brbonoff.ini $nick brb on
    msg $chan » $nick will be right back. Reason: $iif($2,$2-,none.) «
  }

This is the crucial part that needs correcting to get rid of the redundancy.

 Respond  
Jethro   -  Jun 21, 2011

lol napa, I didn't expect them to, but it's served as a demonstration for those who can have a grasp at it. I love to get feedback from people from all walks of life.

 Respond  
napa182   -  Jun 21, 2011

lol Jethro_ like they are going to understand that.... maybe keep it simple for them to understand what you did.

 Respond  
Jethro   -  Jun 21, 2011

Well, that is a waste of INI for a simple task like this. This script should have used a local variable, and that's more than enough. Here is my version:

on !*:quit:{
  var %c = 1
  while ($comchan($nick,%c)) {
    if (,$+(%,$wildsite,..,$network,..,$v1)) {
      unset $v1
      inc %c
    }
  }
}
on !*:part:#: if (,$+(%,$wildsite,..,$network,..,#)) unset $v1
on $*:text:/^b(rb|ack)( |$)/iS:#:{
  var %b = tokenize 32 $!($+(%,$wildsite,..,$network,..,#),2)
  if ([ [ %b ] ]) { | if ($regml(1) == rb) {
      set $+(%,$wildsite,..,$network,..,#) $nick $iif($2,$2-,None.)
      [ [ %b ] ] | .msg # » $1 will be right $&
        back. Reason: $2- « | return
    }
    [ [ %b ] ] | .msg # » $1 is back from: $2- $+ . « 
    unset $+(%,$wildsite,..,$network,..,#)
  }
}
 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.