display loopindex current values with nested loop

0 favourites
  • 3 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • 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:

    <img src="https://dl.dropboxusercontent.com/u/15587147/New%20Bitmap%20Image.bmp" border="0">

    Here is the result:

    <img src="https://dl.dropboxusercontent.com/u/15587147/New%20Bitmap%20Image%20%282%29.bmp" border="0">

    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:

    <img src="https://dl.dropboxusercontent.com/u/15587147/New%20Bitmap%20Image%20%283%29.bmp" border="0">

    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?

    <img src="https://dl.dropboxusercontent.com/u/15587147/New%20Bitmap%20Image%20%284%29.bmp" border="0">

    here is the fixed cap---sorry

    https://dl.dropboxusercontent.com/u/15587147/buildtext.capx

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks very much for clarifying this---I had a feeling it was intended behaviour and no bug--but wasn't sure.

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