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

Help Me Make a Macro, please?

1546884287

Edited 1546884412
So, I really suck at making macros. But, I'm going to be using a modified rule of Madness, so I'd like to be able to just click a button instead of having to roll on a couple tables. Here's how I'd like it to work. When a player fails their saving throw, I need to roll on the [MadSeverity] table to determine the severity of the madness. The result of the [MadSeverity] table will give either "Short", "Long", or "Perm". Each of those corresponds with one of the other 3 tables I have: [ShortMad], [LongMad], and [PermMad], which are rolled upon depending on the result of the first roll. Is there a way to set up a macro to do all of this with a single click? And output the result? Edit: Oh, and to make it more complicated, each Madness effect has a "Severity" score, so I'd need a pop up window to enter in a number that is added to the roll on the [MadSeverity] table... if possible. Thanks for any help.
1546886170
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I think that the Recursive Tables script by The Aaron might be your friend here.
1546886686

Edited 1546886706
Hrm... nice suggestion... but, I'm a moron. I found this page:&nbsp; <a href="https://github.com/shdwjk/Roll20API/tree/master/RecursiveTable" rel="nofollow">https://github.com/shdwjk/Roll20API/tree/master/RecursiveTable</a> I created a "new script" in the API section and copied the code from the&nbsp;RecursiveTable.js. After that, I'm not sure how to proceed. It looks like I have to add dice roll ranges to the start of each option on the tables?
1546896047
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ah, the edited requirement makes this very difficult indeed. Tables do not accept modifiers, only weighted values. I.e. the frequency and range of results cannot be modified on the fly. Some sample data might help explain exactly what you are trying to accomplish.
To start, I have 4 tables: Severity, Short-Term Madness, Long-Term Madness, and Permanent Madness. When a player fails a Madness Saving Throw, they have to roll on the Severity table. The Severity table is basically 0-60 (Short), 61-90 (Long), and 91-100 (Permanent). The "Severity" score is different for every Madness effect and is added to the Severity d100 roll. That total determines which kind of Madness affects the player. Once this done, another d100 roll is made on the corresponding Madness table, which has about 15 results each, each weighted different (or different parts of the d100). This is the final effect on the player. If tables can't accept modifiers... maybe there's a better way to do this? Or replace the Severity score mechanic with something else? Hmm...
1546903849
Kraynic
Pro
Sheet Author
Would 2 clicks be acceptable?&nbsp; I think it would be possible to write a macro that would roll your percentage and ask for a modifier.&nbsp; Then you could give it a another line or 3 with the explanation of what the different number ranges mean.&nbsp; In place of your short, long, and permanent, insert the Chat Menu button trick. Then you would click the menu button corresponding to the result you got in the first roll.&nbsp; Each of those buttons would call a rollable table for the short, long, or permanent severity.
Yeah, that would probably do it. It's not like the effect is happening all the time.&nbsp;
1546927615
Finderski
Plus
Sheet Author
Compendium Curator
Given that you're pro, you could also use an API script... Here's an example of one I cobbled together for this type of thing... var Fright = Fright || (function() { &nbsp; &nbsp; 'use strict'; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; var version = 0.1, &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; HandleInput = function(msg) { &nbsp; &nbsp; &nbsp; &nbsp; var args,frmod,text='&lt;div style="padding:1px 3px;border: 1px solid #8B4513;background: #460701; color: white; font-size: 80%;"&gt;'; &nbsp; &nbsp; &nbsp; &nbsp; var fright_result,fright_total; &nbsp; &nbsp; &nbsp; &nbsp; var fright_table = [ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'List', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Of', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Effects', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'as', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'many', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'as you', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'like' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]; &nbsp; &nbsp; &nbsp; &nbsp; if (msg.type !== "api") { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; args = msg.content.split(" "); &nbsp; &nbsp; &nbsp; &nbsp; switch(args[0]) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '!fright': &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(args.length &gt; 2 || args.length === 2 &amp;&amp; isNaN(args[1])) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat(msg.who,'Too many or wrong type of input. !fright should have at most one integer.'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frmod = Number(args[1]) || 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //fright_result = Math.floor((Math.random() * 20) + 1); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fright_result = randomInteger(20); //Generates a random number between 1 and 20 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fright_total = fright_result+frmod; //Takes the random number adds the optional modifier to it &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += '&lt;p&gt;&lt;strong&gt;Die Result&lt;/strong&gt;: ' +fright_result+'&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Modifier&lt;/strong&gt;: ' +frmod+ '&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;: ' +fright_total +'&lt;/p&gt;&lt;p&gt;'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Get the Table Result &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (fright_total&lt;5) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += fright_table[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (fright_total&lt;9) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += fright_table[1]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (fright_total&lt;13) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += fright_table[2]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (fright_total&lt;17) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += fright_table[3]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (fright_total&lt;19) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += fright_table[4]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (fright_total&lt;21) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += fright_table[5]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += fright_table[6]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text += '&lt;/p&gt;&lt;/div&gt;' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //sendChat(msg.who,text); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat(msg.who+"- Fright Table",text); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; }, &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; RegisterEventHandlers = function() { &nbsp; &nbsp; &nbsp; &nbsp; on('chat:message', HandleInput); }; return { RegisterEventHandlers: RegisterEventHandlers }; }()); on("ready",function() { &nbsp; &nbsp; 'use strict'; &nbsp; &nbsp; Fright.RegisterEventHandlers(); }); A couple ways to call that would be: !fright !fright 2 !fright -3 The first example is a straight up roll; the second adds two to the result, giving a range of 3-22; the third subtracts 3, giving a range of -2 to 17. The modifier must always be an integer, though and it can take only one modifier in the call.