Can I check values with "|" in expression?

0 favourites
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • Can I check values with "|" in expression? Cause I tired that with checking array value and it doesn't work. But maybe I'm doing something wrong? cheers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't get it... Are you trying to convert a String into an array separating by "|"?

    If yes, you can use the tokenat() System expression.

    tokenat(Text, Index, Separator)

  • I don't get it... Are you trying to convert a String into an array separating by "|"?

    If yes, you can use the tokenat() System expression.

    > tokenat(Text, Index, Separator)

    >

    No, I'm talking about condition Array.curx, Array.cury = "A" | "B" . This doesn't seam to work.

  • Array.cury = "A" | Array.cury ="B"

  • Compare two values

    Array.CurX = "A" | Array.CurY = "B"

    Equals (=)

    true

    (Array.CurX = "A" OR Array.CurY = "B")

    Just keep in mind that CurX and CurY are excluive of FOR EACH loops, and are numbers oH< *

  • Awesome, thanks guys. Will check it out.

  • More like:

    (x=a|x=b)=1 ?foo :foo2

    It returns a Boolean.

  • More like:

    (x=a|x=b)=1 ?foo :foo2

    It returns a Boolean.

    What's foo? Function?

    Could you expand your example? Just bit confused. Atm I want to check weather a value at current X and Y is = A or B. Then I want to follow with actions. But I'm open to learning more too.

  • Its a conditional. It tests if a statement is true, and says what to do if it's true (?), and what to do if it's not(:)

    1=1 ?set x to 9 :set x to 2

    Since 1 is equal to 1 it would do whatever follows the question mark.

    If it wasn't it would set it to whatever was after the colon.

  • Its a conditional. It tests if a statement is true, and says what to do if it's true (?), and what to do if it's not(:)

    1=1 ?set x to 9 :set x to 2

    Since 1 is equal to 1 it would do whatever follows the question mark.

    If it wasn't it would set it to whatever was after the colon.

    Ok. So you are saying I should add brackets? I don't need that part after ? at this point although I do use it sometimes.

  • that‘s for JS, right?

  • | gets evaluated to either 1 or 0. 1 if either, or both are true, 0 if neither are true.

    It does not return the value that was evaluated. You set that up in the conditionals "?", and ":".

    So there's multiple parts.

    The conditional:

    statement ?value if true :else

    The or as a statment:

    (1=0|1=2)=0

    No its not js, it's the dummied down version of parts of js.

  • | gets evaluated to either 1 or 0. 1 if either, or both are true, 0 if neither are true.

    It does not return the value that was evaluated. You set that up in the conditionals "?", and ":".

    So there's multiple parts.

    The conditional:

    statement ?value if true :else

    The or as a statment:

    (1=0|1=2)=0

    No its not js, it's the dummied down version of parts of js.

    Sorry. I'm not sure how I should go about it. I'd like to turn those conditions in to one condition per image:

    or

    Could you give me example based on those?

    Thanks

  • It wouldn't go in the condition, it would go in the action.

    Something like:

    for each in array

    -> object set opacity to (curx="r"|curx=1)=1 ?100 :0

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