Game Development Community

Reading member and tagged fields from SimDictionary

by Brett Fattori · in Torque Game Engine · 06/29/2004 (5:16 am) · 1 replies

Last night I was trying to figure out if there was a way to get all of the fields, and their value(s), contained in a SimObject. There's the obj.dump() method, but that just dumps the information to the console. It would appear that there's an un-exposed method called obj->writeFields() which obj.save() uses. It writes the fields and their values to a stream.

My question is, what would I need to do to be able to write it to a memory stream, and then write that back in a ConsoleFunction or ConsoleMethod? It seems like this would be a useful function for people to have access to. It would make object cloning possible, since currently there isn't a way to clone an object (that I know of). You can copy an object, but then it appears to be just a reference to the object.. is that right?

Any insight would be most appreciated!

- Brett

#1
06/29/2004 (5:31 am)
Mm, the easiest thing I can think of is to adjust the code in dump. Look for ConsoleMethod(SimObject,dump, void, 2, 2, "obj.dump()") in simBase.cc, looks like it should be easy to change what you do with the stuff.

Ian