Page 1 of 1
Mud Commands
Posted: Fri Sep 09, 2011 5:15 pm
by hallsofvallhalla
Was thinking about how muds recognize commands and the best approach of creating a command system from scratch and via web.
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
}
smack or speak, or look or whatever could be the same way as long as it follows the correct order of the command
Re: Mud Commands
Posted: Sat Sep 10, 2011 12:43 am
by Jackolantern
I have thought about MUD commands in PBBGs as well, and I was kind of going a different direction. I was thinking that you could parse the text command on the client-side, and then use the result to call different, command-oriented PHP scripts through AJAX. I was thinking that may keep things nicely organized and componentized into specific command areas.
Re: Mud Commands
Posted: Sat Sep 10, 2011 12:55 am
by hallsofvallhalla
well thats what i meant by not using PHP but JS instead. Just used the code above as an example/
Re: Mud Commands
Posted: Sat Sep 10, 2011 1:40 am
by Jackolantern
Ohhh, I missed that part, even though I read the whole thing lol. I am tired today.

Re: Mud Commands
Posted: Thu Sep 15, 2011 11:38 pm
by hallsofvallhalla
I am a little worried about my commands in my game. Do you think they will bore players? Should I move them back to buttons or links?
Will players want to type *lumber then the item each time? or should I add in something else like a level of how hard you want to work the tool? or go back to a drop down list with a limber button?
Re: Mud Commands
Posted: Fri Sep 16, 2011 12:06 am
by Jackolantern
If you already have the commands worked out, why not offer both? I think players will end up liking the text commands because they will actually be simpler. While it seems like they would be harder or more time-consuming, some of the things text commands can do cannot easily be done with one button click. For example, trading between players really can't be done with one button. You have to first choose that you want to trade with someone (which may be 2 clicks in itself: first selecting the player, then that you want to trade), then what you want to trade, then confirm. This could be done with 1 text command!
You could possibly even work in a system to teach players the text commands while they use the graphical button system. I know I would use text commands, as I am quite used to them from playing MUDs, and seriously...what RPG gamer can't type fast these days?
Re: Mud Commands
Posted: Fri Sep 16, 2011 3:54 am
by hallsofvallhalla
hehe good points and today while driving I was thinking about it and I really want to stick with text. I want to make it where you can use any item for anything. Of course the results may not be the best. Like using a fish to lumber will most likely result in fail and loss of a fish
"you must cut the largest tree in the forest with a......herring! "
Re: Mud Commands
Posted: Fri Sep 16, 2011 6:06 am
by Jackolantern
Yeah, and at the very least, it wouldn't be hard to make the final option of parsing be a "What are you trying to do?" type option that signifies that nothing happened and to try again. That is the way most retro PC adventure games worked.
Re: Mud Commands
Posted: Fri Sep 16, 2011 7:57 am
by hallsofvallhalla
yeah great idea