I have an idea for a text based game where I would pass commands and arguments to php for it to decide what to do with the player next.
I would type say “go north” or something more complicated like “use key door” into an AJAX form which would send the command to the php script, and I want the php script to know what action it was using eg “use” and also the first and second arguments “key” and “door” and decide what to do next, but Im not sure how to go about it.
Please note I do NOT want to run this from the command line, but from a web based interface.
Say the AJAX form would send a request to
/game.php?do=use+key+door…Then in game.php you could:
You can check out a code and output example here.
(Same goes for
$_POST['do']if you choose to implement your form in POST.)