Construct 3 r311

You're viewing a single comment in a conversation. View all the comments
  • 4 Comments

  • Order by
    • [-] [+]
    • 1
    • Fib's avatar
    • Fib
    • 1 points
    • *
    • (3 children)

    Is there a specific example where chooseindex function is really useful? I can't think of any use case for it.

    • Yeah i can't think of any use case either. Don't understand why this one was implemented immediatly after being suggested without gathering any vote while there is so much features a bunch of people ask and that would be really more useful.

      For example a really simple one even if it looks like a dumb one : BBoxCenterX, BBoxCenterY, (+ViewportCenterX, ViewportCenterY, LayoutCenterX, LayoutCenterY ?) would be great QOL and are some of the top requested feature on the platform. We can't make our own utility function for those BBoxCenter that works with all objects, it would only work with specific families and pick by UID.

    • chooseindex enriches the usage of choose. But There is difference between chooseindex and tokenat, tokenat only needs to pass in 1 string as a parameter, while chooseindex needs multiple parameter, Their usage scenarios are very different.

      ▶ choose

      choose("Hey, how are you?", "Welcome!", "Nice to meet you!", "Hi, come in.")

      ▶ chooseindex

      chooseindex(int(random(4)), "Hey, how are you?", "Welcome!", "Nice to meet you!", "Hi, come in.")

      ▶ tokenat

      tokenat("Hey, how are you?;Welcome!;Nice to meet you!;Hi, come in.", int(random(4)), ";")

      ▶ ternary operator

      variable=1 ? "Hey, how are you?" : variable=2 ? "Welcome!" : variable=3 ? "Nice to meet you!" : variable=4 ? "Hi, come in." : ""

      ▶ Array

      Array.At(0, int(random(3)))

      ---------

      chooseindex(int(random(3)), array1.at(0,int(random(3))), array2.at(0,int(random(3))), array3.at(0,int(random(3))))

      • [-] [+]
      • 1
      • DiegoM's avatar
      • DiegoM
      • Construct Team Construct 3 Developer
      • 1 points
      • (0 children)

      The expression was implemented because of this suggestion construct3-21h2.ideas.aha.io/ideas/C321H2-I-438