How to automatically index the numbers for events?

Get help using Construct 2

Post » Tue Mar 05, 2013 11:46 am

Hey pals, look at this picture i'm trying to create the events from 0 to 50, but it costs a lot of work, how do you automatize the numbers from 0 to 50?



Thanks in advance
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Tue Mar 05, 2013 11:55 am

Out of curiosity, what are you going to be doing in each of those events? Is it something you might be able to use a function for, and therefore use a for loop?
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Tue Mar 05, 2013 12:03 pm

I'm making a memory managament to keep reducing the object count each room, this game counts more than 1,000 objects in layout, but i managed to do it, i get less than 50 objects per room in runtime.

Joannesalfa2013-03-05 12:06:48
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Tue Mar 05, 2013 12:23 pm

Trt this:

B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Tue Mar 05, 2013 12:34 pm

@theubie thanks for your reponse,

Also do i create another 2 loops for below that you saw the pic?
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Tue Mar 05, 2013 2:07 pm

@Joannesalfa

Yup. Rinse and repeat as needed. Anytime you've got actions that are the same you can use the for loop to save yourself 49 or so events and avoid Carpel Tunnel Syndrome...for a while at least.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Fri Mar 08, 2013 5:35 am

@theubie Hello, i've updated the codebase for some reason, i'm having a problem with loop, it repeats from 5 to random to multiple actions and doesn't keep event anytime.





Otherwise, non-loop events worked after all...Joannesalfa2013-03-08 05:54:13
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Fri Mar 08, 2013 8:16 am

@Joannesalfa

One of the quirks with the for loop is that it seems to run all instances in parallel instead of serially. Since I'm unfamiliar with the InstanceBank object, I'm wondering if that's causing issues with it having data thrown at it simultaneously. You might try to add a wait 0.1*loopindex before it so they will all fire off a tenth of a second apart from each other and see if it makes any difference.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973


Return to How do I....?

Who is online

Users browsing this forum: Colludium and 25 guests