Possible Bug: NewLine in Loops

This forum is currently in read-only mode.
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • It's possible that I'm doing something wrong here, but this looks like it might be a bug. I figured I'd ask first.

    ====== Symptoms:

    Example file:

    Given the following:

    Event: For "loop" from 1 to 10.

    Action: EditBox: Set text to: EditBox.Text + "x" + NewLine

    I get the following output, (though I have replaced the unidentified-character squares with sharp signs "#" so that they would be visible in this post).

    x########

    x#######

    x######

    x#####

    x####

    x###

    x##

    x#

    x

    x

    From the event and action, it seems that we should see exactly one new line after each "x". Obviously something else is happening.

    ====== Possible Cause:

    It looks like the NewLine expression inserts a new-line-generator-marker into a string of text, and then at the end of the event, all the existing markers are triggered once to generate a new line character at their respective current positions. This works fine for most situations, but when placed inside a loop, a new-line-generator marker can be placed into a string on the first loop step, and then triggered multiple times by all the remaining steps as each loop step reaches its end. This could explain why NewLine expressions evaluated in earlier loops seem to be transformed into more new lines than those in latter loops.

    ====== Possible Workaround:

    As a work around, I might be able to use a special character (or character sequence) in place of the NewLine expression when inside loops, and then convert the special character(s) to new lines afterwards.

    If anyone has any information pleas let me know.

    Thanks.

  • Well I guess it should work the way you're doing it, which it doesn't. BUT if you use the Append text action instead, it works just fine!

  • That code looks like it should work so.....

    report it to the tracker.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I ran the example you uploaded and it worked fine for me (without any weird characters)... are you using the latest build (0.99.7)

  • Hi Ashley, I did read the bug report procedure, I just wanted to be sure I had actually found a bug first before submitting something to the tracker. So I hope I didn't cause any problems. In any case, I just tried making a Source Forge account, and I have yet to receive the activation email. It has been about a half hour, so I think something went wrong. I have a screen capture of the registration page, so I know I typed the email address correctly, but there is still no email. I'll try contacting their tech support tomorrow.

    Thanks for the suggestion PixelRebirth, however I actually get the same results when using the "Append text" action. I also get the same results when concatenating a string that contains a new line. Pretty weird...

    In answer to your question David, I am currently running 0.99.62, which Construct seems to insist is up to date, but I see that there is indeed a 0.99.7 version listed on Source Forge. It says it has zero downloads though which is a bit odd. Is 0.99.7 stable?

    At any rate, thanks for the feedback everyone, I'll see about getting the Source Forge problem straitened out, and try posting the bug tomorrow.

  • Unstable builds are posted to the Construct forum.

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