Wrote this really quick and did minimal testing, edit it to your liking..
package mathBot
{
function clientCmdChatMessage(%a,%b,%c,%d,%pref,%name,%suff,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%d,%pref,%name,%suff,%msg);
if($mathbot)
{
if(getWord(%msg,0) $= "-math")
{
if(isMathQuestion(%msg))
{
%answer = returnAnswer(%msg);
if(%answer)
{
commandToServer('messageSent',"The answer to "@%msg@" is "@%answer@".");
}
}
}
}
}
};
activatePackage(mathBot);
function isMathQuestion(%msg)
{
if(strStr(%msg,"*") <= 0 || strStr(%msg,"/") <= 0 || strStr(%msg,"+") <=0 || strStr(%msg,"-") <= 0)
{
return true;
}
return false;
}
function returnAnswer(%msg)
{
%letter = "a b c d e f g h i j k l m n o p q r s t u v w x y z";
for(%i=0;%i<getWordCount(%letter);%i++)
{
%let = getWord(%letter,%i);
%msg = strReplace(%msg,%let,"");
}
eval("%answer = ("@%msg@");");
return %answer;
}