Countdown Script

By Bielie on Apr 10, 2010

This is a script that counts down from a given number in seconds.

It works like this:

!time 200

Then a timer will start counting down from 200 till 0. When the timer reaches 0 you will receive a message that your timer reached zero.

I also included a antiflood script and if you dont type a number behind !time you will receive a error.

Note: If you start another timer the other one will be deleted!

If you can fix my note post below. I only look at pastebin.org links so dont post any others.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;            0             0     ;;;;
;;;    4    4    2       2      1    ;;;
;;  0                   2          1  ;;
;      COUNTDOWN SCRIPT BY BIELIE©     ;
;;  3                                 ;;
;;;     0     4       1  0      3    ;;;
;;;;      2       3       1         ;;;;   
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:TEXT:?time*:#: {
  if (!$(,$+(%,flood,$nick))) { return
    set -eu3 $+(%,flood,$nick)
  }

  if ($2 == $null) {
    notice $nick Failed to time the required request because you didn't provide the duration!
    return
  }

if ($2 <= 1) { 
notice $nick Error: I only time from 2secs or higher.
return
}

if ($2 => 7200) {
notice $nick Error: I dont accept time request from 2hours or more.
return
}

  set -eu$2 $+(%,timer,$nick) $true

if (!$(,$+(%,timer,$nick))) { 
notice $nick You already have a timer running. Type !stoptimer to halt the current timer.
return
} 

else { 

notice $nick Timer has started with $2 Seconds! Type !stoptimer to halt the current timer.
return
}

var %timeduration = $duration((%,timer,$nick).secs)

on *:text:?timeleft: {
notice $nick The timer will stop in %timeduration .
return
}

if ($duration((%,timer,$nick). == $null) {
notice $nick Timer has reached zero after counting down from $2 seconds.
halt
}

on *:text:?stoptimer:#: {
unset -eu$2 $+(%,timer,$nick) $true
}

Comments

Sign in to comment.
Kerli   -  Apr 12, 2010

rereads

Ah. That sentence almost made no sense to me until you said that. Shame on me. 3:

 Respond  
napa182   -  Apr 12, 2010

Kerli you seem to have misunderstood what the author has said. No where did they say they took this from pastebin. what they said was to use pastebin to post a fix to the snippet as they dont look at any other paste sites.

 Respond  
Kerli   -  Apr 12, 2010

Don't rules say over 25% of the snippet must be written by you? Not to mention, it seems like the poster is claiming this work as their own... >.>

notes use of "I" in description

 Respond  
napa182   -  Apr 12, 2010

yeah I never understood why they would take codes from pastebin. I have found some of the things I put on pastebin on other sites as well.

 Respond  
Jethro   -  Apr 12, 2010

I sometimes don't get why people take codes from pastebin and submit 'em here at Hawkee.

 Respond  
napa182   -  Apr 12, 2010

i guess they mean anything posted @ Pastebin

 Respond  
Kerli   -  Apr 12, 2010

I'm just curious, since all I could think of and more was already said above...

What do you mean when you say you look at Pastebin links?

 Respond  
trill   -  Apr 11, 2010

jethro i was trying to keep it as close to the authors take on it as i can by using a timer as they did.

 Respond  
Jethro   -  Apr 11, 2010

trill, a real countdown is to actually count the number, NOT use a timer...and then send out a message when the timer expires. That doesn't seem like a countdown script to me.

  • I updated my example with a check not to include the countdown for the number 0 and 1, along with a trigger flood control.
 Respond  
napa182   -  Apr 11, 2010

@Bielie next time try asking for help in the forum under mIRC Snippet Requests instead of asking in the snippet section.

 Respond  
trill   -  Apr 11, 2010

can also do it like this as well

on $*:TEXT:/^\?time?\s?/iS:#:{ 
  if (!$($+(%,timer,$nick),2)) {
    set -u3 $+(%,timer,$nick) 1
    if ($timer(countdown)) { .notice $nick 5Timer is in use try back in 3 $timer(countdown).secs 5Seconds! }
    elseif (!$2 || $2 !isnum) { .notice $nick 4Failed14 to time the required request because you didn't provide the duration! ex: ?time 5 }
    else { 
      .notice $nick 5Timer has started with3 $2 5Seconds!
    .timercountdown 1 $2 .notice $nick Timer has reached zero after counting down from $2 seconds! }
  }
}
 Respond  
Jethro   -  Apr 11, 2010

I added an enable and disable switch so that only one person can command the countdown at a time until the script has finished being processed. This prevents disorderly output at the same time.

 Respond  
Jethro   -  Apr 11, 2010

It works like this:

!time 200

Then a timer will start counting down from 200 till 0. When the timer reaches 0 you will receive a message that your timer reached zero.

on *:playend: {
  .remove count.txt
  .msg %x The countdown has reached zero!
  .enable #countdown
}
#countdown on
on *:text:$($strip(!time *)):#: {
  if (!%f) { inc -u3 %f
    if (($2 > 0) && ($2 > 1)) {
      if ($2 !isnum) {
        .msg # * Error: !time NumberHere $&
          (must be followed by a number!)
      }
      else {
        $iif(!%x,set -e %x #)
        var %c $regsubex($str(.,$2),/./g,$+($chr(32),\n)))
        tokenize 32 $sorttok(%c,32,nr) | .disable #countdown
        .msg %x $1 | write count.txt $* | .play %x count.txt 2000
      }
    }
    else { .msg # * The number must be bigger than 0 and 1! }
  }
}
#countdown end
 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.