Game Development Community

How to rename SimGroup?

by Krzysztof Tyszkiewicz · in Torque Game Engine · 03/02/2007 (11:04 pm) · 1 replies

Hi
How to rename SimGroup or objects in SimGroup in World Editor Inspector? I cannot find that in the book.

#1
03/28/2007 (3:41 pm)
Hi. If the SimGroup has been stored in the MissionGroup or one of its child groups, then you should be able to click on the group from the World editor inspector (F11->F3).

However, most of the time, you don't store your simGroup objects in the MissionGroup. That is, you probably create a new simGroup using a script like this:
$x = new SimGroup();

I don't think I talked about it in this book, but you should be aware that all objects (including simGroups) when created are stored in a special group called: RootGroup. Of course, if you subsequently add() your newly created to object to a named group (like MissionGroup), the object is automatically removed from RootGroup.

So, where does that leave us? Are you confused? If so, it isn't your fault. What we are talking about here is confusing until you know how it works.

So, let me spell out some rules:


1. All SimGroup objects created from script are first stored in the special group RootGroup

2. Assigning any object to a SimGroup will remove that object from any SimGroup the object may have been previously stored in.

3. When you create a SimGroup using the Mission Editor Creator (F11 -> F4), that SimGroup will first be added to RootGroup and then immediately added to to MissionGroup (or if you have a group selected in the editor, the new SimGroup will be stored there).

4. In the case that your new SimGroup is stored in MissionGroup or one of its child groups, you can simply click on it and then rename it using the WorldEditor inspector (F11->F3).

5. If you created your SimGroup from script and did not assign its handle/ID to a variable then you have effectively lost that SimGroup. There are ways to find it still, but I don't suggest any of them (nor will I spell them out) as they are hacky.

6. The best way to create a simgroup and to track it subsequently is to do one of two things (see samples below).


// Best Way #1
// Store SimGroup handle/ID in a variable
$myGroup = new SimGroup();


// Best Way #2
// Name the SimGroup when you create it, using a unique name
new SimGroup(myNamedGroup);

Now, in either of the above cases, you have a way to get at your SimGroup and you can rename it using the setname() method.

I hope this helps! Sorry for the LONG delay in answering.

www.hallofworlds.com/how.ico Hall Of Worlds - For Gamers
EdM|GPGT