How do I Save text in a variable from a text object

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • i have two boxes to test, when i type with my keyboard then in the first sprite box appear the word that i wrote and in the second box my game shows the same word but in a text object, i am trying to save in a variable the word of any of the two boxes without success, after researching i cant found the answer, please help.

    i tried this:

    keyboard (on key code 13 pressed) -> TextObject (set mywords to TextObject.text)

    in the debugger mode the variable value of mywords is 0, if i write some text in the default text value after pressing the key enter the value is set to 0, i dont understand why the word cant be saved.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Perhaps have you set "myword" to Global number instead of Global text?

  • Perhaps have you set "myword" to Global number instead of Global text?

    its an instance variable type text, i am trying now with a global text with an initial value , when i hit Enter the value of the variable is empty.

  • Is the code "keyboard (on key code 13 pressed) -> TextObject set text to TextBox.text" works?

  • Is the code "keyboard (on key code 13 pressed) -> TextObject set text to TextBox.text" works?

    didn't work, i dont know why, in the text object properties obviously "Text" is empty, and the game set the variable with an "empty value" too, this have sense, then my question is how i can save in a variable the typed text of the text object.

  • Could you share your capx or a screenshot of your code?

  • Could you share your capx or a screenshot of your code?

    thanks for your help, Now its working, i dont know why but this cant work with sprite fonts or saved letters in an array, the solution was put the same words in an invisible textobject without spritefont or letters saved in an array.

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