!calc does the trick, works for users and yourself.
;*;*;*;*;*;*;*;*;*;
;*User Calculator*;
;*;*;*;*;*;*;*;*;*;
on *:TEXT:*:#:{
if ($strip($1) == !calc) {
if (!$2) { msg # 4,1Please specify an equation. }
else { msg # 4,1Math Problem by $nick :9 $2- 4. The Answer Is:9 $calc($2-) }
}
}
;*;*;*;*;*;*;*;*;
;Bot Calculator*;
;*;*;*;*;*;*;*;*;
alias Calc {
if (!$1) { echo -a ====>No equation specified. }
else echo -a ====>The answer to the equation $remove(!calc $1-,!calc) =4 $calc($strip($1-))
}
hi
sorry i don't speak verry well english
if writed !calc hi
====>The answer to the equation hi = 0 !!!
use alias better than on input event
must use $strip cose maby one user use a color text, bold or underline the command will not execute
so better to do
if ($strip($1) == !calc) <cmd>
but u have to add conditions to ensure that the $2 is calculated or not
so i thing that useless
I'd also like to note that you have incorrectly used on INPUT.
on INPUT is trigger by several things.
-Sending a message to a channel
-(depending on event syntax) message in query
-Command
-Control-Enter'ing something
To avoid the last two, you need to check for them.
e.g.
on *:INPUT:#: {
if ($left($1,1) != / && !$ctrlenter) {
commands_here
}
}
Cool. One thing that I'm a bit concerned with is the on input event.
If you're going to echo the result anyways, wouldn't it be easier to make an alias for it, like /calc, instead of !calc in anywhere? It's just a suggestion.
Also, (though not very important in this script), you can combine these two parts:
if (!$2) { msg # 4,1Please specify an equation. }
else { msg # 4,1Math Problem by $nick :9 $2- 4. The Answer Is:9 $calc($2-) }
by using an $iif.
This can be rewritten as:
msg # $+(4,1,$iif(!$2,Please specify an equation.,Math Problem by $nick :9 $2- 4. The Answer Is:9 $calc($2-) ))
Like I said, it's not necessary in this case, but it could save a lot of space in future scripts. Same thing goes for the on input event.