I can't loop the Array

Get help using Construct 2

Post » Wed Dec 21, 2011 11:45 am


the array is always just have value in position 0,0...

I need your help Oo
B
9
G
2
Posts: 44
Reputation: 1,304

Post » Wed Dec 21, 2011 11:48 am

<event-block>
- <conditions>
<condition id="-2" name="On start of layout" type="System" />
- <condition id="-11" name="For Each" type="System">
<param id="0" name="Object">Arr</param>
</condition>
</conditions>
- <actions>
- <action id="3" name="Set at XY" type="Arr">
<param id="0" name="X">arr.CurX</param>
<param id="1" name="Y">arr.CurY</param>
<param id="2" name="Value">tokenat("100,250,150", arr.CurX +arr.CurY*arr.Width, ",")</param>
</action>
</actions>
</event-block>
- <event-block>
- <conditions>
- <condition id="-6" name="Every X seconds" type="System">
<param id="0" name="Interval (seconds)">1.0</param>
</condition>
</conditions>
- <actions>
- <action id="0" name="Set text" type="Text">
<param id="0" name="Text">Arr.At(0,0)</param>
</action>
</actions>
</event-block>
B
9
G
2
Posts: 44
Reputation: 1,304

Post » Wed Dec 21, 2011 11:49 am

My array's with is 3 , height and depth is 1.
B
9
G
2
Posts: 44
Reputation: 1,304

Post » Wed Dec 21, 2011 11:53 am

Arr.At(0,0) <- change this to Arr.At(arr.CurX,arr.CurY) also isn't work
B
9
G
2
Posts: 44
Reputation: 1,304

Post » Wed Dec 21, 2011 12:04 pm

Array article in the manual
Does it help ?

Also, please, use the edit option in your previous post rather than double posting.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Dec 21, 2011 12:08 pm

For Each system condition loops for each instance of the object. It is not used to loop through array values.

Use the Array's For Each element condition or system's For loop.

Refer to the manual, specifically Array page and System expressions page.

Mipey2011-12-21 12:09:05
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Wed Dec 21, 2011 12:27 pm

Okey...thank you very very much.

I think I have some "little white"(In Chinese way)

I'm really thanks for your helpmeichen80507532011-12-21 12:27:58
B
9
G
2
Posts: 44
Reputation: 1,304


Return to How do I....?

Who is online

Users browsing this forum: Unconnected and 30 guests