(3.6.1) Using multiple Text Boxes in one GUI [SOLVED]

Started by Rik_Vargard, Sat 26/07/2025 22:25:17

Previous topic - Next topic

Rik_Vargard

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!  :)

Snarky

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 module or my TextField module.

Rik_Vargard

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

Khris

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...? ;))

Rik_Vargard

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

Khris

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.

SMF spam blocked by CleanTalk