Wow: long time, no post. Between getting married, moving into a new place, starting a new job, and — most importantly — trying to master the BoA editor and Avernumscript , there hasn’t been much time for anything else.
I’ve spent as much time as I could spare with the BoA editor and manual, but right now I think I’m missing something: namely, a way to simulate user-defined functions as they behave in other programming languages.
First off (to avoid “RTFM” responses) I realize several things:
1. Certain script states can be called from multiple places to do things.
2. SDFs can be used to simulate integer arguments to “function” states.
3. ...Just as they can be used to hold integer values “returned” from “function” states.
I’m unclear on the scope of states and variables, however. For instance:
1. STATES: The appendix states that you can use run_scenario_state(short which_node) to call scenario states — presumably anywhere. Likewise, it states that you can use run_town_script(short which_node) from dialogue, creature, or terrain scripts. My question is this: is the reverse possible? That is,
1.a. Can scenario scripts call town script states? If so,
I imagine that only the current town’s states can be called
because no other towns’ scripts are in memory. (Correct?)
1.b. Can town scripts invoke other towns’ script states?
(I’m guessing not, for the same not-in-memory reason.)
1.c. Can scenario or town scripts call states in terrain
and creature scripts?
I imagine that all of the above can be accomplished indirectly with a combination of SDFs and messaging, but I wanted to know if I’m on the right track.
2. VARIABLES: I declared and set a variable in a scenario script, but when I tried to use that value in the code block of a town’s dialogue node, it was unrecognized.
2.a. Are SDFs the only “global variables” available for use?
2.b. If so, how can we fake passing string “arguments” to and
from “function” states? I imagine that the string
buffer could be used for this purpose, but does the buffer
retain its contents between states and scripts?
E.g., say a town state begins to populate the buffer with
“Churl ”, and then calls a scenario script state which
appends “is confused” to the buffer before return. What
string would be assigned by get_buffer_text when
called by the town script after all of that?
Despite my best efforts toward due diligence, I’m sure that some (if not all) of my questions deserve “RTFM” responses. If so, please be gentle, and please simply point me to where I can R it in T Fing M.