Types, Inheritance, Dynamics, Lists, Object References, Null
Overcat
03 Dec 2009, 02:44A few questions:
1. How do/will user-defined types and inheritance work?
2. Can object elements switch type dynamically?
3. Can I programmatically overwrite script elements? For instance, if this is declared:
...can the take script be changed using something like this?:
3. What kind of functionality will come with the list type? (Or, what kind of operations will exist for lists?)
4. Can an element be assigned an object reference?
5. Is there are built-in null type? (Can I set values to nil somehow?)
1. How do/will user-defined types and inheritance work?
2. Can object elements switch type dynamically?
3. Can I programmatically overwrite script elements? For instance, if this is declared:
<object "someObject">
<take type="script">
msg ("Test: " + myfunction("one", "two"))
</take>
</object>
...can the take script be changed using something like this?:
<someElement type = "script">
object.take = anotherObject.take
</someElement>
3. What kind of functionality will come with the list type? (Or, what kind of operations will exist for lists?)
4. Can an element be assigned an object reference?
<object "someObject">
<myTarget = someOtherObject>
<someMethod type = "script">
this.myTarget.doSomething
</someMethod>
</object>
<object "someOtherObject">
<doSomething type = "script">
...
</doSomething>
</object>
5. Is there are built-in null type? (Can I set values to nil somehow?)
Alex
03 Dec 2009, 13:051. You can define types and then you can specify that objects include a particular type, just as you can in Quest 4. It's a bit more efficient in Quest 5 though as the types aren't physically copied over to the object - looking at an attribute on an object will "look through" to its inherited types.
2. I've not implemented this yet, though it will be necessary for objects created at run-time.
3a. Yes, an expression can return a script, so you can do:
and you can set the script directly:
3b. At the moment you can create lists of strings, objects or exits. You'll be able to add or remove items, concatenate lists, and check if a list contains a particular item - all the standard stuff really.
4. Yes an attribute can be a reference to another object. For example myobject.parent refers to the parent object, so you can write:
5. Yes you can use null.
2. I've not implemented this yet, though it will be necessary for objects created at run-time.
3a. Yes, an expression can return a script, so you can do:
myobject.take = anotherobject.take
and you can set the script directly:
myobject.take => msg ("New take script")
3b. At the moment you can create lists of strings, objects or exits. You'll be able to add or remove items, concatenate lists, and check if a list contains a particular item - all the standard stuff really.
4. Yes an attribute can be a reference to another object. For example myobject.parent refers to the parent object, so you can write:
msg ("The beer is in " + beer.parent.name)
5. Yes you can use null.