How do I get textbox instances to share text

Get help using Construct 2

Post » Wed Aug 02, 2017 5:56 am

I am making a RPG and I want the user to type into text boxes, After that I want them to go to another screen but be able to have the same boxes with the numbers they previously entered saved and on top of that be able to still type in them. Any method which would avoid me having to type a line of code for every box would be prefered but that's highly unrealistic. I am aware I could just have the text box setting its text to it's own text,

eg system, every tick | set text (Textbox1) | Textbox1.text

but that may cause problems allowing both text boxes to be typed in I want the first textbox to be typed in while on the first screen then the second instance to be typed in after that and the first one doesn't matter.


TL:DR A your lazy its two paragraphs but I want to have a textbox keep its text through layouts
B
4
S
1
Posts: 7
Reputation: 314

Post » Wed Aug 02, 2017 7:51 am

You could make it a global object, under object properties. Once you've set the text or typed the text in once, it'll keep its text between layouts.
B
46
S
16
G
73
Posts: 2,084
Reputation: 43,677

Post » Wed Aug 02, 2017 7:23 pm

Really I was messing with that but it didn't seem to work... I guess I will keep messing with it
B
4
S
1
Posts: 7
Reputation: 314

Post » Wed Aug 02, 2017 7:40 pm

Try to generate global variable with text value and when the user type when pressing a predefined telca set the value entered for the variable and in the other place to retrieve the value of the global variable ...
B
19
S
14
G
18
Posts: 78
Reputation: 13,693

Post » Wed Aug 02, 2017 10:26 pm

@huemerson that would work but is there a way that doesn't involve a global variable for each box, at this point I probably have hundreds
B
4
S
1
Posts: 7
Reputation: 314

Post » Thu Aug 03, 2017 7:49 am

If you're talking about what I think you're talking about then it's probably an inventory or some UI in an RPG that displays a bunch of stats between layouts. You can use arrays for storing stats in one object, you can then display the position of the array in a text box on start of each layout. Setting the textbox to be a global object to retain the text though should work though.
B
46
S
16
G
73
Posts: 2,084
Reputation: 43,677

Post » Thu Aug 03, 2017 12:05 pm

Another way I know, it would be via programming (PHP), but I do not know how to do it ... try to find tutorials about it ...
B
19
S
14
G
18
Posts: 78
Reputation: 13,693

Post » Fri Aug 04, 2017 3:07 am

@plinkie @huemerson Ok thanks you two!
B
4
S
1
Posts: 7
Reputation: 314


Return to How do I....?

Who is online

Users browsing this forum: humanescape, mindragon73, Yahoo [Bot] and 16 guests