How to change variables with input text?

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I'm trying to build an app that will store a lot of variables (both strings and numbers), and I need the user to be able to assign the variables through a text input box. Specifically, there will be many input text objects with buttons next to them, and the variable will be assigned when the user types something into the text input and then clicks the button. I need the variables to remain global between scenes. How can I set this up?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Set global variable to textinput.text

  • Global variables always retain their values between layouts, unless you specifically reset them.

    If you want to assign values to them via text inputs, you will have to add a bunch of events like this:

    TextInputA On Text Changed -> VarA set value to TextInputA.text

    .

    Another option is to use a Dictionary instead of global variables. Then you will be able to optimize these events, for example by storing key name in a local variable on each text input:

    TextInput On Text Changed -> Dictionary Set key TextInput.keyname to TextInputA.text

  • Thanks everyone, I'll try this out.

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