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 add the GURPS roll parser API output to a tempate

1499695606

Edited 1499695804
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Ok so far I have with some help managed to get a roll template cobbled together for GURPS character sheet. I am also running the GURPS Roll parser API script. What I want to do is have the API report in the roll template. See code below <rolltemplate> <table> <tr> <th colspan="4">{{name}}</th> </tr> <tr> <td><b>Roll:</b></td><td><span><div></div>{{roll}}</span></td><td>vs: {{target}}</span></td> </tr> </table> </rolltemplate> Any help or suggestions are greatly appreciated.
1499706313
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The API can't modify already sent chat messages. What you can do is change your roll parser to parse a message sent via api command and then you would change the sheet to output the rolls like this: !GURPS &{template:GURPStemplatedeclaration} {{Template fields and such}} So, since it's sent as an API command, it never shows up in chat, the script would then add a template field for the success/failure and output the modified message to chat. However, do you really need an API script to determine the success failure of this? I am not familiar with GURPs, but it looks like you're just trying to roll under a target number, perhaps with increased success for being further under it?
1499709592
Lithl
Pro
Sheet Author
API Scripter
Scott C. said: However, do you really need an API script to determine the success failure of this? I am not familiar with GURPs, but it looks like you're just trying to roll under a target number, perhaps with increased success for being further under it? I believe GURPS has you rolling multiple dice and you're comparing the total  to a target number, rather than comparing each die to the target.
1499710350
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
I think everyone is missing the point of the question. The API sends to chat "Success by 10" How do I get that success chat message into the rolltemplate?
1499711431

Edited 1499711440
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
See my post above: Scott C. said: The API can't modify already sent chat messages. What you can do is change your roll parser to parse a message sent via api command and then you would change the sheet to output the rolls like this: !GURPS &{template:GURPStemplatedeclaration} {{Template fields and such}} So, since it's sent as an API command, it never shows up in chat, the script would then add a template field for the success/failure and output the modified message to chat. So, put another way, you would have to have the entire message sent from the API for the API's calculation of success to be included in the roll template.
1499712128
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
So I would be modifying the json??
1499712957
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
No, you'd be modifying the API script, so the javascript code.
1499714127
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
the .js file.....that requires more knowledge than I have. Drat
1499714975
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You could post a message in the thread for the GURPS API parser and see if the author would be willing to add the feature. I don't actually know if there is a thread for that script, but if not you could post a thread in the API forum asking if the author or someone else would be willing to modify it. I'd offer to do it, but I'm already swamped between work and my other API projects.
1499719358
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Appreciate the advice...I am going to try to use rolltemplate helpers and see what that can do.