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 Update 5/27: API on all shards, direct chat messages

API on All Shards The API will now work across all of our real-time shards, meaning if there are campaigns that you have that are really old on the Dev Server and you weren't able to use API scripts with them before, it should work fine now. This also paves the way for us to allow use of the API on the main server in addition to the Dev Server, which will go out in the next update (in about a week).&nbsp; NOTE: &nbsp;You may have an error lock on your campaign right now if you were using it while I pushed out this update, if so just re-save the API script to clear it. Direct Chat Formatting There is a new chat command which is only available to the API server (via sendChat()), "/direct &lt;msg&gt;" This is basically a "direct pass-through" of the message content (e.g. it will not be autolinked), and you can also use some HTML tags with inside the message and they will be shown to the players. You can view the full list of HTML tags you can use here:&nbsp; <a href="https://wiki.roll20.net/API:Chat" rel="nofollow">https://wiki.roll20.net/API:Chat</a> Enjoy!
1369713395
Konrad J.
Pro
API Scripter
Wow, I was just wanting some formatting of the chat window! :)
1369713908
Konrad J.
Pro
API Scripter
Yippie, we can change text colour and stuff!!! &nbsp;I don't know HTML, but its a new thing to learn I guess. &nbsp;I just tried this and it worked! sendChat("", '/direct &lt;p style="color:green"&gt;This is a paragraph.&lt;/p&gt;') Thanks RIley, I was going to watch a movie, but now I want to fix up my Edge of Empire Dice Script. :) How would we go about using the &lt;img&gt; tag? &nbsp;Or is that in prep for us to be able to add images to the chat window at a later time?
You just use it like any tag. &lt;img src="<a href="http://path.to/image.png" rel="nofollow">http://path.to/image.png</a>"&gt; You have to host the image yourself someplace, though, right now...or, I suppose, do some fancy element-inspecting to figure out the URL from inside Roll20 for stuff you've uploaded...
1369715166
Konrad J.
Pro
API Scripter
Are you serious, I didn't thikn we could get anything from outside of the sandbox so to speak! &nbsp;You da man. &nbsp;This is getting fancy.
1369716721
Konrad J.
Pro
API Scripter
Ha, it works! &nbsp;I first tried dropbox, that would be the best, but it was just a broken image icon. &nbsp;I'll have to play with it? &nbsp;Then tried flickr, same thing. &nbsp;THen tried some place called tinypic and it worked. &nbsp;Its christmas in May.
1369717611
Konrad J.
Pro
API Scripter
Oh and I found it in roll20! &nbsp;I went to the artlibrary tab and then searched for a token and then inspected the page. &nbsp;I found it and it works. &nbsp;Does this mean anyone could use any art you had in your campaign if you let them see the link? :( <a href="https://s3.amazonaws.com/files.d20.io/images/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</a> (link changed to protect the innocent image) :)
1369720546
Alex L.
Pro
Sheet Author
Thanks Riley, your awesome i have sooooo many plans for this.
1369720547
Konrad J.
Pro
API Scripter
Is it possible to use &lt;div and style z-index to position one image over another? :) &nbsp;I know I'm being greedy. &nbsp;I tried it, but just get broken images. &nbsp;THis would be good for the dice script I'm doing. &nbsp;Otherwise I need an image for ever possible side of seven different dice. :) &nbsp;Well no quite, there are some doubles so its not that bad. &nbsp;I'll go with that for now.
Any chance we are going to get any custom formatting in the other chat commands? I like /direct, it is cool we can use it, but I want to do that formatting in whispers and emotes if possible.
1372397364
Alex L.
Pro
Sheet Author
I would much rather be able to totally format a chat output, as the chat splitting is still getting on my nerves.
Alex L. said: I would much rather be able to totally format a chat output, as the chat splitting is still getting on my nerves. Chat splitting? Nietsnie said: Any chance we are going to get any custom formatting in the other chat commands? I like /direct, it is cool we can use it, but I want to do that formatting in whispers and emotes if possible. I mean, emotes are just pre-formatted chat messages. I would think you could emulate them pretty easily using /direct, right? Whispers are another matter, though, I will consider it.
1372432836
Alex L.
Pro
Sheet Author
Riley D. said: Alex L. said: I would much rather be able to totally format a chat output, as the chat splitting is still getting on my nerves. Chat splitting? Where it splits the chat up by adding a line and the name every n umber of lines. Nietsnie said: Any chance we are going to get any custom formatting in the other chat commands? I like /direct, it is cool we can use it, but I want to do that formatting in whispers and emotes if possible. I mean, emotes are just pre-formatted chat messages. I would think you could emulate them pretty easily using /direct, right? Whispers are another matter, though, I will consider it. Not really as you cant influence the box around your text so you always have the default chat as a border around your /direct.
*posted in wrong thread first time* The /direct always has the As portion, "Name: " attached to its output ... except when left off if they are talking again before anyone else (Thus blending any output that is distinct into the same background with no delineation). An emote always has a clear and distinct border that makes each emote stand out. A /direct just doesn't do that. There is also the RP of following the color coding setup by the client already. If I try to 'emote' something with /direct it doesn't look like an emote. I kinda rambled there but I hope you get my point.