Skip to reading
Visual Scripting in Depth

45. Expose the same function in PCA Script

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page
Code example
language 1.0
function describe(amount, label)
    return {"amount": amount, "label": label}
end

1. Create a PCA Script record, for example pca_tools.

2. Enter the function above. Keep each dictionary expression on its physical source line as shown.

3. Add a definition named describe. Use amount:int default 7 and label:string default Workshop reward, in that order.

4. Use Definitions, apply the editor’s changes and save.

5. Call the PCA Script version from Call Script Function.

6. Check the returned amount and label against the GDScript version.

The visual caller need not change its design because the helper language changed. It still selects a function and supplies typed fields. The implementation remains in the chosen language’s script record.

PCA Script’s return dictionary is useful for a structured answer. For a simpler function, return a number or Boolean and compare that directly in the graph.

Use distinct script IDs such as gd_tools and pca_tools. Changing the language selection is not a translation operation; each script must contain its own valid implementation.

Page 49 of 93Permalink
Go to page