35. Use a script-owned shared variable
Get Included Variable and Set Included Variable address a separate shared scope by script ID and variable name. They are useful when an included-script workflow needs state under that script’s identity.
| Node | Example fields |
|---|---|
| Set Included Variable | Script gd_tools; Shared Variable shared_counter; Value 9. |
| Get Included Variable | Script gd_tools; Shared Variable shared_counter; Store in Variable result_value. |
| Return | {"$var":"result_value"} reads the copied result. |
1. Choose an existing project script in Script.
2. Set the same Shared Variable name on the setter and getter.
3. Run the setter, then the getter.
4. Inspect the destination runtime variable.
5. Use a project variable instead when this is ordinary puzzle state that should be obvious in Variable Designer.
This scope is not an automatic window into every native GDScript member or Lua table field. It is the engine’s included-variable storage. The script ID has to be known; a missing source or never-written name can yield no value.
Keep the scope clear in your notes. Project variable shared_counter and an included variable called shared_counter are different locations, even though the names match.
