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

Two roll templates in the same macro

I've a small issue, I've been working on a two roll templates that compliment each other, however because of the nature of them, I dont think they can run as part of the same template as one section is open for all to read and the other is a whisper to the gm (or in an ideal world a blind whisper to the gm that the player cannot see). Granted this is more a convience thing for myself to show me what modifiers might be in effect. When a skill check is rolled but is still frustrating because I could have sworn I saw an example of something similar one of the character sheets. This is the code I have inside of a textarea input field, that field is the value of the a roll button. &{template:35Adv_check} {{name=@{character_name}'s}} {{check=Aerobatics Check}} {{skill_chk=[[1d20+@{aerobatics}]] }} /w gm &{template:35Adv_dcinfo} {{name=@{character_name}'s}} {{skill_name=Aerobatics Check}} {{skill_dc1=2x (15+CR or HD) }} {{dc_action1=Perform Stunt targeting creature}} }} Once that is run it is supposed to output to the screen but instead I get an error like this: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "g" found. I could have sworn I saw something using Exclamation points (!) as an escape character for a new line. Granted it was a /emas style macro, but still. Any help would be appreciated.
1430101774
The Aaron
Roll20 Production Team
API Scripter
If you separate the roll templates, do they work fine on their own? Also, if the second is not whispered does it work? Could you retry this with the default template just to be sure there isn't something else going wrong?
Separating them they work fine, When they are brought together they do not function. Whispered, emoted un-prefixed doesnt matter the second one always fails. My guess is that it has to do with how 'things' are sequenced. In a textarea there are no multi-lines. No matter how many newlines you add it does nothing. It does work when I add it to an ability macro and a global macro. But I don't want that, I want it to run from the character sheet it self. (Or if I eventually find that I cant do that, from an API embeded button in the roll template.) No, I cant try this with the default template, it is specifically designed to run with the templates I have created. I wouldn't even know where to begin to get it to work with the default template.
1430104414
The Aaron
Roll20 Production Team
API Scripter
Just thinking out loud here, does it work if there is some text in between?
1430105816

