display loopindex current values with nested loop

Get help using Construct 2

Post » Wed Sep 18, 2013 11:10 pm

I could be wrong but I wanted to post this to see if there is a possible bug I should report.

I was experimenting with appending text with 2 nested loops and their loop indexes. But when I tried to append them this first way, all I got were "1"'s.

Here is my original event:



Here is the result:



I have searched all over the forums to find if this is a known bug or issue and found nothing. It may just be my not understanding how to build texts--but the explanation in the manual is very easy and it works with other variables fine.

I was able to fix the problem by adding an & and a double quote:



and the result below is the way I thought it would work without having to use an & symbol with 2 quotes......am I doing something wrong?



here is the fixed cap---sorry

https://dl.dropboxusercontent.com/u/15587147/buildtext.capxhoneben2013-09-18 23:15:08
B
19
S
6
G
3
Posts: 9
Reputation: 1,755

Post » Wed Sep 18, 2013 11:42 pm

This is expected behaviour. Putting '&' in between two integers is not the same as between two strings. int & int will evaluate to: 'is int not zero' AND 'is int not zero', which in your case is true, so the result is True, which for an int is 1.

The point is, you should use str(loopindex("x")) & str(loopindex("y")) to convert the integers to strings before using the '&' which now means: joint these two strings together.

Your fix does the same thing, but the above is clearer, and explicit.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Thu Sep 19, 2013 12:11 am

Thanks very much for clarifying this---I had a feeling it was intended behaviour and no bug--but wasn't sure.
B
19
S
6
G
3
Posts: 9
Reputation: 1,755


Return to How do I....?

Who is online

Users browsing this forum: KTML5 and 27 guests