Runescape teleblock snippet

By Bielie on Dec 16, 2010

A script to count down the Teleblock u did or received.

User: -> !teleblock <full/half> <target(optional)>
Bot: -> You got teleblocked for 5 minutes.
Bot: -> Your TeleBlock has expired after being teleblocked for 5 minutes.

Im still working on it wait for me to finish before posting comments.
(I know i should finish before even posting :) )

on $*:TEXT:/^[!.@](teleblock|tb)/Si:#:{
 if (%flood [ $+ [ $nick ] ]) { halt }
 set -u3 %flood [ $+ [ $nick ] ] $true

 var %target = $3

#stop off
 if (%tb [ $+ [ $nick ] ]) { 
  if (%fulltb [ $+ [ $nick ] ]){ notice $nick You already got or tbed someone. Please wait untill the other tb has worked out. Still $duration($var($+(%,fulltb,$nick),1).secs) left. | halt }
  if (%halftb [ $+ [ $nick ] ]){ notice $nick You already got or tbed someone. Please wait untill the other tb has worked out. Still $duration($var($+(%,halftb,$nick),1).secs) left. | halt }
 notice $nick We noticed that you already tbed someone but the system didnt write it down correctly. Please wait atleast 5 minutes before using the command again! | halt }
#stop end

 if (!$2) { notice $nick Please provide the duration of the teleblock! Syntax: !teleblock <full/half> <target>. | halt }

 if (!$3) { 
  if ($2 == Full) {
   set -eu300 %fulltb [ $+ [ $nick ] ] $true | set -eu300 %tb [ $+ [ $nick ] ] $true
   notice $nick You got teleblocked for 5 minutes.
   .timer 1 300 Your teleblock has expired after being teleblocked for 5 minutes. | halt }

  if ($2 == Half) {
   set -eu150 %halftb [ $+ [ $nick ] ] $true | set -eu300 %tb [ $+ [ $nick ] ] $true
   notice $nick You got teleblocked for 2,5 minutes.
   .timer 1 150 Your teleblock has expired after being teleblocked for 2,5 minutes. | halt }

   else {
    notice $nick You didnt use the correct syntax! Choose <Full/Half> You entered $2 $+ . | halt }
  }
 elseif {
  if ($2 == Half) && ($3 != $null) { 
   set -eu150 %halftb [ $+ [ $nick ] ] $true | set %tb [ $+ [ $nick ] ] $true
   notice $nick You just halftbed %target for 2,5 minutes.
   .timer 1 150 notice $nick The teleblock of %target is now expired.
   halt
  }
  if ($2 == Full) && ($3 != $null) { 
   set -eu300 %fulltb [ $+ [ $nick ] ] $true | set %tb [ $+ [ $nick ] ] $true
   notice $nick You just halftbed %target for 5 minutes.
   .timer 1 300 notice $nick The teleblock of %target is now expired.
   halt
  }
  else {
    notice $nick You didnt use the correct syntax! Choose <Full/Half> <target> You entered $2 $+ . | halt }
 }
 else { notice $nick You did something wrong! Please ask the operator of this channel or of this bot. | halt }
}   

Comments

Sign in to comment.
Known   -  Dec 19, 2010

Oh, I'm so uset to just having the timer already identified so that it wouldn't go to the next sequential number.

 Respond  
Brownjam0   -  Dec 19, 2010

silly known

 Respond  
Burrito   -  Dec 16, 2010

Known, they shouldn't be overwritten due to mIRC naming the timer the next available sequential number.

 Respond  
Known   -  Dec 16, 2010

You may want to make sure that you name your timers something else, since in your code

   .timer 1 300 Your teleblock has expired after being teleblocked for 5 minutes. 
   .timer 1 150 Your teleblock has expired after being teleblocked for 2,5 minutes.
   .timer 1 150 notice $nick The teleblock of %target is now expired.
   .timer 1 300 notice $nick The teleblock of %target is now expired.

Can all be over-written if anyone, even if the same person types the command(s) over and over again.

 Respond  
Jethro   -  Dec 16, 2010

Your regex needs a bit of improvement:

/^[!.@]t(b|eleblock)/Si

So you don't have to repeat the letter "t" unnecessarily. You have to note that the way you use regex for the trigger match will only have the $1 stripped, hence the /S modifier being used. The $2- won't recognize control codes while you don't have your mirc settings select for striping incoming messages. You may need to add

tokenize 32 $strip($2-)

to have them all stripped.

As for the overall body of code, you could have avoided repetition. But I won't get into that to be overly analytical.

 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.