Game Development Community

Array destruction in script.

by Mark Storer · in Torque Game Engine · 09/13/2005 (2:06 pm) · 0 replies

I'm considering some extensive modifications to the AIPlayer's task list.

One of the things that bugs me about it is that this list (an array) keeps growning as more tasks are added. Is there a way to 'delete' an array in TorqueScript?

Given the way arrays are implemented in torque (a[0] == a0), it seems that removing an array would be a bit tricky, so I'm not expecting to get an affermative, but I thought I'd ask anyway.

I'm also looking at a SimSet as an alternative, but 'set' brings to mind 'unordered container' in my STL-steeped brain. But SDK-owner-only page here shows me otherwise.

BUT BUT, this SDK-only-only page calls that first one a liar. [url]http://www.garagegames.com/mg/forums/result.thread.php?qt=28182[/ur]. So now I'm confused.

An orderd simSet is great for a list of potential targets, but not so good for destinations (unless I created a new SimObject marker for each waypoint... sounds less efficient than just sticking with an expanding array of strings). But then I don't anticipate having destination lists that get Really Long.


And finally, there's the Script Array resource, again for SDK owners only (getting to be like a broken record, eh?). www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4711


But all is not lost for those of you just experimenting with Torque. There's also this handy little script-only resource, Passing Arrays to and from functions that would at least let you delete an entire array at a time... better than nothing.

--Mark


So I guess I've answered my own question. Hope this helps someone out there.