Frictional Games Forum (read-only)

Full Version: One quick question...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone Big Grin

A quick question: How do I go about affecting multiple objects in my script? They all have the same name, just with a different number at the end, for example, if I want to add a collide callback to:

"SciptArea_1", "SciptArea_2", "SciptArea_3".

I know there's a way apart from making a separate AddEntityCollideCallback for every single one, I just don't know what it is.

Some help would be appreciated Tongue

Thanks in advance! Big Grin

"ScriptArea_*"
or
for(int i=0;i<4;i++) AddEntityCollideCallback("", string"ScriptArea_"+i, string& asFunction, bool abDeleteOnCollide, int alStates);
(sigh... I don't remember if that means from 1 to 4 or 1 to 3...)

Some things dont work with that asterix (*) so you have to use the for(int... thing.
Thanks, Khyrpa :3
(09-28-2011, 09:51 AM)Khyrpa Wrote: [ -> ]"ScriptArea_*"
or
for(int i=0;i<4;i++) AddEntityCollideCallback("", string"ScriptArea_"+i, string& asFunction, bool abDeleteOnCollide, int alStates);
(sigh... I don't remember if that means from 1 to 4 or 1 to 3...)

Some things dont work with that asterix (*) so you have to use the for(int... thing.
When doing the for loop, it is more useful/easier to do:
Code:
for(int i=1; GetEntityExists("ScriptArea_"+i); i++)
when the asterix isn't an option.