quote:
Originally posted by saralk
What about a command like "/math 2 + 3" which would send "2 + 3 = 5"
Dead easy actually, all you need to do is to grab the command line parameter and let JScript evaluate it:
return CommandParameter + " => " + eval(CommandParameter)
Attached is a full blown script which does exactly that.
Usage:
/calc <math expression>
Examples:
/calc (5+5)*8/20+3 output: (5+5)*8/20+3 => 7
/calc (5+5)==11 output: (5+5)==11 => false
/calc 5
<new line> + 5 output: 5 + 5 => 10
/calc 5///////5 output: standard Plus! "invalid parameter" message box
/calc output: standard Plus! "no parameter" message box
it also gives an example in:
- how to split the command and parameter from eachother in a very easy way using 1 regular expression in 1 IF...THEN...ELSE function.
- how to show a standard Plus! error message, using Plus!'s own translations
see source for more info