Find in array

0 favourites
  • 4 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Hello to all

    I have an array consisting of three values:

    Goofy, 10.50

    Pluto, 20.30

    Donald, 10.10

    Goofy, 20,20

    Donald, 20.30

    and so on

    I have to look for the name and in the array there can be up to 5

    In the 'for' loop I can not understand which comparison parameter I have to use

    For 1 to 70

    mioarray = vNone (variable containing the name)

    I tried with

    myarray (loopindex-1) = vNone 'does not go'

    myarray (loopindex-1,0) = vNone 'even'

    myarray.curX = vNone 'no result'

    I can not make a valid comparison that I extract the name because then I need the other two parameters but if I can not isolate the name -...

    Thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Arrays start at 0, so your loop should be "For x=0 to 70"

    Inside this loop you can either use:

    myArray-> Compare at XY (X=loopindex, Y=0) equals vNone

    or you can use:

    System->Compare two values: myArray.at(loopindex, 0) equals vNone

  • Thanks'

    I have try but the code is not be ableto make a test

    if I delete the test, I load the whole array, if I put the test there is no match and the destination array is empty

    Mimmo

  • I solved

    Thank's

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