Store text, and recall it

Get help using Construct 2

Post » Thu Jun 07, 2012 3:55 pm

Hi,

I have tried various things with the variables, but could not get it working.

At the first layout, there is a textbox where a person fill in their name.
In later layout, I want to have a text with: Hello (filledinname).

Getting that information from the previous layout is not working.
Probably I have to it with the set text to: "Hi " & name.
Like here http://www.scirra.com/forum/a-health-and-limit-in-one-text_topic46973.html

I know have the problem to get the data from the form correctly.
I think it can be very simple, but not found a good solution yet, thanks!
B
3
Posts: 4
Reputation: 283

Post » Thu Jun 07, 2012 4:01 pm

You'd want to set the custom name to a global variable, or a global array object, depending on how many other variables you want to share across layouts.

You can create global variables by right mouse clicking in an event sheet and selecting "Add global variable" from the drop down menu (you can call it "PlayerName" for easy reference). Then, in your events handling name input, once the player gives the OK you can set the global variable "PlayerName" to whatever the player input their name as. Then later on, when you have your dialogue event, you can set the text string as

"Hi " & PlayerName

Global variables are called just as you named them, without any quotes.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Thu Jun 07, 2012 6:24 pm

I know what you mean, but I have trouble with setting up the inserted text as global variable. This part 'you can set the global variable "PlayerName" to whatever the player input their name as. '

Here is also the project file:
http://dropcanvas.com/lyy9z

Thanks!
B
3
Posts: 4
Reputation: 283


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests