mardoch's Recent Forum Activity

  • Oh great! Thank you! I just realise my main mistake, even when I tried to reproduce it, was this:

    3-In your Goblal variable "Variable1" you entered the wrong value:

    1|0|1

    Because there is one character missing at the end as in your Array you have:

    1|0|1|

    So it will never trigger the match, make sure you always put the exact value.

    I couldn't figure it out without you.

    Thank you so very much!!

  • Maybe it's time to share the file?

    Yep definitely the time because I can't make it works. Here is my file:

    dropbox.com/s/otrysy1ehg3cvdh/ArrayTest.c3p

    But I was also thinking that maybe I did my table the wrong way. I can make it more simple as the values I'm searching are the same for the columns 0,2,4 and 6.

    I can probably put my values (the ones identical as my Variable) on the first row and all my seconds values (the ones I want to display in the text bloc) in the 4 next rows like this:

    More easier. (Btw, is it ok to rename the Y column as I did?)

  • Ok sorry, I get it. So let me explain exactly how I want it to be:

    • First I have a variable for column 1, I need to check in my array at column 1 where is the matching value (For example if my variable is 1|0|0, I want it to check where in my column the same value is. I only need to check the 1 column because that’s my variable for it).

    • When the value match, it stops the loop and picks the value on the second column (if my value is located in the cell x3, y0 I want it to pick the value in cell x3,y1)

    • Then I get this second value that I want to display in the text bloc.

    I though that this method with array is the easiest way to do what I want but maybe I'm wrong and there is something more simple?

  • My last example was just to check that there is no problem importing a value, sorry I'm just a beginner with the arrays.

    But my purpose, as you noticed earlier, is to match my variable with the value of the first column and then pick the value on the next column.

  • Yes, I'm pretty sure that my table is well imported in the array:

    I did also tried to disable the second event, just to check:

    + Array: For each XY element
    + [DISABLED] Array: Value at (Array.At(Array.CurX), Array.At(Array.CurX)) = Variable1
    -> Text: Set text to Array.At(1,Array.CurY)
    

    It only display "D", the last cell of the column 1.

    So I can say that it's supposed to work, bu it doesn't.

  • I already tried this, but my text is still unchanged.

  • Hello!

    I'm still trying to use array for different things each time and here is my new issue.

    I have to beautiful table.json that is actually displayed in an array.

    I also have a corresponding instance that is one of the values in the column 0,2,4 and 6.

    My objective is the check in my array, in the column 0 for example, the corresponding value. And then, getting the value from the column 1, same row.

    (As this for more clarity:)

    So I'm dealing with this code to get it done:

    + Array: For each X element
    + Array: Value at Array.At(0,Array.CurY) = MyVariable
    -> Text: Set text to Array.At(1,Array.CurY)
    

    But of course it's not working…

    I think the problem is with this line

    + Array: Value at Array.At(0,Array.CurY) = MyVariable

    but I really don't know how to deal with it.

    Also, maybe my method with this is not the good one. I thought using array was the simplest thing to do…

  • Yes that's it!

    Here is the good version:

    + System: Every tick
    + MapInOutCheck: MapInOutCheck = "upleft"
    + System: Pick MapInOutCheck where find(",ULDR,LDR,UDR,ULR,DR,UR,LR,R,,", ","& MapInOutCheck.TypeChecked&",") > -1
    -> MapInOutCheck: Set Entrance to True
    

    Thanks for your help!!

  • Your first solution is working fine.

    The second one with the find expression looks great and more elegant but it seems there is an extra " somewhere…

  • Hello!

    I need to check if my object's variable contain one of the possible values.

    I know that I can use something like this:

    + System: Every tick
    + MapInOutCheck: MapInOutCheck = "upleft"
    ----+ MapInOutCheck: TypeChecked = "ULDR"
    ----+ OR MapInOutCheck: TypeChecked = "LDR"
    ----+ OR MapInOutCheck: TypeChecked = "UDR"
    ----+ OR MapInOutCheck: TypeChecked = "ULR"
    ----+ OR MapInOutCheck: TypeChecked = "DR"
    ----+ OR MapInOutCheck: TypeChecked = "UR"
    ----+ OR MapInOutCheck: TypeChecked = "LR"
    ----+ OR MapInOutCheck: TypeChecked = "R"
    ----+ OR MapInOutCheck: TypeChecked = ""
    -----> MapInOutCheck: Set Entrance to True
    

    But I was asking myself if there is a better and simple way to do it, like this for example:

    + System: Every tick
    + MapInOutCheck: MapInOutCheck = "upleft"
    + MapInOutCheck: TypeChecked = "ULDR"|"LDR"|"UDR"|"ULR"|"DR"|"UR"|"LR"|"R"|""
    -> MapInOutCheck: Set Entrance to True
    

    This isn't working, even if I read that "|" means "or"

    So maybe you guys have a solution for me?

  • Oh I see!! Alright!!! Now that's working!!!

    Thanks again for your precious help dop2000! You rock!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok I get it, I just need to check the third line then.

    But the thing I still don't get is how do I tell my loop to only get the cells with my variable in it?

    This should work right?

mardoch's avatar

mardoch

Member since 21 Nov, 2013

None one is following mardoch yet!

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies