These are just a few of the random commands and identifiers that have piled up in my script editor. None of them are important enough to warrant their own snippet, so I have grouped them here. Some of them I wrote a while ago, so the code might not be as efficient as some others, but they work. Be warned, a few of these are mildly useful, but others are downright juvenile, so if you disagree with one, please don't lecture me about it. Here's a rundown:
$randtok(string,delimeter) returns a random token in string based on delimeter.
$rtok() just calls $randtok. Shorthand.
/on, /vn, and /ovn will issue Op Notice, Voice Notice, and Op/Voice notice to the active channel or specified channel. There are different ones for each because when I wrote this, the IRCd that the server I hung around on was using needed an exact match on the modes. On many other IRCds, /vn and /ovn will produce the same results.
$factorial(number) returns the factorial of a number. Limit is on 1079 because higher values overflow. Use the .sci property to return in scientific notation.
$sigma(number) evaluates the number in standard sigma notation and returns the result. Use the .sci property to return in scientific notation.
$greatest(number1,number2,..,numberEtc) returns the largest of all given numerical parameters. I actually rewrote $greatest and $least for this release, because my silly past self had looped through every token manually.
$least(number1,number2,..,numberEtc) returns the smallest of all given numerical parameters.
$cbrt(number) returns the cube root of a number, similar to mIRC's $sqrt.
$nrt(number,n) returns the nth root of a number. For example, $nrt(x,2) is the same as $sqrt(x), but you can extend the root to what you want.
$e returns the mathematical constant e to 20 decimal places, like mIRC's $pi.
/gohl highlights every user on the active channel by saying everyone's name. :D
$bold(text) returns the text in bold. I find that inserting the actual bolding/etc characters in scripts is sloppy and doesn't work well for sharing.
$underline(text) returns the text underlined.
$reverse(text) returns the text reversed (the color reversal, not in backwards order).
/emp TEXT messages the active window with the specified text, emphasized.
$emp(text) is like /emp, but returns it.
/rainbow TEXT messages the active window with the specified text, in rainbow color. Note: due to an excessive amount of color control codes, you will not be able to send as much text to the server as normal.
$rainbow(text) is like /rainbow, but returns it.
Annoying CTCP responses:
The CTCP FINGER event responds with that delightfully mature message rather than what is normally sent.
The CTCP PING event gives your ping as a seemingly random number, so you can be "lagging" by over a year.
The CTCP TIME event puts you in Vegeta's timezone.
(Note: some people are annoyed by custom CTCP responses, and these ones are especially annoying. Use with caution).
alias randtok return $gettok($$1,$rand(1,$numtok($$1,$$2)),$$2)
alias rtok return $randtok($$1,$$2)
alias on notice $+(@,$iif($left($1,1) == $chr(35),$1,$active)) [Op Notice] $iif($left($1,1) == $chr(35),$2-,$1-))
alias vn notice $+(+,$iif($left($1,1) == $chr(35),$1,$active)) [Voice Notice] $iif($left($1,1) == $chr(35),$2-,$1-))
alias ovn notice $+(@+,$iif($left($1,1) == $chr(35),$1,$active)) [Op/Voice Notice] $iif($left($1,1) == $chr(35),$2-,$1-))
alias factorial {
var %exp = $calc($1)
if (%exp isnum 0-1079) {
var %x = 0,%t = 1
while (%x < %exp) {
%t = $calc(%t * (%exp - %x))
inc %x
}
if ($prop == sci) return $calc(%t / (10 ^ ($len(%t) - 1))) x 10^ $+ $calc($len(%t) - 1)
else return %t
}
}
alias sigma {
var %exp = $calc($1)
if (%exp >= 0) {
var %x = 1,%t = 1
while (%x <= %exp) {
%t = $calc(%t + %x)
inc %x
}
dec %t
if ($prop == sci) return $calc(%t / (10 ^ ($len(%t) - 1))) x 10^ $+ $calc($len(%t) - 1)
else return %t
}
}
alias greatest return $gettok($sorttok($1-,32,nr),1,32)
alias least return $gettok($sorttok($1-,32,n),1,32)
alias cbrt return $calc($1 ^ (1/3))
alias nrt return $calc($1 ^ (1/$2))
alias e return 2.71828182845904523536
alias gohl {
var %x = 1
while ($nick($chan,%x)) {
var %list = $addtok(%list,$v1,32)
inc %x
}
msg $active %list
}
alias bold return $+($chr(2),$1-,$chr(2))
alias underline return $+($chr(31),$1-,$chr(31))
alias reverse return $+($chr(22),$1-,$chr(22))
alias emp {
if ($isid) return $+($chr(2),$chr(31),$chr(3),04,$chr(91),$1-,$chr(93))
else msg $active $+($chr(2),$chr(31),$chr(3),04,$chr(91),$1-,$chr(93))
}
alias rainbow {
var %text,%colors = 04 07 08 09 12 13,%x = 1
while (%x <= $len($1-)) {
var %text = %text $+ $+($chr(3),$gettok(%colors,$iif($calc(%x % 6),$calc(%x % 6),6),32),$mid($1-,%x,1))
inc %x
}
%text = $+(%text,$chr(3))
if ($isid) return %text
else msg $active %text
}
ctcp ^*:FINGER:{
.ctcpreply $nick FINGER Woah, slow down, who are you? Get that -out- of me!
echo $color(CTCP) -ts $eval([,0) $+ $nick FINGER]
haltdef
}
ctcp ^*:PING:{
.ctcpreply $nick PING $calc($ctime - $rand(6969,69696969))
echo $color(CTCP) -ts $eval([,0) $+ $nick PING]
haltdef
}
ctcp ^*:TIME:{
.ctcpreply $nick TIME Over 9000 o'clock
echo $color(CTCP) -ts $eval([,0) $+ $nick TIME]
haltdef
}