24. Player input through a GUI text box
PCA Script does not have a terminal-style input() or blocking prompt builtin. Make a GUI with a text box and a Confirm button. The button runs a script, and the script reads the live text from the element.
global player_name = "Ada"
function run()
let typed = get_gui_element_property("name_entry", "name_box", "text", "")
typed = trim(typed)
if len(typed) < 1
set_gui_element_property("name_entry", "feedback", "text", "Enter a name.")
return false
end
player_name = typed
set_gui_element_property("name_entry", "feedback", "text", "Hello, " + typed + ".")
return true
end1. Create a GUI with ID name_entry. Add a single-line Text Box with ID name_box, a Label feedback, and a Button confirm.
2. Create this script as accept_name. On Confirm → Events → Click, choose Run Visual Script / Run Script behavior and set Target to accept_name.
3. Leave the event’s Verb empty. Validate/apply the script and save the GUI. Show the GUI in a running game.
4. Type a name, then click Confirm. text reads the live control, not just the text originally stored in the designer.
Figure 7. The input panel in the GUI Designer. The text box collects input and the button calls the PCA script.
