Toxen, you could do something like this (although there are a few ways):
NPC Code:
if (obj.text.pos("*") > 0) {
temp.token = obj.text.tokenize("*");
player.chat = temp.token[0] @ "x" @ temp.token[1] @ "=" @ temp.token[0] * temp.token[1];
}
and certainly better ways if you're planning on making a calculator or so.