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

Is there a limit on the number of scripts and can you combine them into a larger script

I have been playing around with a lot of API scripts in a campaign I am the GM in.  I have found that I need to occasionally restart the sandbox as some scripts stop working (token-mod today).  The restart fixes this, but it makes me wonder, is there a limit (recommended or hard) as to the max number of scripts you add?  Also, for non single click installed one (i.e. ApplyDamage script) can you combine them all into a larger script or could that make things worse also? Given the recent announcement that the price is going up I am probably biting the bullet and getting my own Pro account before that happens.
1620240886
The Aaron
Roll20 Production Team
API Scripter
There isn't really a limit, outside some very large file size/memory size limit for the sandbox process.  I tend to run with quite a few scripts: You can concatenate script text together.  That's actually what the API Sandbox does with all the code to begin with, so you're not saving anything by doing it manually, and it does make it hard to maintain, but nothing stops you from doing it.  I have seen people do it in the past just to make it easier to copy a collection of scripts between games.
WOW, and I thought I had a lot LOL.  Thanks Aaron!
1620256622

Edited 1620256805
Except convenience there are other reasons to concatenate the scripts and upload one big script: - consistency accross games.  - The order of scripts sometimes matters. - line numbers in errors are the same as the line numbers in the file - local compile reveals syntax bugs  - multiple scripts i use are not in once-click - script to autosize marketplace map assets (hello Gabriel Pickard) needs to be regenerated after  buying a new artset. - some scripts have ’private’ alterations     - my APIheartbeat.js also sends a ping to the console every 30 seconds and logs every event    - altered log statements to include timestamp, function name and line number The current version of my script is 800kb.   But it is not a solution for everyone and only advisable for developer types. 
1620260102
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There are a few scripts I have concatenated versions of for quick-loading into games I create for tests. And I agree with most of the benefits Martijn lists. Two things keep me from having a big ol' script. One Click scripts update themselves to the latest code. I don't have to chase down changes and splice them into the middle of a giant script. Error messages don't always come with line numbers. It's easy to turn off likely culprits until you find an offending script. This would be really difficult with a mega script. I would really like being able to choose the load order, and at least have the ability to copy the base (non-state) code in the duplication process.
I got tired of having to upload scripts in a specific order (I write lots of library code that needs to be loaded first). I wrote a python script that lets me reset my loaded scripts and upload new ones ( roll20.py ). I then wrote a simple script to upload the files in order ( deploy-prod )
@keith One Click scripts update themselves to the latest code -> as any api-scripter i have a local git of the api-script repository, which is updated frequently. The make process takes care of the updated version. Error messages don't always come with line numbers. -> correct , the capability to turn and off sections of the code is a major plus I would really like being able to choose the load order -> In the script page the scripts are concatenated in order of the tabs.... and you can't change the order of the tabs (i tought you could, but you can't).. @slowglass Wow... literally Wow. That apiscript upload script is probably against TOS, but i am going to copy it. I am looking for one other script and thats a method to capture all api-log lines without losing exactly those entries needed to find the bug. My current best way of doing this involves a seperate VM running a browser and some Greasemonkeyed javascripts that dumps each receives log line in a seperate file (lines are later aggregated by a cronjob).
1620317409
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Martijn S. said: @keith One Click scripts update themselves to the latest code -> as any api-scripter i have a local git of the api-script repository, which is updated frequently. The make process takes care of the updated version. Heh, that's above my skill level. :)
1620318865
timmaugh
Pro
API Scripter
Martijn S. said: @keith I would really like being able to choose the load order -> In the script page the scripts are concatenated in order of the tabs.... and you can't change the order of the tabs (i tought you could, but you can't).. You're right that the tabs can't be reordered, but they are *not* guaranteed to be the order in which you install the scripts. I was troubleshooting an issue the other day for someone, and the script tabs would reorder themselves between sandbox restarts. Between the first image, below, and the second, all I did was delete the last installed script (a manual install of splitArgs), and reboot the sandbox. Look at the bottom three rows of installed scripts. Each row is different. In fact, when I put API_Meta offsets into the scripts I could modify to try to track down the error, the script that owned that line was actually listed 3 tabs sooner than the script that reported a line offset less than the error line... In other words, imagine an error reporting as line 5000. The tabs show the scripts ordered like: ___________ ___________ ___________ ___________ ___________ | Script1  |  Script2  |  Script3  |  Script4  |  Script5 | ____| |___________|___________|___________|___________|_____ But when I get the line offset for Script5, it reports as 4000. The script actually throwing the error (and which owns line 5000) is Script2.