General MudObject thoughts/questions...

Having a little trouble with my logic. I have commands, that are bsh scripts, that are available to all players based on security/access level.

I have a MudObject with a few required variables like id, name, desription and type. To make good use of the MudObject…I was thinkging:

  • To keep it as general as possible, I considered using a hashmap<String, MudVariable> to hold additional variables so each object could possibly have a different set without have to extend and create numerous classed for it.

  • Then do the same with methods. Have a hashmap<String, BSHScriptName> so each object could have various methods.

  • Add a few helper methods for add/remove and get. Make a single set of object methods so if 3 different objects have the TurnInvisible method, its one script and used by all (or potentially different ones, stored logically on a drive so TurnInvisible can function differently for a player and a dragon, and so on).

  • Or…each object has a sinle script with variables and methods unique to it?(seems things would get convoluted this way, not knowing what 46 different TurnInvisibles do on 46 different objects)…

Thoughts? ( I am using beanshell )

M

As an initial test, I am looking for a few people to hit this telnet address, see if you can connect and try a few commands(look, wave, say) and then quit to leave. Let me know how it goes…thanks!

telnet:68.57.86.113:11212

Some advice, having done exactly this approach to java muds several times before :slight_smile:

  1. Make every command have the following methods in addition to any others:
  • shortdescription (one line)
  • longdescription (paragraphs)
  • infoOnArgument( int n ) (explains valid values for the nth arg, and tells you waht to put there)
  1. Make a built-in help command (or not built-in, but always present) which:
  • invoked with no args? Iterates over all commands, printing:
    command - “help command” - shortdescription
  • invoked with one arg? finds that command and prints the short desc and long desc and number of args
  • invoked with two args? finds that command and prints the infoOnArgument for the arg named by the second arg to help (either an index or a name if you’re using named-args)
  1. Append “no such command!” with “type help for a list of commands”

  2. Even better, alias “?” to typing “help”

HTH

PS: well done for getting colours into telnet in java…

Thanks! I have a commands command that right now lists the command names available. I will add the additional ideas for the command descriptions.
‘help say’ would return…
say - to say something to all in immediate area.
usage - say [text to say]

or something like that…