Edited 1430106099
Toby
Pro
No change. Finished after going 6 levels deep. app.js?1429809847:40 Begin processing op! app.js?1429809847:40 [[1d20+(floor((50 + 0 + 0 + 0 + 0) / 2) - 5)+0+0+(0*-10+0*0)+0 [Armor check Penalty]]] app.js?1429809847:40 1d20+(floor((50 + 0 + 0 + 0 + 0) / 2) - 5)+0+0+(0*-10+0*0)+0 [Armor check Penalty] app.js?1429809847:40 Levels deep: 0 app.js?1429809847:40 &{template:35Adv_check} {{name=Jonny Test's}} {{check=Aerobatics Check}} {{skill_chk=$[[0]] }} app.js?1429809847:40 &{template:35Adv_check} {{name=Jonny Test's}} {{check=Aerobatics Check}} {{skill_chk=$[[0]] }} app.js?1429809847:40 Begin processing op! app.js?1429809847:40 . app.js?1429809847:40 . app.js?1429809847:40 Inline rolls complete! app.js?1429809847:40 Begin processing op! app.js?1429809847:40 /w gm &{template:35Adv_dcinfo} {{name=Jonny Test's}} {{skill_name=Aerobatics Check}} {{skill_dc1=2x (15+CR or HD) }} {{dc_action1=Perform Stunt targeting creature}} }}]] app.js?1429809847:40 gm &{template:35Adv_dcinfo} {{name=Jonny Test's}} {{skill_name=Aerobatics Check}} {{skill_dc1=2x (15+CR or HD) }} {{dc_action1=Perform Stunt targeting creature}} }} app.js?1429809847:39 d20.DicePEG.result.SyntaxError {name: "SyntaxError", expected: Array[13], found: "g", message: "Expected "(", ".", "[", "abs(", "ceil(", "d", "flo… "t", "{", [ |\t], [+|\-] or [0-9] but "g" found.", offset: 0…}column: 1expected: Array[13]0: ""(""1: "".""2: ""[""3: ""abs(""4: ""ceil(""5: ""d""6: ""floor(""7: ""round(""8: ""t""9: ""{""10: "[ |\t]"11: "[+|\-]"12: "[0-9]"length: 13__proto__: Array[0]add: function (e,t){return(!wi(li(t))||isNaN(t))&&(t=this.length),ri.prototype.splice.apply(this,[t,0].concat(e)),this}all: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}any: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}at: function (){return D(this,arguments)}average: function (e){return e=e?this.map(e):this,0<e.length?e.sum()/e.length:0}clone: function (){return w([],this)}compact: function (e){var t=[];return K(this,function(i){xi(i)?t.push(i.compact()):e&&i?t.push(i):e||null==i||i.valueOf()!==i.valueOf()||t.push(i)}),t}concat: function concat() { [native code] }constructor: function Array() { [native code] }count: function (e){return p(e)?this.length:this.findAll(e).length}each: function (e,t,i){return K(this,e,t,i),this}entries: function entries() { [native code] }every: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}exclude: function (){return ri.prototype.remove.apply(this.clone(),arguments)}filter: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}find: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}findAll: function (e,t,i){var n,r=[];return 0<this.length&&(n=q(e),K(this,function(e,t,i){n(e,t,i)&&r.push(e)},t,i)),r}findFrom: function (e,t,i){return J(this,e,t,i)}findIndex: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}findIndexFrom: function (e,t,i){return t=J(this,e,t,i,!0),p(t)?-1:t}first: function (e){return p(e)?this[0]:(0>e&&(e=0),this.slice(0,e))}flatten: function (e){return tt(this,e)}forEach: function forEach() { [native code] }from: function (e){return this.slice(e)}groupBy: function (e,t){var i,n=this,r={};return K(n,function(t,o){i=Y(t,e,n,[t,o,n]),r[i]||(r[i]=[]),r[i].push(t)}),t&&y(r,t),r}inGroups: function (e,t){var i=1<arguments.length,n=this,r=[],o=Mi(this.length/e);return b(e,function(e){e*=o;var a=n.slice(e,e+o);i&&a.length<o&&b(o-a.length,function(){a=a.add(t)}),r.push(a)}),r}inGroupsOf: function (e,t){var i,n=[],r=this.length,o=this;return 0===r||0===e?o:(p(e)&&(e=1),p(t)&&(t=null),b(Mi(r/e),function(r){for(i=o.slice(e*r,e*r+e);i.length<e;)i.push(t);n.push(i)}),n)}include: function (e,t){return this.clone().add(e,t)}indexOf: function indexOf() { [native code] }insert: function (e,t){return(!wi(li(t))||isNaN(t))&&(t=this.length),ri.prototype.splice.apply(this,[t,0].concat(e)),this}intersect: function (){return et(this,it(arguments),!1)}isEmpty: function (){return 0==this.compact().length}join: function join() { [native code] }keys: function keys() { [native code] }last: function (e){return p(e)?this[this.length-1]:this.slice(0>this.length-e?0:this.length-e)}lastIndexOf: function lastIndexOf() { [native code] }least: function (e,t){return ot(this.groupBy.apply(this,[e]),"length","min",t)}length: 0map: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}max: function (e,t){return ot(this,e,"max",t)}min: function (e,t){return ot(this,e,"min",t)}most: function (e,t){return ot(this.groupBy.apply(this,[e]),"length","max",t)}none: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}pop: function pop() { [native code] }push: function push() { [native code] }randomize: function (){for(var e,t,i=this.concat(),n=i.length;n;)e=ci.random()*n|0,t=i[--n],i[n]=i[e],i[e]=t;return i}reduce: function reduce() { [native code] }reduceRight: function reduceRight() { [native code] }remove: function (){var e=this;return c(arguments,function(t){var i=0;for(t=q(t);i<e.length;)t(e[i],i,e)?e.splice(i,1):i++}),e}removeAt: function (e,t){return p(e)?this:(p(t)&&(t=e),this.splice(e,t-e+1),this)}reverse: function reverse() { [native code] }sample: function (e){var t=this.randomize();return 0<arguments.length?t.slice(0,e):t[0]}shift: function shift() { [native code] }slice: function slice() { [native code] }some: function (){return i.apply(this,arguments)?t.apply(this,arguments):e.apply(this,arguments)}sort: function sort() { [native code] }sortBy: function (e,t){var i=this.clone();return i.sort(function(n,r){var o,a;return o=Y(n,e,i,[n]),a=Y(r,e,i,[r]),(Ei(o)&&Ei(a)?at(o,a):a>o?-1:o>a?1:0)*(t?-1:1)}),i}splice: function splice() { [native code] }subtract: function (){return et(this,it(arguments),!0)}sum: function (e){return e=e?this.map(e):this,0<e.length?e.reduce(function(e,t){return e+t}):0}to: function (e){return p(e)&&(e=this.length),this.slice(0,e)}toLocaleString: function toLocaleString() { [native code] }toString: function toString() { [native code] }union: function (){return Q(this.concat(it(arguments)))}unique: function (e){return Q(this,e)}unshift: function unshift() { [native code] }zip: function (){var e=c(arguments);return this.map(function(t,i){return[t].concat(e.map(function(e){return i in e?e[i]:null}))})}Symbol(Symbol.iterator): function ArrayValues() { [native code] }Symbol(Symbol.unscopables): Object__proto__: Objectfound: "g"line: 1message: "Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "g" found."name: "SyntaxError"offset: 0__proto__: dconstructor: function Error() { [native code] }message: ""name: "Error"toString: function toString() { [native code] }__proto__: Object app.js?1429809847:35 CLICKED app.js?1429809847:40 Finished -JnsvvqlHGLj4cnoK4vN for index 0 app.js?1429809847:40 Finished 0 app.js?1429809847:40 Levels deep: 0 app.js?1429809847:40 &{template:35Adv_check} {{name=Jonny Test's}} {{check=Aerobatics Check}} {{skill_chk=$[[0]] }} app.js?1429809847:40 Inline rolls complete! app.js?1429809847:43 window resize I think the issue or solution or reason it doesnt work is in these two bolded lines. On the second of two it is listed as "..... gm &{template:35Adv_dcinfo} {{name=Jonny Test's}} {{skill_name=Aerobatics Check}} ......." The code I have has it prefaced by a forward slash in the macro. I have tried to add a second foward slash, and I cant quite recall the escape character for forward slash to try that but I dont think it will work as double // didnt work.
1430106770
The Aaron
Roll20 Production Team
API Scripter
/ is /, if that's what you mean. Pribably a good question for the Character Sheets forum.
Would you like me to re-post this question there or do you want to move it?
1430108022
The Aaron
Roll20 Production Team
API Scripter
I can just move it for you.
Thanks. If you want to take a look at my character sheet I'm working, I hope to add it to the list soon. Its a bit clunky but I like to have everything at my fingertips. So performance is secondary for me, so long as things don't take forever to execute :P Anyways, hopefully I'll have this cleared soon.
1430125992
Finderski
Plus
Sheet Author
Compendium Curator
So, I've experimented with this a little bit and the problem is that a roll button's value is all on a single line. When I put this in as an ability roll (i.e. personal character macro) with a blank line separating the two roll template calls have no issues, even when whispering one of them. So, I then experimented briefly on my character sheet with a hidden text area field with a blank line separating the two template calls and a button with the value qual to the text area's name and the had no problems with calling the two templates in one call. The code I used was: <textarea style="display: none;" name="attr_tMeleeWeapontest">/w gm &{template:spadestrait2} <other template fields as needed> &{template:soliddamage} <other template fields as needed></textarea> <button type='roll' name='roll_tMeleeWeapontest' value='@{tMeleeWeapontest}'></button> I experimented with <br /> and even \n and those didn't work; I had to actually hard return in the html code inside the <textarea> tags to get the blank lines between to the two templates, and that worked. Hope this helps.
1430126472
Kryx
Pro
Sheet Author
API Scripter
My post on the topic: <a href="https://app.roll20.net/forum/post/1793729/show-cer" rel="nofollow">https://app.roll20.net/forum/post/1793729/show-cer</a>... Same thing as GV posted: use line breaks. I believe you can also use \n (line break) instead of line breaks.
1430128105
Finderski
Plus
Sheet Author
Compendium Curator
\n didn't work for me, but I will admit, I may have been doing something wrong. :)
1430137929

Edited 1430138607
Toby
Pro
G V. said: So, I've experimented with this a little bit and the problem is that a roll button's value is all on a single line. When I put this in as an ability roll (i.e. personal character macro) with a blank line separating the two roll template calls have no issues, even when whispering one of them. So, I then experimented briefly on my character sheet with a hidden text area field with a blank line separating the two template calls and a button with the value qual to the text area's name and the had no problems with calling the two templates in one call. The code I used was: &lt;textarea style="display: none;" name="attr_tMeleeWeapontest"&gt;/w gm &{template:spadestrait2} &lt;other template fields as needed&gt; &{template:soliddamage} &lt;other template fields as needed&gt;&lt;/textarea&gt; &lt;button type='roll' name='roll_tMeleeWeapontest' value='@{tMeleeWeapontest}'&gt;&lt;/button&gt; I experimented with &lt;br /&gt; and even \n and those didn't work; I had to actually hard return in the html code inside the &lt;textarea&gt; tags to get the blank lines between to the two templates, and that worked. Hope this helps. I only see one &lt;/textarea&gt; closing tag. So.. I'm not sure how this works. I'll keep trying but for the last half an hour I've not been able to do much with this example. Edit: Sorry for the sudden edit. I didn't really understand the code above. So I took what you said about a &lt;type="hidden"&gt; variable and this is what I got: &lt;input type="hidden" name="attr_newline" value="& nbsp;"&gt; &lt;textarea&gt; /w gm &{template:35Adv_check} {{name=@{character_name}'s}} {{check=Aerobatics Check}} {{skill_chk=[[1d20+@{aerobatics}]] }}@{newline} /w gm &{template:35Adv_check} {{name=@{character_name}'s}} {{check=Aerobatics Check}} {{skill_chk=[[1d20+@{aerobatics}]] }} &lt;/textarea&gt; And it seems to work.... P.S, for some reason it wont let me copy and paste code into this, it just shows up as a big rounded-edge black rectangle.
I thought I should show the general result of the all of this here. This combined roll template works off the skill check roll executing two different chat commands. and two different roll templates. The first one is open to everyone to see, the second however is only between the person rolling and the GM (or alternatively a !bwhisper could probably be used I haven't tested it). I used style="position: relative; top: -10px;" to shift the second roll template's display up to cover the chat text (To: xxxx), and it will probably also cover a timestamp as well, however I dont see that as an issue as this roll template is designed NEVER to be used interdependently. Only issue is the lower selection of blank space under. Unfortunately, I know of no way to remove that and dont honestly care one way or another. This can probably be adapted to work with any check that might possibly have a conditional. Some GM's might not need it, but I find it handy to have everything at my fingertips when a player makes a check. I would love to change the background chat color so the top and bottom match but I've not figured out how to do that as its on a different level of css and occurs before "sheet-" is added. Though, if a person can change the style for inline rolls I bet this is possible as well.