Problem with fields and variable names

1 favourites
  • 2 posts
From the Asset Store
A very simple to set up ZElevation based depth of field system for your game. Fully commented.
  • Problem Description

    It is not possible to declare two variables with the same name even if they are in different fields.

    This bug is a problem when moving blocks of code that involve field variables.

    This is because, as described in this report, you can not have two variables with the same name even if they are in a different field.

    What happens if I have a block of code in the field of "Variable1" and I want to move that block to the field of "Variable2"? This will not be possible because there will be a problem with the names of the variables.

    As you can see in this image, "Variable1" does not enter the "Variable2" field.

    So why can not they be called with the same name?

    Attach a Capx

    https://www.dropbox.com/s/q9hzkpjn4mqr5i8/fieldsProblem.capx?dl=0

    Steps to Reproduce Bug

    Just try to change the name of "Variable2" to "Variable1", you will see that it is not possible.

    Expected Result

    If the variables are in different fields they should be able to have the same name.

    Operating System and Service Pack

    Win10 64

    Construct 2 Version ID

    r266 64bits

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is not a bug, it's working correctly. In the "Variable1" scope, "Variable2" can still be used. Their scopes overlap. Therefore "Variable2" cannot be renamed to "Variable1", since then using "Variable1" in the inner scope becomes ambiguous - it could refer to either variable. Therefore Construct is correct to prevent this case.

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