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

Using a macro to write directly to GM Notes

Many API scripts make use of the GM notes. I would like to use macros to specify certain values for API's which use JSON to determine their effects.

_________________________________
ITS A TRAP SAMPLE JSON SCRIPT
{
"attack": 4,
"damage": "2d8 + 6",
"message": "A pressure plate gives way and darts fire forth from hidden compartments in the walls!",
"notes": "If the character is hit, they also become poisoned.",
"spotDC": 14
}
_________________________________

This needs to be in the GM notes to make the trap go off. You can change these values to alter the effect.

I'd like to have this handled via a series of prompts for ease of use but I'm not certain how I'd get it written to the GM notes automatically.

{
"attack": ?{Set Attack Modifier|},
"damage": "?{Set Damage Dice|}",
"message": "?{Set Message On Trigger|}",
"notes": "?{Set Additional Notes|}",
"spotDC": ?{Set Spot DC|}
}



I got this after entering this macro. This is perfect. How, other than copying and pasting into the GM notes, can I write this directly to the GM notes? Is this even possible?
October 02 (8 years ago)

Edited October 02 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Tokenmod might be able to edit the GM notes of a token: https://app.roll20.net/forum/permalink/1257490/
October 02 (8 years ago)
The Aaron
Pro
API Scripter
(Re: TokenMod -- not yet, but it's on my list of things to add.)

Writing a script to allow this should be pretty easy for someone familiar with the API.  The #1 thing to look at is using {{ }} to denote the multi-line text.
I'm only recently becoming familiar with token mod. I will copy and paste it......for now......like some kind of animal.

I use many of your scripts. Thank you very much for all of your hard work.
October 02 (8 years ago)
The Aaron
Pro
API Scripter
You're welcome!  Now that I've moved (a 6 month hell of packing/painting/everything else) I hope to resume working on API scripts in the next few weeks. =D
November 17 (8 years ago)
I may be able to assist with this. Just curious, where are you getting those JSON blocks?
Probably need to play with the "It's a Trap" API script to familiarize myself with how it works...