Possible Bug: NewLine in Loops

For questions about using Classic.

Post » Mon Dec 14, 2009 2:30 pm

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:
viewtopic.php?f=16&t=5245

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. :)
B
21
S
13
G
8
Posts: 306
Reputation: 5,458

Post » Mon Dec 14, 2009 2:36 pm

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! :)
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Mon Dec 14, 2009 3:33 pm

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

report it to the tracker.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Mon Dec 14, 2009 6:46 pm

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)
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Tue Dec 15, 2009 3:52 am

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.
B
21
S
13
G
8
Posts: 306
Reputation: 5,458

Post » Tue Dec 15, 2009 10:01 am

Unstable builds are posted to the Construct forum.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,564


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests