Frictional Games Forum (read-only)
One quick question... - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: One quick question... (/thread-10501.html)



One quick question... - Mooserider - 09-28-2011

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




RE: One quick question... - Khyrpa - 09-28-2011

"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.



RE: One quick question... - Mooserider - 09-28-2011

Thanks, Khyrpa :3


RE: One quick question... - Apjjm - 09-28-2011

(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.