Skip to reading
PCA Script Programming

34. BASIC, visual graphs and calls back into PCA

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 PDF page

Create a BASIC record math_basic with this source. Its entry point conventions differ from PCA, but a named function can still receive the same positional arguments.

Code example
OPTION PCA3D BASIC 1.0
FUNCTION AddPoints(base AS Integer, bonus AS Integer) AS Integer
    RETURN base + bonus
END FUNCTION
Code example
function run()
    return call_script("math_basic", "AddPoints", [10, 5])
end

GDScript can call a PCA function through CallScript. This is a native script helper, with capitalized spelling and the native await keyword:

Code example
func run(context: Dictionary = {}) -> void:
    var total = await CallScript("utility_pca", "add_points", [10, 5])
    Log(str(total))

A Lua caller uses await(CallScript("utility_pca", "add_points", {10, 5})). A BASIC caller uses

AWAIT CallScript("utility_pca", "add_points", [10, 5]). In a visual graph, use Call Script / Call Script Function and its argument or parameter fields.

Source table from 34. BASIC, visual graphs and calls back into PCA, page 42
Boundary ruleWhy it matters
Unique script IDsThe router resolves an ID across language collections.
Ordinary dataText, numbers, arrays and dictionaries are the clearest contract.
Explicit resultsDo not rely on another language’s private local variables.
Shared state chosen deliberatelyGlobals are game state; included variables are router session state.
Own language syntaxA GDScript record proxy is not a PCA namespace or method API.

This build’s supported authored language routes are PCA Script, GDScript, Lua, BASIC and visual graphs. This guide does not claim C# or Python support.

Page 42 of 357Permalink
Go to page