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

API Workflow Question

How are peeps working on their API scripts out there? I write in a text editor called Brackets. When I have a change (AKA new way to break things) I select all, and copy. Then I switch to the roll20.net API window, select all and paste. Then jump to roll20 VTT window to test and see what broke. And then return to brackets ..... Is this the only way I know how to do it. I am wondering if there is a more efficient way to be doing this. Thanks
1450666796
The Aaron
Pro
API Scripter
I edit my scripts in Vim and run them through JSLint to check for syntax and related errors.  Then I copy them up to the Roll20 API to debug and test them.  Rinse, Repeat.  Pretty similar workflow to yours, all things considered.
1450667652
Gen Kitty
Forum Champion
I use Notepad++ for my scripting and Powercard work, with a workflow similar to yours and Aaron's.
Pretty much the same here: two browser windows (one to the VTT, one to the API page, positioned so that the API console can be seen when the VTT is in the foreground) and a code editor (I usually use the editor from the MULTI IDE, though Brackets and Notepad++ are reasonably good, and Caret is pretty solid if you're on ChromeOS).
I could not think of anyway to reduce it further. Thanks for the info! But using VIM! Woot. Linting has left an opening for a new question which I will put in place a new post.(how do you manage fatal linting errors for API functions that lint does not recognize).
1450727253

Edited 1450727265
The Aaron
Pro
API Scripter
I'm using the following linting command: jslint4java --white --maxerr 10000 --nomen --plusplus --predef on,_,playerIsGM,state,sendChat,findObjs,filterObjs,getObj,createObj,Campaign,toBack,toFront,randomInteger,isGM,getAttrByName,setInterval,clearInterval,console,setAttrs,getAttrs,getSectionIDs $@ 2>&1 | sed 's/^jslint://' In my case, I'm on a Mac (or Commercial *nix, as I like to think of it...) so have powerful command line semantics to do some filtering post execution.  The important takeaway is the --predef list of functions and objects to assume are defined elsewhere.  So using on(), playerIsGM(), etc will be fine.  (I leave log() out of the list intentionally as I generally want to be aware of where I have those). Reducing it further would likely require some clever use of cURL to push the changes into the API tab when you save the script, or possibly an extension for Chrome/FF that could watch local files and post them on the page on change.  For me, I have a command in Vim to copy the current buffer into the clipboard to make it easy to put it in the API tab.  I've not gone further than that. =D
1450787727
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
VTT in one tab.... API editor in another.... edit...save...error... half-hearted google for the answer... that failing skype Aaron or bribe manveti (don't tell Aaron I have bribed manveti... Aaron still helps me for free*) *I know Aaron can read this but I feel this is covered under "player knowledge" usage restrictions and cannot be used against me.
1450793130
The Aaron
Pro
API Scripter
Ha!  No worries, I extract value in all the time and money I save not going to stand up to fill my comedy quota! 
Woah! Slightly more elaborate than my /*jshint -W032 */ hahahaha. I poured over the jshint and jslint to look for a way to keep the linter from having a "too many errors" conniption. --predef was the switch I needed. Presently not using a linux machine (OpenSuSE usually). Thanks so much for this The Aaron. Maybe you don't need to attend stand up comedy because our questions keep you amused? 
1450892625
Lithl
Pro
Sheet Author
API Scripter
Like Stephen, I do my API work directly in the interface. It might have fewer tools than an IDE, but I have experience writing JS in Notepad, and at least Roll20's interface has collapsible sections. =) It helps that I've got two monitors on my desktop, so I have the two tabs side by side.
Dearest The Aaron, The predef switch for jshint has proved wonderfully useful. It allows me to actually catch errors using the linter before I run the code. Which, besides trying to make me cry, is the point of linting one's code.  Thanks so much. 
1451538298
The Aaron
Pro
API Scripter
No problem! I'm here to help!