2012 countdown

By alabama on Sep 28, 2011

[Time left until the end of the World as we know it [2012]] | 64wks 2days 18hrs 52mins|

I made this awhile ago O_O

Alias c1 { return $+($chr(3),14,$1-,$chr(15)) }
Alias c2 { return $+($chr(3),12,$1-,$chr(15)) }
Alias logo { return $+($c1($chr(91)),$chr(2),$c2($1),$chr(2),$c1($chr(93)),$c1(:)) }

ON $*:TEXT:/^[@!.]2012/Si:#:{
  $iif($left($1,1) == @,msg $chan,notice $nick) $logo(2012:) $c1([Time left until the end of the World as we know it [2012]]) $c1($chr(124) $c2($duration($calc($ctime(21 DEC 2012 18:00 PM) - $ctime))) $c1($chr(124)))
}

Comments

Sign in to comment.
alabama   -  Sep 29, 2011

lol

 Respond  
FelicianoX   -  Sep 29, 2011

This will fail @ 21 DEC 2012 18:00:01 PM
Fix this NOW.

Just kidding :)

 Respond  
Jethro   -  Sep 29, 2011

jaytea, 2024 was merely an example. I remain neutral toward you two's viewpoints of how regex should be used and handled. Neither I agree nor disagree. Many programmers out there may have a different input from yours. At the end of the day, it all comes down to this: it's a matter of preference. You may see it as a bad habit; some may see it as a way to go. I won't say there is a right or wrong in this matter.

 Respond  
Jonesy44   -  Sep 29, 2011

I find mSL can teach you some bad habits.. It (regex) works, and I suppose you're right, when it comes down to it - it's the programmer's preference.

 Respond  
jaytea   -  Sep 29, 2011

i don't see where 2024 came from, but imo the question of whether or not it would be suitable to perform the range check in the regular expression depends upon the extent to which that value is tied to the script. we wouldn't want to hardcode regex if 2024 is arbitrary and susceptible to change. after all, magic numbers pale in comparison to the idea of magic subexpressions ;P

if 2024 is fundamental to the script's design, and the script wouldn't make sense with any other value, then you can safely include it in your regular expression if you prefer. otherwise, ensure you're dealing with a series of digits (\d+), since isnum does not precisely validate the composition of the number, and check the range with mSL. i would say that regular expressions should be used to validate the structure of the string, and your programming language to validate its meaning.

 Respond  
Jethro   -  Sep 29, 2011

All in a day's work.

 Respond  
alabama   -  Sep 29, 2011

woah i go away for a day and all this o-o

 Respond  
Jethro   -  Sep 28, 2011

joensy44, I'm not being a little bitch. lol (perhaps I appear that way to you) I just don't agree with one programming language should be limited to a particular function. Regex is a powerful language and it should apply to many situations where you see fit. Innovation is the key.

 Respond  
Jonesy44   -  Sep 28, 2011

"Regular expressions are used to find sub-strings that match a specified pattern. In NeoLoad, they enable the definition of character strings for extraction (see Variable Extractor) or rules for validating text (see Assertion). ..."

"In computing, regular expressions, also referred to as regex or regexp, provide a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. ..."

"A formal syntactic specification widely implemented in the Unix language family for reference to strings..."

I agree it can be used for fp numbers (as you pointed out). But what you are describing is a range. I'd appreciate if you didn't keep having a hissy fit like a little bitch and actually talk for once.

 Respond  
Jethro   -  Sep 28, 2011

Says who? Not according to you, yes? If what you said is true, then this website, especially on this page, is full of BS: http://www.regular-expressions.info/floatingpoint.html> we will try to build a regular expression that can match any floating point number. Our regex should also match integers, and floating point numbers where the integer part is not given

 Respond  
Jonesy44   -  Sep 28, 2011

Because reg-ex is for pattern matching in strings, rather than integers.

 Respond  
Jethro   -  Sep 28, 2011

jonesy44?

Why would you want to make another if statement when regex is there for you and can be implemented in the text event's match text section?

 Respond  
