Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create object classes (as in types, not code) #22

Closed
crankycyclops opened this issue Apr 5, 2013 · 1 comment
Closed

Create object classes (as in types, not code) #22

crankycyclops opened this issue Apr 5, 2013 · 1 comment
Assignees
Labels
Milestone

Comments

@crankycyclops
Copy link
Owner

Some examples are "text (book, scroll, etc.)", "key," etc. Each class will probably have certain properties set by default (for example text, by default, will have a readable block of text for the player to see when they issue a "read" command.) Objects should then, in addition to names and synonyms, be identifiable by class.

The hierarchy for recognizing objects by class name should be as follows:

First, recognize objects with name/synonym. If these are found, ignore class. If no objects are found by name/synonym, then see if there's an object of the specified class, and if so, you can interact with it. This will be an enhancement to the static function getObject(), most likely.

Pre-defined object classes might have special tags that can go in the section of game.xml. For example, if it's a text, instead of:

[object name="book"]
...
[/object]

It would be something like:

[text name="book"]
...
[/text]

The text block would automatically imply certain attributes that would otherwise have to be explicitly stated in a generic block.

In the future, I may want to create a mechanism to allow the game developer to specify extra custom classes (probably want to put in another ticket for that! :)

@ghost ghost assigned crankycyclops Apr 5, 2013
@crankycyclops
Copy link
Owner Author

Update: the idea of selecting on the command line an item based on its class is a good idea. Other than that, scratch most of what I said above. Basically, there will be a section at the front of game.xml called [classes], and in here we will define types of objects, rooms, etc. with specific attributes (all except name, which needs to be unique.) Then, instantiating those inside [rooms], [objects], etc. will be a shortcut to include those attributes, along with others that are specified.

What classes might look like in game.xml:

[classes]
[objects]
[sword]
[weapon]1[/weapon]
[damage]10[/damage]
[/sword]
[/objects]
[/classes]

[objects[
[sword name="mysword"]
[description]blah blah[/description]
[/sword]
[/objects]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant