Construct 3 suggestions & ideas

Suggest and vote on ideas for Construct 3! Please note this is only one aspect of planning. We do not guarantee any features here will be implemented, even if they are top-voted ideas. The aim is just to collect feedback. Remember to search for existing submissions before adding an idea, describe your ideas as comprehensively as possible, and vote for plausible ideas that are well thought out. Please see our full guidelines on suggesting features.

54 Vote

Dynamically Reference Any Variable (Local, Global, Instance Variable, Booleans)

Reference dynamically any variable (Local, Gloval, Instance Variable, Booleans) etc...without the need to be reference it first


Sprite has Variables:





Right now to get the value of any of those Instance Variables we are forced to create the Action on the Editor and reference the Variables, for Example:

Print on a txt "Sprite.Health" so it cannot be changed it's locked to the var Health.

But if we had Dynamic Variables we could use it like we use the Dictionarys.Get("Key")


Note: all the Examples from now on, are assuming that we did the Pre picking of the sprite already in the conditions

I could have a Dynamic Variable Named "Value" where I could change it at any time during RunTime to any of the (health, Score, Class)

Set Var >>>>>Value = "Score" as txt

And just do set Txt To >>>"Sprite.Value" >>>>> Will print the Sprite.Score value




Set Var >>>>>Value = "Health" as txt

And just do set Txt To >>>>"Sprite.Value" >>>>> Will print the Sprite.Health value


The same goes for the (Global & Local Variables)

if we had

Local Var >>>>Speed

Global Var >>>> Deads

And we need to retrieve one of those values, we will do:

Set Var >>>>>Value = "Speed" as txt

And just do set Txt to >>>>>"Value" >>>>Will print the Local var "Speed" value




Set Var >>>>>Value = "Deads " as txt

And just do set Txt to >>>>> "Value" >>>>Will print the Global var "Deads" value

This will give us the option to build very Powerful strings that can be changed dynamically at Run Time, and gives a lot of freeDom


This is how its working at the moment: if you need to refference any variable you need to do a lot of Else statements to prepare everything before RunTime

  • tarek2
  • Mar 31 2020
  • Already exists
  • May 5, 2021

    Admin response

    The Dictionary plugin already supports using strings for variable names. A global Dictionary plugin can be used for accessing various global variables by string. A Dictionary object can also be placed in a container with another object like a Sprite, providing per-instance variables accessed by string.

  • Attach files
  • Admin
    Ashley Gullen commented
    5 May 10:02am

    You can already do this with a Dictionary. If you put a Dictionary in a container with a Sprite, you get string-named per-instance variables.

  • tarek2 commented
    30 Apr 09:51pm

    Also, I forgot to add that you could do things like building the string to reference variable as we used to do with the old c2 Function:


    You have two instance Variables on "Sprite1" object



    So you build the string to reference any of those variables

    Action set txt to = "Sprite1." & "Health"


    Action set txt to = "Sprite1." & "Points"


    You could have the name of the variable stored in a dictionary or Array or any other data plugin


    You have Dictionary with (Key = "Goal") (Value = "Points")

    And do Action set txt to = "Sprite1." & Dictionary.get("Goal")

    is the same as set txt to = Sprite1.Points

    So this way it opens many possibilities of dynamic events as you don't have to set the conditions and actions beforehand and it can keep changing and adapting depends on the Gameplay cutting down the number of events that you normally would do.

  • tarek2 commented
    31 Mar, 2020 12:36pm

    Or With Dynamic calls can be used like this and avoid many Else statements

  • +34