Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Rik_Vargard on Sat 26/07/2025 22:25:17

Title: (3.6.1) Using multiple Text Boxes in one GUI [SOLVED]
Post by: Rik_Vargard on Sat 26/07/2025 22:25:17
Hi!  :)

I've created a GUI with 4 different Text Boxes for the player to fill in.
Each Text Box has, of course, it's own Name for the scripting part : tbText01, tbText02, etc.
And then I'll create a Variable like Text01 = tbText01.Text;  for each one.
And then I'll have that NPC be like cNPC.Say ("OK listen, %s.", Text01);

Now, when the GUI shows up and I start to type text in one of the Text Boxes, all 4 of them are filled in at the same time with the same text.

How can I make it so that every Text Box can be filled in with it's own text (The player selects a Text Box and starts typing the text just for that Text Box) ?

Any ideas?
Thx!  :)
Title: Re: (3.6.1) Using multiple Text Boxes in one GUI
Post by: Snarky on Sun 27/07/2025 06:34:24
The basic idea is that you need to disable all the textboxes except for the one that has focus.

For a ready-made solution, you can use either SSH's old MultiTextBox (https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-multitextbox-v1-00-handle-multiple-text-boxes/msg636616479/#msg636616479) module or my TextField (https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-textfield-v1-2-0/msg636664629/#msg636664629) module.
Title: Re: (3.6.1) Using multiple Text Boxes in one GUI
Post by: Rik_Vargard on Sun 27/07/2025 13:21:25
Hey thx for the links! But right now, those modules are far above my level of understanding.

So at this point , if there's not really a basic AGS script that can do the trick I'll adapt this to what I can do.
I'll try this with a button that will save the messages and make the next Text Box visible once I click on it.  :P
Title: Re: (3.6.1) Using multiple Text Boxes in one GUI
Post by: Khris on Sun 27/07/2025 13:44:01
SSH's module doesn't even require additional code to set it up. You just import the module and it works. At least now it does:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-multitextbox-v1-00-handle-multiple-text-boxes/msg636684656/#msg636684656

(Isn't the point of a module that you don't have to understand its code in the first place...? ;))
Title: Re: (3.6.1) Using multiple Text Boxes in one GUI
Post by: Rik_Vargard on Sun 27/07/2025 14:56:03
Aaaah well, when I saw the code I thought I had to understand it to adapt it to my specific needs.
This is my first Module experience  8-0

OK, so this is working, just like that! (nod)
Hmm, I might start to try some other modules now!

Thanks a lot for your help, guys, my game is saved, once again.

Cheers!  ;-D
Title: Re: (3.6.1) Using multiple Text Boxes in one GUI [SOLVED]
Post by: Khris on Sun 27/07/2025 20:51:56
To be fair, most modules do either need some kind of setup or provide additional commands; this one is a rare exception where importing it is actually enough.
But most should be usable for anybody who has a basic grasp of how AGS scripting works.