Help with ARRAYS! Picking a specific spot on the array!

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I need help understanding arrays a bit more. Let me preface this by saying I've read every array tutorial available here but my specific problem does not seem to be in any of them.

    Feel free to point me towards a tutorial you think might be able to help me out.

    I need help with column A in the image. Basically, I want to be able to use the "id" number to decide which piece of dialogue is referenced.

    Assuming I learn how to do that, being able to test if instead of a number, "|END|" is in its place, I want to be able to "close" the dialogue window. I think I can manage this with the other bit of info.

    I wanted to test the "NAME" column and grab any name in there to place into the dialogue box.

    So instead of saying "ARRAY.AT(6,3)" which would bring the line "This is the text thats on id 105" ,

    how do I instead input "ARRAY.AT("105")" ?

    ----

    I'm not sure if my problem lies with attempting to use "Array.at", instead of "Array.indexof" , or if I need to test something with a condition instead. I tried using "Array - for each X element" , and "Contains value X", but everything keeps returning either 0 or -1 in the case of IndexOf.

    Tagged:

  • I think it's Array.At(Array.IndexOf(105),3)

    But I'm not sure if IndexOf works correctly with 2D arrays.

    I can recommend CSV addon, it's very handy for accessing data from tables. For example in your case you could use CSV.At("DIALOGUE", "105")

    construct.net/en/forum/extending-construct-2/addons-29/plugin-csv-csv2array-csv2dicti-41868

  • Use XY element not X element

    Array - for each XY element

    Array - Current value = 105 ---> Text - Set text to Array.At(Array.CurX , 3)

    Use second line as a sub event or a combined(AND) event. Your dialogs are i think at the 4th column. If in different position use Array.At(Array.CurX, ColumnNoOfDialog - 1)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000 , mrcgkh

    Thank you both so much. I've been inputting CSV commands assuming CSV, Arrays, and Dictionaries were all the same thing. Somewhere along the line I stopped using Rex's CSV addon and it all melted together.

    I have a better understanding on "current value" now as well. Thank you both.

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