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

If I could ask for just one upgrade from the Dev Team...

... it would be a better API output console. Specifically: upon getting the error message "Unexpected token"... why can it not tell me the line number? Or even which particular script is throwing the error? Thank you.
1406750547
Lithl
Pro
Sheet Author
API Scripter
Because you haven't actually written several separate scripts, you've written one long script and just don't know it.
Ah, but it would be trivial to translate the compound line number to the input line number; or, worst case, spit out the combined line number and let the user figure out which it is. True, the scripts are combined, but they are combined linearly, so finding which script is the culprit just requires subtracting the number of lines in each script from the error line number until you find the script where the number of lines is greater than the modified number.
1406816999
Lithl
Pro
Sheet Author
API Scripter
I'm not actually certain that the ordering of the script tabs once combined is deterministic. If not, then what you suggest would be impossible. It's also likely that the error messages are being generated by Firebase, which does not have access to Roll20's script tabs for reference.
It could always output the entire line of sourcecode where the problem was encountered, and let us search for it. Something, ANYTHING to go on, other than "oops you have one too many parenthesis... somewhere". Don't mean to start a full-on rant, though, just needed to vent for a second. ; )
1406827606
The Aaron
Roll20 Production Team
API Scripter
I looked into writing a bookmarklet that would figure out where the error actually is. Looks like the order is determinate, but not obvious. To avoid as many silly errors as possible, I've adopted the following development process: Write script in external editor ( Vim for me, YMMV! ) Run script through JSLint ( I use these options: --white --maxerr 10000 --nomen --plusplus --predef on,_,state,sendChat,findObjs,getObj ) If there were errors from 2, fix errors them and go back to 2. Paste script into Roll20. Fiddle with testing on Roll20 via log(), sendChat(), running commands, etc. Back port understanding to external editor, return to 1 This process generally takes care of the missing parenthesis, typo'd variable names, etc. It also allows me to use an editor that has more then 27 lines and powerful editing capabilities ( Vim! =D )
1406829599
Lithl
Pro
Sheet Author
API Scripter
Roll20 built-in editor >>> Vim. There, I said it! =P
1406829708
The Aaron
Roll20 Production Team
API Scripter
Ha! I can only hope that with age comes wisdom... =D
1406831464
Lithl
Pro
Sheet Author
API Scripter
Vim is just vi with some bells and whistles attached, and we all know that vi is the editor of the beast (VI-VI-VI being 6-6-6, of course). But even Emacs doesn't compare to the much better modern text editors. And no, I will not get off your lawn. Your tire swing is the best in the neighborhood. Whee~!
1406832513
The Aaron
Roll20 Production Team
API Scripter
=D They are very NICE bells and whistles. And vi itself is very powerful. It's major problem is it's steep learning curve. Read the top answer to this SO question and tell me you still think it's an outmoded editor that doesn't compare to modern text editors. =D <a href="http://stackoverflow.com/questions/1218390/what-is" rel="nofollow">http://stackoverflow.com/questions/1218390/what-is</a>...
Awesome! I will definitely be checking out JSLint, thank you! &lt;3
1406833467
The Aaron
Roll20 Production Team
API Scripter
Yup! If you haven't read it, I highly recommend Javascript: The Good Parts by Douglas Crockford. Fantastic book. I HATED Javascript before I read that, and didn't understand certain aspects of the language the way I should have. Now I feel quite comfortable with it. It's a fast read and well setup.
1406834864
Lithl
Pro
Sheet Author
API Scripter
Aaron said: =D They are very NICE bells and whistles. And vi itself is very powerful. It's major problem is it's steep learning curve. Read the top answer to this SO question and tell me you still think it's an outmoded editor that doesn't compare to modern text editors. =D <a href="http://stackoverflow.com/questions/1218390/what-is" rel="nofollow">http://stackoverflow.com/questions/1218390/what-is</a>... It's an outmoded editor that doesn't compare to modern text editors. Learning how to use vi/m is only slightly easier than writing Brainfuck code or performing a code review on something written in Whitespace. Features such as intellisense, code snippets, templates, autocompletion, etc. are all available in modern editors without requiring the user to learn a cryptic series of keystrokes that only relate to the action being performed if you look at them cross-eyed and stand on your head. I'd rather jump straight in to doing my job than spend months (or more!) learning how to use the IDE. And yes, I have used vim, and emacs, and nano as well. They are not enjoyable to use, although I will certainly admit that they're superior to something like Notepad for the purpose of writing code. (I mostly use nano when I need to perform touch-ups to files on my server, but I'm damn glad I've got means to upload files, because I'd never get anything done otherwise.)
1406835564

Edited 1406835653
The Aaron
Roll20 Production Team
API Scripter
=D To each his own, I suppose. I'm certainly no stranger to Visual Studio ( Some VS stuff ), but I still prefer Vim for editing pretty much any text. Probably because I already know those "cryptic" keystrokes. =D