Mass Destroy Objects

personal_username's icon

hi all,

I was wondering if there was a way to destroy several objects at once with scripting.
Imagine you have different objects (buttons, messages, numbers etc) with the same scripting name... would then be possible to batch-destroy them?

Just asking.
May be useful to have debugging elements during testing but then remove them all with a single click before exporting the proper application/patch.

Mike S's icon

Can objects have the same scripting name? I suppose you could append the brackets then format a message.

So scripting name = dev[0]

format a message like...

sprintf dev[%i]

etc

Jan M's icon

you could a common pre- or suffix a and run apply/ applydeep in js. before deleting check the varname/scripting name with indexOf("prefix") != -1.

vichug's icon

@Mike S : objects can have the same scripting name ; however your suggestion seems clever to me since when you copy-paste an object which has for scripting name "anexamplescriptingname" for example ; then the pasted object will have "anexamplescriptingname[0]" as scripting name and another pasted object will have "anexamplescriptingname[1]" etc.
i think you can select objects based on their type ; then maybe you could destroy all the "flonum" objects at once this way for instance. This doesn't seem that good an idea to me however (if that's ever possible).

Mike S's icon

Can you show an example? Whenever I use the same name it always appends the brackets/numbers

vichug's icon

@Mike S : i correct myself, it won't show the [0] , start from the [1] ; unless your first scripting name already includes a [0] in which case subsequent scripting name will increment the number in the brackets - but i'm not sure i understand your question - brackets are added ; that's what i'm describing ? so ?..

vichug's icon

maybe you mean something like : first ascriptingname[0] ; copy-pasted gives ascriptingname[0][1] ? in this case i don't know since here it does indeed increase the nimber in the brackets, not adding other number in brackets