xylafur / dnd-generator

Tool to help us in our campaign
1 stars 0 forks source link

Creating and modifying "objects" in shell #21

Open xylafur opened 6 years ago

xylafur commented 6 years ago

Add a store command that allows the user to create objects. Add a chprop command that allows user to modify or add properties to an obeject

The objects will be stored as python dictionaries. There will be a few base types, character, dungeon, event, etc... and also just a basic object.

ghost commented 6 years ago

To elaborate (I know I discussed this with you already @xylafur ), we would have a base "event_ or "object" dictionary which would create instantiations of things with a user supplied name.

The command store Bob would save the "Bob" npc as objdict["Bob"] = npcobject

Then, a chprop Bob race blah command would read objdict["Bob"] and change it's values.

Some sort of def chprop(prop): method would actually run the specified object's method (retrieved from that event's class dictionary) and change the item to the specified value. Since dictionaries are mutable, we wouldn't have to worry about automatically reupdating the reference so long as it was the same object.