What's wrong in my array event?

0 favourites
  • 7 posts
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • Please look at my events. I am saving multiple data into single cell and then retrieving it. But my event not getting 00:06 from array. Looks like it skipping 0 index.

    Can you tell me if I'm doing something wrong.

    Tagged:

  • It´s hard to tell exactly what is happening just from the screenshot, but my guess is that it´s because you use "array for each XY" as the following sub-event where you pick "icons" will also work for every cell in the array that just contains 0. I think using "array for each X" and some adjustments should solve this.

  • "icons" has 4 instances with Id 0-3 So I want to get array which by matching icons ID

    If icon has ID 0 then get array value which has 0 on tokenat 3rd index and then ID 1 and so on

    My Events getting values from 1, 2, 3 but not getting 0. This is my issue

  • I´m pretty sure your function does work for 0, however, it gets overwritten later down the line.

    I´ve marked all the cells containing 0 in your array, all those will be checked inside the "For each XY element" loop, then icons will be picked where "id = int(tokenat(Array.At(Array.CurX,Array.CurY),3,", "))" will resolve to "0", then the text will be set to "tokenat(ArrayAt........." which also resolves to 0 and then the icons animation frame will be set to "int(tokenat(.........." which again resolves to 0.

    I think the easiest fix would be to add a regex check before you pick icons to see if you are actually on cell that contains the relevant data, so something like

    If that isn´t the fix I can only help you if I get my hands on the events.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I looked at this earlier too, and I think you don't need the "For each xy element" loop.

    you know the id from loopindex("x"), so you can directly set the text and animation without searching through the whole array looking for it. Since the objects were just created, they will be the only ones picked.

    so, get rid of the loop and use loopindex("x") instead of Array.CurX, and use 1 instead of Array.CurY (or whatever y element the data you want is in - I can't really tell from the image).

  • demo file

    click on Red doesn't create it but others are created

  • You are filtering any value that´s "0" out, of course the red square with frame & level "0" will not be created.

    wackytoaster.at/parachute/arrayThingy.c3p

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)