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

new to the mod script

1673616979

Edited 1673617010
Is there a way to create UI instead of using chat commands. I need to create a UI that allows me to fetch data from an API where the gm enters the API key and User Name then it displays the data. I tried using document but it appear we don't have access to document so is there a way in the API to do this or does it all have to be done through a chat message? 
1673619812
GiGs
Pro
Sheet Author
API Scripter
Roll20 has us heavily locked down - we cant change the UI / way the system operates in any way. Yes, we don't have access to document. Chat messages are the only way to interact with Roll20, but you an create macros to automate that to some degree (including with queries). It might be possible to do what you need, using existing tools, but you'd have to describe exactly what it is you are trying to achieve.
1673620083
The Aaron
Roll20 Production Team
API Scripter
The API cannot create UI elements, it does not exist in the client's browser, but on the API server in the cloud.  It can only change the state of the game.  It does that by creating, manipulating, and removing game objects.  The closest you could come to a traditional UI would be creating a specifically formatted Handout object.  However, you wouldn't be able to take advantage of any of the things you would need to make it work for gathering data.  This is why we use chat menus with buttons and Roll Queries for user interface generally. That aside, the API runs in a sandbox and does not have access to anything other than the game state via game objects.  It cannot connect to external services, or use external resources.  The closest you could get to something like that would be to create an API script that acts as the backend interface to a browser-based extension that handles connecting to external services and channeling data back and forth.  That's not something that can be supported by Roll20, though there are examples of community members doing just this for things like updating Twitch streams and such.
1673620336

Edited 1673620745
Thank you both, I do not think I want to write a whole chrome extension to do this so I will be telling the users that it's not as easy as I was hoping. 
1673620444
The Aaron
Roll20 Production Team
API Scripter
What problem are you trying to solve?  We're pretty crafty... =D
I have an external API of data that I need to import into roll20 as handouts. I would make a call to an API to get users campaigns. they would then choose which campaign. I would then get all the data for that particular campaign.. display it to them so they can choose which "articles" they want to import into handouts. I made a really nice module for foundry vtt and a few users asked if I could make a similar product for roll20. I told them that I would look into it. I think I have used roll20 maybe 10 times so I am not heavy user.
1673707446
Pat
Pro
API Scripter
Not sure about the import, but I've had some luck creating an interface out of handouts themselves... you can look at emojibubble for an example of this in practice, with part of the interface visible to users of the handout, part of it exclusive to the GM.