How do I fix a flowchart-transitioned global variable?

Not favoritedFavorited Favorited 0 favourites
  • 6 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • I'm creating a choose your own adventure type game, based on flowcharts. I have to call an output value to become my text. However, I added some randomness to make the text more interesting (here's one example):

    "Hello. The time is " & choose(5,7,9) & ":15 PM. Have a good day!"

    Then, I turn that flowchart output into a global variable, then "set text" to my global variable.

    Unfortunately, when I do this, the text comes out literally as it was written, with the & choose(5,7,9) &, as opposed to coming out as "Hello. The time is 7:15 PM. Have a good day!"

    Does anyone know how to fix this? Thanks in advance!

  • set the text first and then set the variable to textobj.text

  • I tried this and it didn't work (but thanks anyway). Do you know of any other way to do it?

  • That should work if you do it in that order, the one you posted was in reverse converting it to a string in a variable and then trying to set text with variable. Also what is the importance of the variable, can't you just set text?

  • Well, what I meant was I took your advice and changed my code after seeing your suggestion, and that didn't work either. Also, the importance of the variable is that I use some other code and an extra variable or two to make the text appear quickly letter by letter, as if someone is typing it.

    I also tried just getting the value from the flowchart directly to the text, eliminating the "typing" mechanism, but it still showed the "& choose etc."

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried the typewriter setting on the text object? That works quite well for what you're describing. What is the flowchart? I guess that's where the problem lies because it is already a string.

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