Terrascript arguments / placeholders
astrsh opened this issue ยท 0 comments
Allow scripts to be passed arguments via external means such as through tree & structure configs (soon to be object configs), and through the structure
ts function.
This could be handled several different ways.
The passed arguments could simply be declared as variables at the start of the script, for example:
id: "SOME_OBJECT"
scripts:
- some_script: 1
script-arguments:
- name: arg1
type: STRING
value: "a string"
- name: arg2
type: INTEGER
value: 5
id "some_script";
// rest of script
Would be equivalent to:
id "some_script";
str arg1 = "a string";
int arg2 = 5;
// rest of script
Alternatively scripts could treat arguments as placeholders, where the script would determine data type rather than the place the arguments are defined:
id: "SOME_OBJECT"
scripts:
- some_script: 1
script-arguments:
- arg1: "a string"
- arg2: 5
id "some_script";
str arg1 = $S{arg1};
int arg2 = $I{arg2};
// rest of script
With placeholders applied:
id "some_script";
str arg1 = "a string";
int arg2 = 5;
// rest of script