Skip to reading
Buttons, Labels & Text Boxes

12. Read and save the entered name

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView illustrations

The Use this name button will read name_box, trim the outside spaces and store the result in visitor_name. The visitor label already contains $$visitor_name, so it will display the new value.

Source table from 12. Read and save the entered name, page 26
StepJob
ReadGet the current text from register_panel / name_box.
CheckReject an empty or all-space answer.
StoreWrite the cleaned String into visitor_name.
ReportPut a short confirmation in feedback.

1. Create a native GDScript record with ID save_name and Name Save Name.

2. Replace its source with the complete script on the next page.

3. Validate/apply the script and save the project.

4. Set Use this name's Click behavior to the built-in run-visual-script and Click Target to save_name.

5. Run the game, enter a name and press Use this name.

Figure 20. The saved visitor is Joey, while the active adventure character is still Builder. They are separate values.

The built-in behavior has an older name, run-visual-script, but this release can dispatch the named GDScript record too. The catalog Run Visual Script action also offers a Script selector for the shared script types.

Page 26 of 46Permalink
Go to page