Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
One quick question...
Mooserider Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2011
Reputation: 2
#1
One quick question...

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


Working on a FC: "Don't Let Go "
09-28-2011, 07:56 AM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#2
RE: One quick question...

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

09-28-2011, 09:51 AM
Find
Mooserider Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2011
Reputation: 2
#3
RE: One quick question...

Thanks, Khyrpa :3

Working on a FC: "Don't Let Go "
09-28-2011, 10:50 AM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#4
RE: One quick question...

(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:
for(int i=1; GetEntityExists("ScriptArea_"+i); i++)
when the asterix isn't an option.
(This post was last modified: 09-28-2011, 11:46 AM by Apjjm.)
09-28-2011, 11:46 AM
Find




Users browsing this thread: 1 Guest(s)