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

Macro with small API.

1563823597

Edited 1563825919
So I'm fairly new to macros and api's as a whole, apologies if this is simple or backwards. I have an API called blind roll installed ( <a href="https://app.roll20.net/forum/post/430878/hide-player-dice-roll-from-the-player" rel="nofollow">https://app.roll20.net/forum/post/430878/hide-player-dice-roll-from-the-player</a> ) I've made a macro as a token action "!broll d20 + @{selected|hideclassskill}" Ideally this should send a one way whisper activated by the player when selecting their token/follower to the GM. The roll should be either a skill check for hide, or a d20 plus the skill level.&nbsp; Currently when I activate this token action it consistently returns a one way d20 roll with a fixed modifier of 1. Regardless of the token.&nbsp; Appreciate any help with this, or if I should approach it in a different direction.
1563830879

Edited 1563830908
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I'm not sure which character sheet/system you're using (perhaps 3.X?), but a good troubleshooting step here is to do just @{selected|hideclassskill} &nbsp;in chat with tokens that should have a different skill value to see what is being pulled by that attribute call. From the attribute name and the system I'm assuming you're using, I'm kind of expecting that attribute call to be calling the value of a checkbox for whether or not the skill is a class skill. If that is a toggle for class skill vs not class skill then it would make sense for characters to have a 1 or a 0 in it. You may actually want a different attribute for your use case.
Yes 3.5 apologies for not being clear. I used the variable name of the box and it seems to be the correct one.&nbsp; That said at the bottom of the character sheet there is a "hide macro" that I thought I could cannibalize but it's a bit more complicated than I thought.&nbsp; I'll take a look again when off work.&nbsp; Thanks though for the assistance.&nbsp;
1563941206
Diana P
Pro
Sheet Author
On the 3.5 sheet, the classskill checkbox values consist merely of a 0 or a 1.&nbsp; Can use it to show that that particular skill is a class skill for that character or not.&nbsp; If you want the value of your hide skill, that variable is 'hide'.&nbsp; All the skill variable names can be found by hovering over the total bonus column of the calculation; the one value closest to the skill name.&nbsp; In general it is the skill name without spaces though there are a few exceptions (knowledge skills are for example, knowarcana, knowplanes, etc., the craft skills are craft1, craft2, and craft3, and the profession skills are profession1, profession2, and profession3.)
Thanks Diana.
Update: So I've got "!broll 1d20 + @{Selected|hide}" This works with the API.&nbsp; However I get a monstrous string of text sent to the GM with that. Anything I can do to clean that up? The return string for a +14 hide skill: (To GM)rolling 1d20 + (2 +4 +0 + (ceil(((1*0+1*0)-floor(0.1))/10000000000)*floor(0.1) - floor(((1*0+1*0)-floor(0.1)-1)/10000000000)*(1*0+1*0)) -(floor((2 + 50) / 58) + floor((2 + 50) / 54) + floor((2 + 50) / 52) + floor((2 + 50) / 51) + floor((2 + 50) / 50) + floor((2 + 50) / 49) + floor((2 + 50) / 47) + floor((2 + 50) / 43) -4) * (-4) ) ( 13 ) +(2+4+0+(ceil(((1*0+1*0)-floor(0.1))/10000000000)*floor(0.1)-floor(((1*0+1*0)-floor(0.1)-1)/10000000000)*(1*0+1*0))-(floor((2+50)/58)+floor((2+50)/54)+floor((2+50)/52)+floor((2+50)/51)+floor((2+50)/50)+floor((2+50)/49)+floor((2+50)/47)+floor((2+50)/43)-4)*(-4)) = 27
1564158780
GiGs
Pro
Sheet Author
API Scripter
try putting the roll in inline roll brackets. Depending on how you want it to appear one of these: !broll 1d20 + [[@{Selected|hide}]] or !broll [[1d20 + @{Selected|hide}]] These - especially the second - might not work with broll, it depends exactly what the script is doing with the roll (I havent read the script), but it's worth a try.&nbsp;
Thanks GiGs.&nbsp; I had tried both of those before, tried them again with your suggestion. I tihnk something with the API call is interfering? I get an output of " secret roll sent to GM ($[[0]])".&nbsp; &nbsp; However nothing is actually sent.
1564162615
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, looks like blindroll does not handle inline rolls. That's an odd limitation
1564168284
Diana P
Pro
Sheet Author
its an issue with the brackets; they get stripped out or something.&nbsp; :/&nbsp;&nbsp; My personal version of a broll script looks for the code |[ and ]| and then replaces them with the double brackets, but it requires more manipulation of the rolls I call it with then.&nbsp; (I also have a |{ to sub for &amp;{ so I can use them with roll templates.&nbsp; Kinda wish I knew a way around that, but at least I can get it working.. :) If you are interested: // Blindroll version3 // Make a roll only the GM can see. Only use |[ and ]| for inline rolls! use |{ for &amp;{ at the beginning of a roll template. // Usage: !broll text ((diceroll)) text ((diceroll2)) text // Usage: !broll |{template:default} {{name=@{selected|character_name} }} {{Hide check: |[1d20 + |[@{selected|hide}]| ]| }} on("chat:message", function(msg) { var cmdName = "!broll "; var msgTxt = msg.content; var msgWho = msg.who; var msgFormula = msgTxt.slice(cmdName.length); if(msg.type == "api" &amp;&amp; msgTxt.indexOf(cmdName) !== -1) { sendChat(msgWho, "/w " + msgWho + " secret roll sent to GM "); // sendChat(msgWho, "/w " + msgWho + " secret roll sent to GM (" + msgFormula + ")"); msgFormula=msgFormula.replace(/\|\{/g,"&amp;{"); msgFormula=msgFormula.replace(/\|\[/g,"[["); msgFormula=msgFormula.replace(/\]\|/g,"]]"); sendChat(msgWho, "/w gm " + msgFormula );}; }); ;
1564172264

Edited 1564172347
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Here's a version of the broll snippet that handles inline rolls as well as rolltemplate outputs: var broll = broll || (function() { const handleInput = function(msg_orig){ let msg = _.clone(msg_orig); if(!/^!broll\s+/.test(msg.content)){ return; } msg.content = msg.content.replace(/!broll\s+/,''); msg.content = extractRoll(msg); sendChat(`player|${msg.playerid}`,`/w gm ${msg.rolltemplate ? `&amp;{template:${msg.rolltemplate}}`:''}${msg.content}`); }, extractRoll = function(msg){ return _.chain(msg.inlinerolls) .reduce(function(m,v,k){ m['$[['+k+']]']=v.results.total || 0; return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },msg.content) .value(); }, RegisterEventHandlers = function(){ on('chat:message',handleInput); }; return { RegisterEventHandlers: RegisterEventHandlers }; }()); on("ready",function(){ 'use strict'; log(`broll2 loaded`); broll.RegisterEventHandlers(); }); The script uses a similar syntax, but now you can have an inline roll or a roll template afterwards: !broll /slash command (e.g. !broll /gmroll 1d100); this will also work with whispering to a specific person (e.g. /w Chris [[1d100]]) !broll [[xdy]] !broll &amp;{template:default} {{roll=[[xdy]]}} The latter two command syntaxes will handle any number of rolls (up to the Roll20 maximum number of rolls). You can also combine the slash command and template handling to blind whisper a template to someone specific. Note that the slash command syntax does not work with the /em related commands (e.g. /as, /emas, etc). Diana's will preserve the hoverability of inline rolls which this unfortunately does not do.
Wow guys, more than I could've hoped for thanks so much!