Reading through Docs and Forums, and a little testing out, it seems like when using script files:
- Accessing Construct objects is done via runtime, which is passed into functions such as the runOnStartup
- To integrate with events, specifically having functions in a script file called, the functions need to be declared in global scope, which means NOT in runOnStartup
Is there a way to do both?
I'm thinking declare an object in the global scope and add methods to it from inside the runOnStartup function . . . but wanted to tread carefully until I'm understanding further.
--A little background:
I'm actually working in a fairly large project that is ported over from C2 (using C3 runtime). I wanted to create some objects in script files that handle a lot of the logic (such as filtering, sorting, mapping arrays) and then either call functions (Event Sheet functions that were setup prior) or assign variables (Global and/or Instance). So that is why I'm trying to get it declared in the global scope but have access to runtime / fully integrate and interact.
So I'm new to Scripting in C3, just recently upgraded, but experienced with both Construct and JavaScript.
Thanks for any help here! I don't want to spend too much time figuring this out right now if this solution isn't possible/practical, or even if it isn't recommended as I don't want to cause myself troubleshooting issues down the line.
Thanks