Game Development Community

ScriptObject, SimSet / SimGroup, ArrayObject Help Please

by Yue -Rookie Torque 3D- · in Torque 3D Beginner · 08/28/2013 (8:04 am) · 7 replies

I have a serious problem, and I do not speak English, and in most cases the translator of google does not help me to translate correctly torque 3d documentation.

The only way to learn is trial and error, testing and trying to understand code.

I would like your help with a few examples of ScriptObject, SimSet / SimGroup, ArrayObject to understand the whole concept.

Greetings.

About the author

http://www.iris3d.tk -Games Studios- <<I do not speak English: I use the google translator>> My goal as a rookie is knowing Torque 3D


#1
08/28/2013 (8:45 am)
From my understanding the first three (ScriptObject, SimSet, SimGroup) are identical in terms of scripting, they just have different functioning.

A ScriptObject is simply a custom class wrapper for TorqueScript, so you can write your own "objects" in TorqueScript, hence the name Script Object.

A SimSet is kind of like a "Directory", in terms that you can add other objects to it and search it like a list.

The SimGroup is pretty much the same as a SimSet with a few added functions to help when using for loops.

I haven't touched the ArrayObject, so I'm not sure how those work.
#2
08/28/2013 (8:55 am)
ScriptObject is about the same as SimObject except it has the onAdd and onRemove callbacks for creation and deletion.

SimSet and SimGroup are the same except an object can only be in one SimSet at a time. If you add an object to a SimSet. Then add the same object to another SimSet. The object will be removed from the first SimSet.

ArrayObject is a way to return more than one value from a function. You create the ArrayObject and then add items and return the ID from the function. Some built-in functions in the engine use the ArrayObject to return lists or multiple values. There is no auto garbage collection for ArrayObjects so they have to be deleted explicitly.

#3
08/28/2013 (9:09 am)
Some small code examples please with educational purpose?
#4
08/28/2013 (12:08 pm)
Help please...
i41.tinypic.com/33oi3kh.jpg
#5
08/28/2013 (12:33 pm)
// create object
$obj = new ArrayObject();

// command and variable list
$obj.dump();

 
$obj = new SimObject();
$obj.dump();

$obj = new SimSet();
$obj.dump();

$obj = new SimGroup();
$obj.dump();


$obj.<command>  // no (); , will return help on command

www.amazon.com/dp/1849693544
www.amazon.com/The-Game-Programmers-Guide-Torque/dp/1568812841/ref=pd_sim_b_6

Get Torsion and then you can search for these objects and see how these are used in the code base. You will learn more to see how the existing scripts use these.

#6
08/28/2013 (12:56 pm)
@Demolishun Thanks You!

Finally with your help I understood that refers to a particular object type that has certain characteristics.



// create object  
$obj = new ArrayObject();

:) Thanks You!!

Edit:The book is not that helps much, this also in English ... thanks likewise.
#7
08/29/2013 (11:55 am)
Note: A SimGroup is a SimSet - but an object can only belong to one SimGroup at a time. If you add an object to SimGroup A and then add it to SimGroup B it will automatically be removed from SimGroup A. An object can belong to multiple SimSets at the same time.