Jonesy44   -  Sep 28, 2011

@Jethro

isnum 2012-2024

?

 Respond  
Jethro   -  Sep 28, 2011

lol. Yeah you can continue the countdown in your afterlife.

 Respond  
napa182   -  Sep 28, 2011

lol @ the end of the world ffs

 Respond  
Jethro   -  Sep 28, 2011

Or make the countdown from 2012 till 2024:

/^[@!.]20(1[1-9]|2[0-4])$/Si

I've just noticed you use $left(). You can parenthesize

([@!.])

and then use

$iif($regml(1) == @,msg...,notice...)
 Respond  
Jethro   -  Sep 28, 2011

alabama, you should make your text event more sensitive to "2012." I can enter 20121223433 and get it triggered. ( this is to assume someone wants to mess around with it as a joke ) Be sure to put a dollar sign at the end to ensure that it ends at 2012 like so> /^[@!.]2012$/Si- Edit - scratch my suggestion of an example. I didn't think something through earlier. The dollar sign suggestion still sticks.

 Respond  
extreem12   -  Sep 28, 2011

i have another contdown for you for topic and with timers
automatich sorry for my bad english
here the script


alias dur {
var %i = $duration($1)
return $replace(%i,wks,weeks,wk,week,hr,hour,hrs,hours,$iif(mins isin %i || min isin %i,$ifmatch),$iif(mins isin %i,minutes,$iif(min isin %i,minute)),$iif(secs isin %i || sec isin %i,$ifmatch),$iif(secs isin %i,seconds,$iif(sec isin %i,second)))
}
alias xmas {
var %j = $calc($ctime(December 25 $asctime(yyyy) 00:00:00) - $ctime)
if (%j < 0) { var %j = $calc($ctime(December 25 $calc($asctime(yyyy) +1) 00:00:00) - $ctime) }
;Change this line if you wish.
msg $chan There is $dur(%j) until Christmas!
}
alias new-year {
var %j = $calc($ctime(January 1 $asctime(yyyy) 00:00:00) - $ctime)
if (%j < 0) { var %j = $calc($ctime(January 1 $calc($asctime(yyyy) +1) 00:00:00) - $ctime) }
;Change this line if you wish.
.msg $chan 0,12nog4 $dur(%j) tot 0,4Nieuwjaar!!!!
if (%j <= 43200) {
;Change this line if you wish.
.timer_newyear 1 %j scon -rat1 amsg 1Happy New Years! 2Happy New Years! 3Happy New Years! 4Happy New Years! 5Happy New Years! 6Happy New Years! 7Happy New Years! 8Happy New Years! 9Happy New Years!
}
}
alias vday {
var %j = $calc($ctime(February 14 $asctime(yyyy) 00:00:00) - $ctime)
if (%j < 0) { var %j = $calc($ctime(February 14 $calc($asctime(yyyy) +1) 00:00:00) - $ctime) }
;Change this line if you wish.
msg $chan There is $dur(%j) until Valentine Day!
}

on *:text:!nieuw-jaar:#: {
/new-year
set %chan $chan
}

on 50:text:!startn:#: {
msg $chan aftellen is begonnen
.timer_nj 0 10 /new-year $chan
}

on 50:text:!topic:#: {
/topic
timer 0 60 /topic
}

alias topic {
var %j = $calc($ctime(January 1 $asctime(yyyy) 00:00:00) - $ctime)
if (%j < 0) { var %j = $calc($ctime(January 1 $calc($asctime(yyyy) +1) 00:00:00) - $ctime) }
topic $chan 0,12het is nog4 $dur(%j) tot 0,4Nieuwjaar!!!!
if (%j <= 43200) {
;Change this line if you wish.
.timer_newyear 1 %j scon -rat1 topic $chan 1Happy New Years! 2Happy New Years! 3Happy New Years! 4Happy New Years! 5Happy New Years! 6Happy New Years! 7Happy New Years! 8Happy New Years! 9Happy New Years!
}
}

on 50:text:!stopn:#: {
/nieuwjaar off
}

 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.