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

Link to Handout using API

1554036036

Edited 1554036144
Rago
Pro
Is there any way to know the link to a handout using an API script? Context:  I have a personal database of treasures and I wrote a desktop software that read the database treasures and output it to an API script and the script, once runs, creates one handout for each Treasure, a Rollable Table and a Macro. When I run the macro, it draws randomly a treasure and shows, on chat, its name. Is there any way, using the API script, to make the macro write the actual link to the treasure's handout instead just its name?
1554036341
The Aaron
Roll20 Production Team
API Scripter
The url is constructable. I don’t remember it off the top of my head, but it’s somethkng like: <a href="http://Roll20.net/handout" rel="nofollow">http://Roll20.net/handout</a> /HANDOUT_ID I’ll look it up and post back.&nbsp;
1554036548

Edited 1554037641
Rago
Pro
Thank. That's the missing part, build the handout url. - As far as I remember, with the url I can build the " [NAME](URL)" pattern to link it on chat. Edit: Following the tip I'll try " <a href="http://journal.roll20.net/handout/&lt;handout.id" rel="nofollow">http://journal.roll20.net/handout/&lt;handout.id</a>&gt; " With "handout" being the return from&nbsp;createObj('handout',.... Edit 2: The link seems to be this one above, but when running from macros the " [NAME](URL)" does not work... (paste on chat the same " [NAME](URL)" &nbsp;works).
1554040431
The Aaron
Roll20 Production Team
API Scripter
Hmm... I just tried it in a macro and it worked. [test](<a href="http://journal.roll20.net/handout/-KxPNKhi9xE_pB7e9BVd" rel="nofollow">http://journal.roll20.net/handout/-KxPNKhi9xE_pB7e9BVd</a>) What does your macro look like?
This is my macro: Drawing a random amulet: [[1t[Amulet]]] And this is the only entry, for testing purposes, on Amulet table: [Water Embodiment](<a href="http://journal.roll20.net/handout/-LbIpU_rhvZkoIR85O-Z" rel="nofollow">http://journal.roll20.net/handout/-LbIpU_rhvZkoIR85O-Z</a>) It seems the the table roll is not subject to interpret the [NAME](URL) as I expected... rolling [[1t[Amulet]]] on chat results in: [Water Embodiment](<a href="http://journal.roll20.net/handout/-LbIpU_rhvZkoIR85O-Z" rel="nofollow">http://journal.roll20.net/handout/-LbIpU_rhvZkoIR85O-Z</a>)
1554052765
The Aaron
Roll20 Production Team
API Scripter
Right.&nbsp; That's not an issue with the macro, it's an issue with Rollable Tables.&nbsp; If you put the roll directly in chat, the result probably doesn't link either: [[1t[Amulet]]] You can use my RecurisveTable script to fix this:&nbsp; <a href="https://app.roll20.net/forum/post/5954076/script-update-recursivetables-now-with-rollable-table-images-and-better-prefixing-rules-for-roll-templates" rel="nofollow">https://app.roll20.net/forum/post/5954076/script-update-recursivetables-now-with-rollable-table-images-and-better-prefixing-rules-for-roll-templates</a> Then just do: !rt Drawing a random amulet: [[1t[Amulet]]]
1554053475

Edited 1554053863
Rago
Pro
I thought RecurisveTable&nbsp;aim was to make a table roll using the result of another table roll, but it fixes that issue with tables too. I have it installed on another session I play but on this one I'm developing a new game and I was instructed not to use another's script&nbsp;&nbsp;if I intent to pack my game for distribution on future.&nbsp;(what makes sense, it would be steal other's work). =\
Ok, I think I solved that - in a very ugly specific way, but it seems to work. I made a small script with a !relink command. On chat:message &nbsp;if it detects !relink at the start it searches for a single table roll... take it's result and replace by its name that is ín the format [LABEL](URL).
1554058835
The Aaron
Roll20 Production Team
API Scripter
That certainly works.&nbsp;&nbsp; If you're hoping to make a Roll20 Module or Addon, you can't really rely on a script, sadly.
1554059566

Edited 1554059603
Rago
Pro
The Aaron said: That certainly works.&nbsp;&nbsp; If you're hoping to make a Roll20 Module or Addon, you can't really rely on a script, sadly. Wait... that sentence may have more than one meaning. Do you meant I can't even rely on my script? (please say my scripts are ok... please say my scripts are ok...)
1554063514
The Aaron
Roll20 Production Team
API Scripter
Modules and Addons can be purchased by any subscription level, but API scripts can only be used by Pro subscribers.&nbsp; Modules and Addons thus cannot rely on API scripts for their functionality.
1554064241

Edited 1554064343
Rago
Pro
i got PRO almost when I meet Roll20, I forgot non-PRO has no access to API scripts...&nbsp; Thanks for the reminder. This is bad, no API means a big limitation since the Rollable Table is simply bad or bugged. (I'm not sure if the behavior or ignoring [LABEL](URL) is expected). Not being able to get the link of a random draw that has a related handout increases the time spend on searching for thing significantly. Maybe I'll have to stick with the PDF book only, that is 90% done. =[
1554064813
The Aaron
Roll20 Production Team
API Scripter
Probably the easiest thing to do would be to output a link to an appropriate alphabetical index handout along with the name.&nbsp; Then at least they can get to it in 2 clicks.&nbsp;
That seems to be a good approach; at least I can show a handout with only link of the same type of the random treasure rolled.