Creating 3 identical arrays.

Get help using Construct 2

Post » Sat Jun 15, 2013 2:55 pm

I have 3 arrays (same name) which need to start off with identical contents. I've made the contents in array 0 and need to copy it into arrays 1 and 2. Each array has the same name and a variable to identify it (I know you can do array(0) in some situations but it doesn't work in all, so I'm using a variable).

What I'm trying is, after Array 0 is full...

Array : Variable = 0 - Webstorage : Set local key ("savedarray") to Array.AsJSON

Array : Variable = 1 - Array : Load from JSON string Webstorage.Localvalue("savedarray")

Same for array 2.

It's not copying across at all. Any ideas why?
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Sat Jun 15, 2013 4:17 pm

Solved it, it would appear that the arrays aren't fully usuable until the next top-level event, as is the case with various objects. I was creating my 2nd and 3rd array, then jumping straight into the function. The function needed to be called from a seperate 'On start of layout' event, i.e

On start of layout > Create 2nd and 3rd arrays and populate first array (which already exists in the editor).

On start of layout > Copy first array into 2nd and 3rd array.

Works fine like that, but not if I try to do everything in a single event.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: skrotar and 9 guests