My first thought was the simple commands like *give, *speak, *search, ect
I guess you would have to have a include file called commands and you could explode the data past the first space.
Like
"*give jack short sword"
i am doing this in PHP as example but would use JS for real time commands
This is of course a dumbed down version, you would want to do checks if the person existed and you had the item
Code: Select all
$checktext = substr($text, 0, 1);
if($checktext == '*')
{
$iscommand = explode("*", $text);
$command = explode(" ", $iscommand[1]);
call_user_func($command[0]);
}
function give()
{
$SQL = "INSERT into inventory(itemname,player) VALUES ('$command[2]','$command[1]')";
mysql_query($SQL) or die("Could not add item");
echo "You give" . $command[1] . " the " . $command[2];
delete the item
}