I would like to suggest some features for mirc; since they are a bit related, I will keep they in the same topic. They aren't really necessary, but will be useful in some circumstances.
1. case-insensitive regex
i would like a .nocase or .ci (case insensitive) property or anything like this in $regex and $regsub, for insensitive casing of regex. i use an alias like this:
alias regex-nocase {
return $regex($lower($1),$lower($2))
}
but i think that is too simple create the .nocase
2. isregex and isregexci operators in an if statement (and while and etc)
like iswm, an isregex would be a great feature to make the scripting more productive.
instead of do an if ($regex($1,^text.$)), is better do an if (^text.$ isregex $1), because it's far more simple and readable
the isregexci would be an case insentive version; and would be an !isregex and !isregexci as well
3. personalized if operators
suppose that i have a bot that verify if a number is prime or not and i use this alias:
alias isprime {
if ($1 !isnum 2-) || ($1 != $int($1)) return
var %x = 1
while (%x < $int($sqrt($1))) {
inc %x
if (%x // $1) return
}
return $true
}
it would be far more readable use this event:
on *:text:*:#:{
if ($1 == !verify) {
if ($2 == null) {
msg # Sintax: !verify [number]
}
elseif ($2 isprime) {
msg # $2 is a prime.
}
else {
msg # $2 is not a prime.
}
}
}
instead of use this:
on *:text:*:#:{
if ($1 == !verify) {
if ($2 == null) {
msg # Sintax: !verify [number]
}
elseif ($isprime($2)) {
msg # $2 is a prime.
}
else {
msg # $2 is not a prime.
}
}
}