PDA

View Full Version : spawnedit, itemedit


madborg
01-22-2002, 11:04 PM
this is mostly a placeholder/reminder for me:

Here is a fairly simple scheme that allows mobs and items to be edited:

basic
spawnedit mob-id property <value> or [values]
itemedit item-id ...

Actually, I would write the set in a slightly different format:

spawn.create [list of properties and values] returns mob-id
spawn.dest mob-id
spawn.prop? mob-id
mob.id? <target>
spawn.edit ...

Or spawn-edit, or spawn_edit

a more complex form would be a list of properties and values, including nested list:

[[moveto x y z] [texture 1239] [heading 45] [speed dx dy dz]]

this form allows you to do this:

spawn.edit id [
[moveto x y z]
[texture ...]
and so on
]
->update the spawn (as one action)

where if you did
spawn.edit moveto x y z
spawn.edit texture ...

causes N spawn update actions

fancier
This same format allows you to both define objects and manipulate objects. You can probably create packages this way too -- a sort of inheritance.

[[a 1] [c 3]] + [[c 4]]=>
[a 1] [b 2] [c 4]

or a shortcut

define A=[[a 1] [b 2] [c 3]]
then [<op>[A][c 3]]

where <op> is some kind of operator

[b]even fancier
finally, in a extended model, you would need r/w, w, ro for each property, addprop to add a property, delprop to delete a property, and some kind of object lock where properties cannot be added or deleted.

persistence
objects created this way must also be persistent.

format

the [] is just another form of lisp structures. Don't really need it for simple commands, but it is useful for more complex structures.
Then you can use list functions like first and rest. It also fairly easy to tear apart structures and glue them back together.

Or lisp-like:

(instance mob-id (addprop heading x)(addprop texture 1234))

and this whole thing would be fed to the spawn-edit function

(spawn-edit (instance mob-id(...)))

but would really be written as something like this:

spawn.edit id [heading x][texture 1234] or
spawn.edit id [
[heading x][texture 1234]
]


and finally...

loadfile <filename>

binary enhancements
{for compact files I guess}

not sure about this. The addprop format would allow the encoding to be like this:

(addprop a 1)(addprop b 2.0) (addprop c "xc")

which would get translated to:

addint ptr-a literal 1 addfloat ptr-b literal 2.0 addstring ...


Comments?