[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)))
}
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.
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.
"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.
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
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.
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
}