napa182 commented on a mIRC Script, Simple Countdown Script  -  Jul 06, 2011

um TochA1551 you are missing a closing bracket.
Here is 4 different versions of it.

these are working examples only:

This one the trigger is !countdown <number 1-10>
you can do a countdown from any numbers from 1-10
Ex:

<~napa182> !countdown 4
<&Masonic> Countdown started!
<&Masonic> 4
<&Masonic> 3
<&Masonic> 2
<&Masonic> 1
<&Masonic> Go!

on $*:text:/^!countdown\s(\d+)$/iS:#: {
  if (!%count && $regml(1) isnum 1-10) { inc -u10 %count
    msg # 1,9Countdown started!
    var %a = $v1, %b = 1
    while (%a >= 0) {
      $+(.,timerc,%b) 1 %b msg # $iif(%a = 0,Go!,%a)
      dec %a
      inc %b
    }
  }
}

Second one is almost like the one the author posted without the error messages. It counts down from 5.
Trigger is !countdown
Ex:

<~napa182> !countdown
<&Masonic> Countdown started!
<&Masonic> 5
<&Masonic> 4
<&Masonic> 3
<&Masonic> 2
<&Masonic> 1
<&Masonic> Go!

on $*:text:/^!countdown$/iS:#: {
  if (!%count) { inc -u10 %count
    msg # 1,9Countdown started!
    var %a = 5, %b = 1
    while (%a >= 0) {
      $+(.,timerc,%b) 1 %b msg # $iif(%a = 0,Go!,%a)
      dec %a
      inc %b
    }
  }
}

This one is like the one the author posted with the error messages
Trigger is !countdown 5
Ex:

<~napa182> !countdown 4
<&Masonic> Sorry napa182, but max countdown number for me is 5!

<~napa182> !countdown
<&Masonic> Sorry napa182, but you need to type !countdown 5

<~napa182> !countdown 99
<&Masonic> Sorry napa182, but max countdown number for me is 5!

<~napa182> !countdown 5
<&Masonic> Countdown started!
<&Masonic> 5
<&Masonic> 4
<&Masonic> 3
<&Masonic> 2
<&Masonic> 1
<&Masonic> Go!

on $*:text:/^!countdown?\s?(\d+)?$/iS:#: {
  if (!%count) { inc -u10 %count
    if ($regml(1) != 5 || !$regml(1)) { 
      msg # 1,12Sorry 13,12 $nick $+ , 8,12but $iif(!$regml(1),$&
        you need to type !countdown 5,max countdown number for me is 5!)
    }
    else {
      msg # 1,9Countdown started!
      var %a = 5, %b = 1
      while (%a >= 0) {
        $+(.,timerc,%b) 1 %b msg # $iif(%a = 0,Go!,%a)
        dec %a
        inc %b
      }
    }
  }
}

The last one is a version that has 2 different triggers:
Also you can do a countdown from any numbers from 1-10

!countdown <number 1-10> will message the channel
@countdown <number 1-10> will notice the nick

Ex:

<~napa182> @countdown 3
-Masonic- Countdown started!
-Masonic- 3
-Masonic- 2
-Masonic- 1
-Masonic- Go!

<~napa182> !countdown 4
<&Masonic> Countdown started!
<&Masonic> 4
<&Masonic> 3
<&Masonic> 2
<&Masonic> 1
<&Masonic> Go!

on $*:text:/^([!@])countdown\s(\d+)$/iS:#: {
  if (!%count && $regml(2) isnum 1-10) { inc -u10 %count
    var %a = $v1, %b = 1, %c = $iif($regml(1) = !,.msg #,.notice $nick)
    %c 1,9Countdown started!
    while (%a >= 0) {
      $+(.,timerc,%b) 1 %b %c $iif(%a = 0,Go!,%a)
      dec %a
      inc %b
    }
  }
}

Yes I was bored...

Keep at it....

 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.