Suggestion: add optional script parameters.
Example:
Our "test_script" will accept two parameters, one being optional. It should look something like this:
And when we call our function:
The compiler should replace "(call_script, "script_test_script", 819263), " with "(call_script, "script_test_script", 819263, <default_value>), ".
There are some special cases:
1. if the <script_id> param of call_script is not a value (it is a variable or a register), then do nothing.
2. if there are more "store_script_param_"(that stores the same parameter) then if one of them has a <default_value>, mark the parameter as optional and store the first <default_value> occurence
3. the <default_param> can also be a global variable or a game register (not only a value).
Example:
Our "test_script" will accept two parameters, one being optional. It should look something like this:
Code:
("test_script",[
(store_script_param_1, ":first_parameter"),
(store_script_param_2, ":optional_parameter", <default_value>),
#or
(store_script_param, ":optional_parameter", 2, <default_value>),
<rest of the code>
]),
Code:
(call_script, "script_test_script", 819263), # the compiler will insert the second parameter as <default_value>
or
(call_script, "script_test_script", 819263, 10),
The compiler should replace "(call_script, "script_test_script", 819263), " with "(call_script, "script_test_script", 819263, <default_value>), ".
There are some special cases:
1. if the <script_id> param of call_script is not a value (it is a variable or a register), then do nothing.
2. if there are more "store_script_param_"(that stores the same parameter) then if one of them has a <default_value>, mark the parameter as optional and store the first <default_value> occurence
3. the <default_param> can also be a global variable or a game register (not only a value).