In addition, here are some tips for proper coding to make things easier.
Use
var %myvar = data instead of
set %myvar data in situations where you don't intend to keep the data after the alias has completed. This creates a local and temporary variable that is faster to access and wont conflict with variables from other scripts. Note that
= must be used for
/var and must not be used for
/set Instead of echoing each variable on its own for debugging, use the
-s switch in
/var or
/set.
You are using
/ban incorrectly. Your statement would UNban the user while kicking them. You want to use
ban -kuN instead.
Avoid using
/halt so much, instead, try scripting in a way where you always reach the end of the event. Exceptions to this may include user input error, but I would recommend getting used to
/return, as
/halt will completely end your script. (I know that doesn't apply to this particular script, but I'm refering to the unnecessary
/halts used after
/ban)
In a situation where input must be supplied, use
$$input() instead. The extra
$ makes it work like
$$1 where the event returns if no input is supplied.
menu nicklist {
.Timed Ban: {
var -s %reason = $$input(Enter Reason, e)
var -s %timeb = $$input(Enter Time, e)
if (%timeb !isnum) { echo $colour(info) -a * Timed Ban: Time must be a number! | return }
ban -ku $+ $calc(%timeb * 60) $* 2 %reason (Banned for %timeb minute(s))
}
}
Remember to remove the var
-s flags when done.
- Raccoon