Inheriting behaviour as well as attributes with types
The Pixie
01 Aug 2011, 22:28This may not be feasible, but it would be nice if an object's behaviour could be inherited from a type.
What I would envisage is having a food type, and all items that inherit can be eaten because that functionality was set up for the type. You could have a person type, with a load of default responses for ask/tell, and all the actual people in the name override selected responses as appropriate.
What I would envisage is having a food type, and all items that inherit can be eaten because that functionality was set up for the type. You could have a person type, with a load of default responses for ask/tell, and all the actual people in the name override selected responses as appropriate.

Pertex
02 Aug 2011, 08:20Alex
02 Aug 2011, 08:42Yes, types can handle all of this. You may want to set up your default ask/tell stuff for one object in the editor, then go into the attributes (or the code view) and copy them across to your new type.
The Pixie
02 Aug 2011, 09:39Oh, okay. I looked at creating a type, and it only seemed to be set up for attributes (and I read the web page Pertex linked to, and that seemed to be about attributes only as well).
Alex
02 Aug 2011, 10:13The thing to remember, which I probably haven't made clear in the documentation yet, is that everything is an attribute. You could even edit your entire game via the Attributes tab if you wanted.
The Pixie
02 Aug 2011, 20:06I am having problems getting this to work. I am creating a detective story, so the player will be asking X about Y a lot. What I want is some default responses, and types appears to be the way to go.
So I have a character bert:
<object name="bert">
<inherit name="male" />
<inherit name="editor_object" />
<inherit name="person_type" />
<alias>Bert</alias>
... etc
And the person_type is set up like this:
<type name="person_type">
<ask type="scriptdictionary">
<item key="maisy">
msg ("\"You know about Maisy DeValle,\" Vic asked casually.")
msg ("Only what I heard on the news.\"")
</item>
</ask>
</type>
In the editor, person_type is listed as being inherited from, and I can ask Bert about other things in player mode, but not about Maisy. Am I doing something wrong, or is something not working?
So I have a character bert:
<object name="bert">
<inherit name="male" />
<inherit name="editor_object" />
<inherit name="person_type" />
<alias>Bert</alias>
... etc
And the person_type is set up like this:
<type name="person_type">
<ask type="scriptdictionary">
<item key="maisy">
msg ("\"You know about Maisy DeValle,\" Vic asked casually.")
msg ("Only what I heard on the news.\"")
</item>
</ask>
</type>
In the editor, person_type is listed as being inherited from, and I can ask Bert about other things in player mode, but not about Maisy. Am I doing something wrong, or is something not working?
Alex
02 Aug 2011, 20:48If you're defining an "ask" attribute for Bert, that will override what you've specified in your type.
In the Editor, if you don't have an "ask" attribute for Bert, you will see the inherited value. As soon as you edit, that value from the type will be copied across. So any subsequent edits you make to the type won't be reflected in Bert's version of the "ask" attribute.
This means you should set up your type first, then edit any objects that inherit from the type.
In the Editor, if you don't have an "ask" attribute for Bert, you will see the inherited value. As soon as you edit, that value from the type will be copied across. So any subsequent edits you make to the type won't be reflected in Bert's version of the "ask" attribute.
This means you should set up your type first, then edit any objects that inherit from the type.