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

How do I find the API commands

A lot of the API's in the index don't provide details on how to invoke the script or it's uses. I'm not sure what I should be looking for in the script to help determine this. It's a pain to have to search through the forums to find the original thread.
1429205148
Lithl
Pro
Sheet Author
API Scripter
It's unfortunate, but many scripts have been submitted to the GitHub repository with little to no documentation, and the author of the script did not create a wiki page for it to supply documentation. Basically, if you see a script page on the wiki that has a short description, the overview box a small handful of versions in the change log, and the {{stub}} box at the top, it was probably a page I created from someone else's script on the repo. With a couple dozen scripts to go through, I had no desire to read the code and document it thoroughly myself. Your options are basically: Read the code to figure out what commands are available. Mostly thanks to Aaron, a handleInput method is a common sight in scripts these days, which is where you'll find the code parsing messages for API commands. However, not all scripts use that naming scheme, and even the ones that do don't all use the same method for parsing messages. This option requires some understanding of JavaScript. (Also, while Aaron's ubiquitous script writing has pushed scripts in general towards being easier to read, his ubiquitous script writing also makes it difficult to find documentation on his scripts!) Search the API forum for a thread by the script's author. As you've noticed, this can be difficult. Worse, there are some scripts which were simply posted in response to a different thread entirely! Post in the API forum asking for help with a script. The original author may see it and respond, other users who make use of the same script my come to your aid, or someone capable of reading through the script and determining what it does can interpret for you. In any case, it would be extremely helpful to update the script's wiki page once information is gathered, so that another user doesn't have the same problem in the future!
1429205358
The Aaron
Roll20 Production Team
API Scripter
That is definitely a problem. I'm in the middle of rewriting all my scripts to provide a better interface to listing available commands and such (I'll open it up to other developers to use as well, once I'm done writing it!). Most of the problem stems from having moved from a Forum-centric distribution mechanism to the github distribution method. This is an interim change on the way to better thing and we're still catching up with the changes. API scripts are supposed to have a README.md file in github with them that provides a description of their use as well as a wiki page on <a href="https://wiki.roll20.net/API:Script_Index" rel="nofollow">https://wiki.roll20.net/API:Script_Index</a> that gives more details. I am the worst about this as most of mine don't have either yet. For my scripts, almost all of them follow the same pattern. They have a function called handleInputs that as series of case statements for each root command. Almost all of them will display a help to the chat if you execute the root command with no parameters and nothing selected. Almost all of them will do the same if you append --help to the end. When I'm done with my rewrite, they will all do that, and I will have the wiki and README.md created. In the interim, if you have specific scripts you need to know the commands for, feel free to post the names or links to them and I'll be happy to give you my insights.
1429205532
The Aaron
Pro
API Scripter
Certainly, the more scripts you have, the harder it gets to adapt to changes in the way they are distributed. =D maybe I'll just take a week of vacation and fix 'all the things.' =D
1429228178
Ziechael
Forum Champion
Sheet Author
API Scripter
The Aaron said: Certainly, the more scripts you have, the harder it gets to adapt to changes in the way they are distributed. =D maybe I'll just take a week of vacation and fix 'all the things.' =D +1