Can someone break down this expression for me?

From the Asset Store
Set of tiles to create a map for top-down games with island theme
  • left(SourceText.text, len(DestText.Text) + 1)


    It's about scrolling text, and I would like to know a few things, but a full breakdown would be amazing.

    Why does .text have to be after everything?

    How exactly does this copy out sourcetext to desttext (the full and blank text boxes respectively)?

    Trying to learn so I know the raw details and can utilize my own spin on it.

  • .Text is getting the text out of the textbox object.

    len(x) gets the length of the text.

    left(X,Y) gets the left most text from X, up to Y characters.


    The text you want to show is in SourceText.Text.

    We want to find out how much text is already in the destination and get one more character: len(DestText.Text) + 1

    We get that many characters from the source: left(SourceText.text, len(DestText.Text) + 1)

    If you walk through a couple of cycles, to start there is no text in the destination, so len(DestText.Text) = 0. We add one, and we want to get 1 character from the left of the source string: "N"

    The next iteration, the (len(DestText.Text) = 1. Add 1 and we get the 2 left most characters from the source: "Ne"

    Next: "New"


    The action is based on the fact that we need one more character from the source than the destination already has.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I really appreciate that! THankyou!

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