Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Interactions between scripts

Hi I'm new here :)   Looked around in the forums but couldn't find an answer (may be missing some vernacular for search terms though) Is it possible to access a script's data from another script?  For example, can I declare a class in one script, then extend it in another?  Is there any special syntax for doing so?  Do I 'require' the other script, or are all loaded api scripts compiled and then loaded as a single file?  If its not possible, do you usually just build your scripts all in one file, or use some kind of build automation tool to compile it all automatically?   Thanks for any insight!
1510788143
Jakob
Sheet Author
API Scripter
All scripts are just concatenated into one file in order before they are executed.So if you have several scripts that somehow depend upon another, it should not be a problem.
Thanks!
1510858258
Lithl
Pro
Sheet Author
API Scripter
However, you should not  depend on the ordering of the scripts, since you have not real control over what order they appear in the concatenated result. Since the API is event-driven, this usually isn't a problem, but it's something to be aware of.
Good to know.  That tip may have saved me a bunch of debug-time down the line :P