Well, this was just a little timed ban alias I made. I tried using else's, that didn't work out so well. So I feel amazed I got this alias using only if's. Oh, and just to point this out, I wouldn't add if ($me isop $chan), because, well, you wouldn't be using the alias if you weren't an op, would you? :P
I had to snoop around here a bit to figure out how /ban worked, Since previously I had just done /.timers to undo it. Now here is my many times improved, timed ban alias. (It's also always good to have a few channels to test it in. :P I had failed on the $duration, always good to have a channel to test and fix it, lol.)
; Usage: /tb <nick> <minutes> <reason> (Not required)
alias tb {
if ($1) && ($1 ison $chan) && ($2 isnum) { ban $+(-ku,$calc($2 * 60)) $1 2 Banned for $+($duration($calc($2 * 60)),:) $iif($3-,$3-,No $&
reason specified.) }
if ($1 ison $chan) && ($2) && ($2 !isnum) { echo -a You have to specify a number, /tb <nick> <minutes> <reason> (Not required) }
if ($1) && ($1 ison $chan) && (!$2) { echo -a Specify a number, and if you want to, a reason, /tb <nick> <minutes> <reason> $&
(Not required) }
if ($1) && ($1 !ison $chan) { echo -a $1 isn't on $chan $+ , therefore, you can't ban them. }
if (!$1) { echo -a Forgetting a nickname? /tb <nick> <minutes> <reason> (Not required) }
}
@Jethro: Thanks for your advice, hopefully I'll take it and become better. As you can see, I don't know very much about mSL.
@Dani|11: I don't know/use/understand $regsubex,$regex,$regsub, etc, as I've never used them. Even regexp is a little confusing for me.
@Thir: Why is it showing that? What are you doing exactly? Are you on that channel? And who's are you using? Try Jethro_'s, mine might not work so well.
does that actually work... Dani boi mind explaning the use of the calculation. isn't that more... oh I don't know long winded then just doing
elseif ($1 !ison #) {
echo -a $1 isn't on $chan $+ , therefore, you can't ban them.
}
And the code still be as effective?
Edit: I input Dani's... and it doesn't even return with the fact that $1 isn't even in the chan.
alias tb {
if (!$1) {
echo -a Forgetting a nickname? /tb <nick> <minutes> <reason> (Not required)
}
elseif ($1 !ison $chan) {
echo -a $1 isn't on $chan $+ , therefore, you can't ban them.
}
elseif ($2 !isnum) {
echo -a You have to specify a number, /tb <nick> <minutes> <reason> (Not required)
}
else {
ban $+(-ku,$calc($2 * 60)) $chan $1 2 Banned for $+($duration($calc($2 * 60)),:) $iif($3,$3-,No reason specified.)
}
}
That's not how you code jethro
alias tb {
if (!$2) {
var %a = Forgetting a nickname?|$&
You have to specify a number,
echo -a $gettok(%a,$iif($remove($regsubex($1 - $2,/(.*?) - (.*?)/,\n),-) > 2,4,3),126) /tb <nick> <minutes> <reason> (Not required)
}
elseif ($regml($calc((($pi * $1 + 512 / 301 * 3 - 32) * 0) +1)) !ison $iif($chan == #,$($ $+ $chr($asc(+)) $+ chan,5),#)) {
echo -a $1 isn't on $($ $+ $+($chr(118),2),3) $+ , therefore, you can't ban them.
}
else {
ban $+(-ku,$calc($2 * 60)) $chan $1 2 Banned for $+($duration($calc($2 * 60)),:) $iif($3,$3-,No reason specified.)
}
}
thats how you code!
@SR... Jethro aready gave a script 99% like that. all you did was change $Chan to $Active. and added the if ($me is !isno active) actually you said actice. and for it to work he doesn't need to specify what channel. and hopefully they are on the channel they are using it on. your's is redundant to me.
Seems like good work. but as Jethro has said. Not worth the time to continually check the same identifier, checking if $1 is provided over and over, isn't worth the time it takes to do that.