The complete Save Name script
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
var entered: String = str(GetGUIElementProperty(
"register_panel", "name_box", "text", ""
)).strip_edges() if entered.is_empty():
await SetVariable({
"name": "feedback",
"value": "Please enter a visitor name."
})
return false await SetVariable({
"name": "visitor_name", "value": entered
})
await SetVariable({
"name": "feedback",
"value": "Name saved in the register."
})
return trueRead the parts that you may want to change#
| Part | Meaning |
|---|---|
| register_panel / name_box | The GUI and the specific input control. |
| text | Read the current editable contents, not the original definition's value. |
| The final empty String | Fallback if the field cannot be found. |
| strip_edges() | Remove spaces at the beginning and end. It keeps the name's internal spaces and letter case. |
This saves the name in a runtime variable. It does not rename the active Character definition. Use @PlayerName for the character and $$visitor_name for the separate entered name.
