Scope of Structs in Script Hierarchy

Started by theCosmotect, Wed 09/07/2008 19:17:41

Previous topic - Next topic

theCosmotect

I'm running into a problem with the way AGS deals with script/struct scope. Or maybe I still remain fundamentally confused on exactly how importing and exporting things works in AGS. Anyway, where I'm getting stuck at is when I'm trying to use an instantiated struct lower on the script list in a different struct (its definitions) that is higher on the list. Alright, we know that the order of the scripts on that list matters, that the lower scripts have access to those above it, but not the other way around. But I thought that's where importing/exporting stuff came into play. I've tried a bunch of different ways to try and get the scripts higher on the list to recognize instances of lower structs (token can't be identified) but to no avail. So, does anyone have any insight into this matter? Any workarounds? All I basically want to do is make an instance of a struct truly global so that any script--be it room or module--can have access to it (much like the global variables in the global variables node).

If it's not possible, I know I probably can always shove all the structs and their definitions into a single script file at the top of the list, but I really don't want to if I don't have to. The AGS manual led me to believe that I could achieve what I wanted by instantiating and exporting the struct variables in the global script file...

SSH

import/export makes things available to lower-down scripts. If you don't import/export its only available to the same script. So your only solution for what you want is to put your thing in the topmost script.
12

SMF spam blocked by CleanTalk