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 to put attr_NamedItem @{NamedItem} into a

I have the following line at the top of my CS <label>Level</label><input type="number" name="attr_level" class='sheet-short' value="1"/> and <input type="text" name='attr_rrbase_will' class="transparent" class='sheet-short' value="0"> Later on in the CS is the following <button type="action" name="act_roll">RR</button> <script type="text/worker">   const extractQueryResult = async function(query){     let queryRoll = await startRoll(`!{{query=[[0[response=?{${query}}]]]}}`);     finishRoll(queryRoll.rollId);     return queryRoll.results.query.expression.replace(/^.+?response=|\]$/g,'');   };   const initiateRoll = async function(event){//Async tag here to allow us to await the various rolls that we're going to do.     let queryResult = await extractQueryResult('Attack Ranks|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30');     let queryResult2 = await extractQueryResult('Defense Ranks|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30'); I want to add the following: let queryResult3 = @{level}; let queryResult4 = @{rrbase_will}; ====================================== but when I do that the script crashes, how do I get values from the CS into a <script>  section of the sheet and assigned to variables in the <script> section? any help will be appreciated 
1648703056
vÍnce
Pro
Sheet Author
Hi Carl, You'll need to use some roll20-specefic functions such as getAttrs to pull attribute data. <a href="https://wiki.roll20.net/Sheet_Worker_Scripts" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts</a>
&lt;script type="text/worker"&gt; &nbsp; const extractQueryResult = async function(query){ &nbsp; &nbsp; let queryRoll = await startRoll(`!{{query=[[0[response=?{${query}}]]]}}`); &nbsp; &nbsp; finishRoll(queryRoll.rollId); &nbsp; &nbsp; return queryRoll.results.query.expression.replace(/^.+?response=|\]$/g,''); &nbsp; }; &nbsp; const initiateRoll = async function(event){//Async tag here to allow us to await the various rolls that we're going to do. &nbsp; &nbsp; let queryResult = await extractQueryResult('Attack Ranks|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30'); &nbsp; &nbsp; let queryResult2 = await extractQueryResult('Defense Ranks|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30'); //So I could just add this line to the &lt;script&gt; and it would give me the ability to assign an attr to a variable in the script? getAttrs(["level"], function(values) {let queryResult3 = level;});
1648707267
vÍnce
Pro
Sheet Author
Is this CRP( custom roll parsing )? I believe you need to include whatever you want to do to the attributes within the scope of getAttrs, but I'm not the person to be giving js advice. ;-)
1648719338

Edited 1648719410
GiGs
Pro
Sheet Author
API Scripter
Can you describe what you goal is, how should the roll work? Don't describe in terms of script, describe in english language what you want to happen. We can tell you the best approach to achieve that. It looks like there might be a fundamental misunderstanding of how javascript works on roll20, but we can't clear that up without knowing the details.
GiGs said: Can you describe what you goal is, how should the roll work? Don't describe in terms of script, describe in english language what you want to happen. We can tell you the best approach to achieve that. It looks like there might be a fundamental misunderstanding of how javascript works on roll20, but we can't clear that up without knowing the details. Thanks Gigs. This is a character sheet that I have been working on for a Rolemaster game I run on roll20. Part of the system is resistance rolls (saving throws) that are applied against a chart.&nbsp; I have worked out the chart as a 2 dimensional array comparing the attacking level to the defending level which gives the base roll needed to save.&nbsp; for example, attacker lvl 1, defender lvl 1, need to roll 50+ to save; attacker lvl 1, defender lvl 2, need to roll a 45+ to save. (the ratios change as the levels go up). there are 2 modifiers that get added to this roll, one is the defenders stat bonus (which is an attr on the CS) the other is a value that is applied based on the attackers roll (so needs to be an inputed value after the button is pushed). right now the button push asks for input of both the attackers level and the defenders level and looks at the 2 dimensional array to pull in the save value from the chart. what I want to do is pull in the level (attr_level) from the character sheet as the defenders level. And have the attackers level be an input value to compare to the array. AND pull in the RR modifier (attr_rrsavebonus) from the character sheet to use in the math of the 1d100 die roll. And have the attackers modifier be an input value to use as a modifier to the roll. I have figured out how to do the four values as inputs in the &lt;script&gt; but that seems silly when 2 of the values are in the character sheet. The last part of this is that there are 7 of these &lt;scripts&gt; to do, one for each saving through type so I need to make sure that the system does not confuse one button push with another when creating the scripts. If I could figure out how to pass a value to a function and rewrite the entire script so that I only need one function and can pass the attr_level and specify which of the 7 attr_rrsavevalues based on button push that would be better.&nbsp;
oh, as a note, the foundation of the script sample above was written by someone else on the community forums. even though I am a programmer (well was 30 years ago in fortran, cobol, basic, pascal and c++, now i just dabble in html coding on my personal web site), I don't know javascript and the roll20 language is a bit confusing to me right now.&nbsp; I am trying to learn javascript now in online classes, but have not found any training courses on how to manipulate the roll20 coding.
1648790033
GiGs
Pro
Sheet Author
API Scripter
What you're asking for can be done,but it looks like you are struggling to build the function based on advice from other websites - and that advice won't work on roll20. If the % chance can be calculated with a simple forumla, you can do this with&nbsp; a simple roll button. Otherwise it'll have to be Custom Roll Parsing. You are correct that you can grab the values from the character sheet, you don't need to pass them as parameters for the function. If I'm understanding your needs properly, you don't need getAttrs. Though there's still not enough information to show you how to do it. Here's what I think you are doing: get attacker's level, which is a manual input get defender's level from character sheet Compare those values on a table to get a % value as target for the roll. Get a bonus from the attacker to this roll (presumably this is applied as a penalty?) Get a RR bonus from defender, which depends on save type and will be an attribute on the sheet Make the roll, and save whether it succeeds or fails. Report attacker name, defender name, what save was being made, target %, and whether it was a success or fail So necessary questions: What does the table look like? Does it follow a simple progression (e.g. base 50% +/- 5% per level difference) What are the various save names and their linked attributes? is step 4 accurate? Otherwise what bonus where you referring to for the attacker? Do you want to collect the attacker values by query (in which you'll need to query for each individually), or will attacker be linked to a token? If so, the defender can simply select the target token when the button is clicked, and collect all necessary values automatically. With all that detail, we can build the function/button sheet workers.
Thanks again for your help with this Gigs here is the code I am working with now &lt;button type="action" name="act_roll"&gt;RR&lt;/button&gt; &lt;script type="text/worker"&gt; &nbsp; const extractQueryResult = async function(query){ &nbsp; &nbsp; let queryRoll = await startRoll(`!{{query=[[0[response=?{${query}}]]]}}`); &nbsp; &nbsp; finishRoll(queryRoll.rollId); &nbsp; &nbsp; return queryRoll.results.query.expression.replace(/^.+?response=|\]$/g,''); &nbsp; }; &nbsp; const initiateRoll = async function(event){//Async tag here to allow us to await the various rolls that we're going to do. &nbsp; &nbsp; let queryResult = ${level};&nbsp; //await extractQueryResult('Attack Ranks|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30');//Await the asynchronous startRoll &nbsp; &nbsp; let queryResult2 = await extractQueryResult('Defense Ranks|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30');//Await the asynchronous startRoll const resultSwitchArray =[ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], [1,50,55,60,65,70,73,76,79,82,85,87,89,91,93,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110], [2,45,50,55,60,65,68,71,74,77,80,82,84,86,88,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105], [3,40,45,50,55,60,63,66,69,72,75,77,79,81,83,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100], [4,35,40,45,50,55,58,61,64,67,70,72,74,76,78,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95], [5,30,35,40,45,50,53,56,59,62,65,67,69,71,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90], [6,27,32,37,42,47,50,53,56,59,62,64,66,68,70,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87], [7,24,29,34,39,44,47,50,53,56,59,61,63,65,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84], [8,21,26,31,36,41,44,47,50,53,56,58,60,62,64,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81], [9,18,23,28,33,38,41,44,47,50,53,55,57,59,61,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78], [10,15,20,25,30,35,38,41,44,47,50,52,54,56,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75], [11,13,18,23,28,33,36,39,42,45,48,50,52,54,56,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73], [12,11,16,21,26,31,34,37,40,43,46,48,50,52,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71], [13,9,14,19,24,29,32,35,38,41,44,46,48,50,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69], [14,7,12,17,22,27,30,33,36,39,42,44,46,48,50,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67], [15,5,10,15,20,25,28,31,34,37,40,42,44,46,48,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65], [16,4,9,14,19,24,27,30,33,36,39,41,43,45,47,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64], [17,3,8,13,18,23,26,29,32,35,38,40,42,44,46,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63], [18,2,7,12,17,22,25,28,31,34,37,39,41,43,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62], [19,1,6,11,16,21,24,27,30,33,36,38,40,42,44,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61], [20,0,5,10,15,20,23,26,29,32,35,37,39,41,43,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60], [21,-1,4,9,14,19,22,25,28,31,34,36,38,40,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59], [22,-2,3,8,13,18,21,24,27,30,33,35,37,39,41,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58], [23,-3,2,7,12,17,20,23,26,29,32,34,36,38,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57], [24,-4,1,6,11,16,19,22,25,28,31,33,35,37,39,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56], [25,-5,0,5,10,15,18,21,24,27,30,32,34,36,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55], [26,-6,-1,4,9,14,17,20,23,26,29,31,33,35,37,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54], [27,-7,-2,3,8,13,16,19,22,25,28,30,32,34,36,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53], [28,-8,-3,2,7,12,15,18,21,24,27,29,31,33,35,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52], [29,-9,-4,1,6,11,14,17,20,23,26,28,30,32,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51], [30,-10,-5,0,5,10,13,16,19,22,25,27,29,31,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50], ];&nbsp; &nbsp;&nbsp; let mod = resultSwitchArray[queryResult][queryResult2]; &nbsp; &nbsp; let output = `&amp;{template:default} {{name=Demo Output}} {{d100=[[d100 - ${mod}[Mod]]]}}` &nbsp; &nbsp; let finalRoll = await startRoll(output); &nbsp; &nbsp; finishRoll(finalRoll.rollId); &nbsp; }; &nbsp; on('clicked:roll',initiateRoll); &lt;/script&gt; ========================= number 4 is correct, but it needs to be an ADD to the total roll as based on the roll the attacker makes, the save could get a bonus to save. (you can see the Attackers save adjustment in the Base Spell Attack Table below) number 6 so yes the result should be:&nbsp; RESULT = Defenders d100 + Defenders RRBonus - value from array + Attackers Modifier number 7 just needs to report (log) the name of the save and the result (as the actual value is important in some cases not just if they saved. for instance some spell effects are things like "blind for 1 rnd/5% failure") I want to have the Button push trigger asking the defender to enter the attackers Level and Save adjustment. as I am not assigning any stats to tokens. Here is the Attackers bonus chart and RR (saving throw) chart As a note, I reversed the values in the Array to the chart as I was also working up another use for the table.&nbsp; so in the Array the attackers level is in the vertical column and defender the horizontal. Here is a sample of one of the buttons in the CS now (where it just rolls and adds the bonus then I manually check the chart) button type='roll' name='roll_testattack' value='&amp;{template:custom} {{title=^{rrarcanecheck}}} {{^{result}=[[1d100!&gt;96cs&gt;96cf&lt;5 + @{rrtotal_arcane}]]}}'&gt;&lt;/button&gt; Here are the values from the CS for the save bonuses (these are calculated from stat modifiers, racial modifiers and special bonuses so would be the only value that would need to be sent to the formula. attr_rrtotal_arcane attr_rrtotal_essence attr_rrtotal_channeling attr_rrtotal_mentalism attr_rrtotal_psionics attr_rrtotal_poison attr_rrtotal_disease *as a side note, once i get this CS set to where I am happy with it I would like to get it uploaded to the roll20 collection so that a friend of mine who is also running a rolemaster game can use it as he does not have a Pro account to load the code into the editor. thanks again
1648872457

Edited 1648872968
GiGs
Pro
Sheet Author
API Scripter
Will you have a different button for each save? If so, they'll need a unique name for each. What are those names? Also, a precautionary check: are the values for the saving throws (e.g. attr_rrtotal_psionics) calculated via autocalc (inputs that are disabled=true)? autocalcs dont work with scripts. By the way you can remove that table with these two lines (tested): const level_modifier = level =&gt; level &lt;= 5 ? ( level * 5 - 5 ) : level &lt;= 10 ? ( level * 3 + 5 ) : level &lt;= 15 ? ( level * 2 + 15 ) : level + 30 ; const chance = ( attacker , defender ) =&gt; 50 + level_modifier ( attacker ) - level_modifier ( defender ); and then call chance with the attacker and defender level, and it will return the base %. (You might need to swap attacker and defender order.)
1648874391

Edited 1648874406
GiGs
Pro
Sheet Author
API Scripter
It just occurred to me, that if you use startRoll and finishRoll, you'll need to make your own rollTemplate to show the output. It can be done with the default roll template, but it shows all the input values in the output, and you;ll need to use a roll something like this: ` &amp;{template:default} {{name=@{character_name rolls ${ save_name } Save}}} {{diceroll=[[1d100]]}} {{defence_level=[[@{level}]]}} {{attack_level= [[?{Attack Ranks|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30}]]}} {{defend_bonus=[[ ${ save_value } ]]}} {{attack_bonus=[[?{Attack Bonus|0}]]}} Line breaks inserted for clarity. Do you have a custom rollteplate?
GiGs said: Will you have a different button for each save? If so, they'll need a unique name for each. What are those names? Also, a precautionary check: are the values for the saving throws (e.g. attr_rrtotal_psionics) calculated via autocalc (inputs that are disabled=true)? autocalcs dont work with scripts. By the way you can remove that table with these two lines (tested): const level_modifier = level =&gt; level &lt;= 5 ? ( level * 5 - 5 ) : level &lt;= 10 ? ( level * 3 + 5 ) : level &lt;= 15 ? ( level * 2 + 15 ) : level + 30 ; const chance = ( attacker , defender ) =&gt; 50 + level_modifier ( attacker ) - level_modifier ( defender ); and then call chance with the attacker and defender level, and it will return the base %. (You might need to swap attacker and defender order.) You have it right Attacker - Defender great job on the 'level_modifier' I was hoping there was a way to calculate it in java, I just could not figure it out. so the Attacker value will be a input value how does the Defender value pull in the attr_level from the character sheet? and the math will now be: result =&nbsp; Chance + rrmodifier + attacker input value + 1d100!&gt;96cs&gt;96cf&lt;5 here is a sample of the Button code that is already in the sheet &lt;button type='roll' name='roll_testattack' value='&amp;{template:custom} {{title=^{rrdiseasecheck}}} {{^{result}=[[1d100!&gt;96cs&gt;96cf&lt;5 + @{rrtotal_disease}]]}}'&gt;&lt;/button&gt; so if the 'title' section is what you are referring to for the names then I am calling them all "rrXXXXXcheck" rrarcanecheck rressencecheck rrchannelingcheck rrmentalismcheck rrdiseasecheck rrpoisoncheck rrpsionicscheck ======
1648878352

Edited 1648878722
GiGs
Pro
Sheet Author
API Scripter
If you don't have a rolltemplate, here's a fiendishly complex roll that prompts you for save type, attacker level, attacker bonus, and makes the roll. /roll&nbsp; 1d100!&gt;96cs&gt;96cf&lt;5 + 50 + ?{Save| Arcane,@{rrtotal_arcane}| Essence,@{rrtotal_essence}| Channeling,@{rrtotal_channeling}| Mentalism,@{rrtotal_mentalism}| Psionics,@{rrtotal_psionics}| Poison,@{rrtotal_poison}| Disease,@{rrtotal_disease} } + [[{@{level},5}kl1 *5 + {[[{0,@{level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,@{level}-10}kh1]],5}kl1}]]&nbsp; +{0,@{level}-15}kh1]]&nbsp; - [[{ ?{Attacker level|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30} ,5}kl1 *5 + {[[{0,?{Attacker level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,?{Attacker level}-10}kh1]],5}kl1}]]&nbsp; +{0,?{Attacker level}-15}kh1]] + ?{Attacker Bonus|0} If you want this to appear in a rolltemplate, you can use &amp;{default:template} {{name=@{character_name}}} {{Result= [[&nbsp; 1d100!&gt;96cs&gt;96cf&lt;5 + [[50 + ?{Save| Arcane,@{rrtotal_arcane}| Essence,@{rrtotal_essence}| Channeling,@{rrtotal_channeling}| Mentalism,@{rrtotal_mentalism}| Psionics,@{rrtotal_psionics}| Poison,@{rrtotal_poison}| Disease,@{rrtotal_disease} } + [[{@{level},5}kl1 *5 + {[[{0,@{level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,@{level}-10}kh1]],5}kl1}]]&nbsp; +{0,@{level}-15}kh1]]&nbsp; - [[{ ?{Attacker level|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30} ,5}kl1 *5 + {[[{0,?{Attacker level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,?{Attacker level}-10}kh1]],5}kl1}]]&nbsp; +{0,?{Attacker level}-15}kh1]] + ?{Attacker Bonus|0}]] ]] }} If you want the save type hardcoded, you can use &amp;{default:template} {{name=@{character_name} makes Arcane Save}} {{Result= [[ 1d100!&gt;96cs&gt;96cf&lt;5 +[[50 + @{rrtotal_arcane} + [[{@{level},5}kl1 *5 + {[[{0,@{level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,@{level}-10}kh1]],5}kl1}]]&nbsp; +{0,@{level}-15}kh1]]&nbsp; - [[{ ?{Attacker level|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30} ,5}kl1 *5 + {[[{0,?{Attacker level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,?{Attacker level}-10}kh1]],5}kl1}]]&nbsp; +{0,?{Attacker level}-15}kh1]] + ?{Attacker Bonus|0}]] ]] }} Chose change the two mentions of arcane to the relevant save. You can include these in button values, as long as they are type="roll". For example: &lt;button type="roll" name="roll_arcanesave" value="&amp;{default:template} {{name=@{character_name} makes Arcane Save}} {{Result= [[ 1d100!&gt;96cs&gt;96cf&lt;5 +[[50 + @{rrtotal_arcane} + [[{@{level},5}kl1 *5 + {[[{0,@{level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,@{level}-10}kh1]],5}kl1}]]&nbsp; +{0,@{level}-15}kh1]]&nbsp; - [[{ ?{Attacker level|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30} ,5}kl1 *5 + {[[{0,?{Attacker level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,?{Attacker level}-10}kh1]],5}kl1}]]&nbsp; +{0,?{Attacker level}-15}kh1]] + ?{Attacker Bonus|0}]] ]] }}"&gt;&lt;/button&gt; Some roll expert (Ziechael) might be able to make this part more elegant: [[{@{level},5}kl1 *5 + {[[{0,@{level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,@{level}-10}kh1]],5}kl1}]]&nbsp; +{0,@{level}-15}kh1]]&nbsp; and likewise for attacker_level. The roll will report 1 for success, and 0 for failure. If you want to show the target and the roll separately, you could do this: &amp;{default:template} {{name=@{character_name} Rolls a Save}} {{Arcane Target= [[50 + @{rrtotal_arcane} + [[{@{level},5}kl1 *5 + {[[{0,@{level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,@{level}-10}kh1]],5}kl1}]]&nbsp; +{0,@{level}-15}kh1]]&nbsp; - [[{ ?{Attacker level|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30} ,5}kl1 *5 + {[[{0,?{Attacker level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,?{Attacker level}-10}kh1]],5}kl1}]]&nbsp; +{0,?{Attacker level}-15}kh1]] + ?{Attacker Bonus|0}]] ]]}} {{Roll=[[ 1d100!&gt;96cs&gt;96cf&lt;5]]}} Do you still need to go the startRoll + rolltemplate route?
1648878489

Edited 1648878746
GiGs
Pro
Sheet Author
API Scripter
Before I answer your last post, have a look at my last post. In any of those example syou can substitite your roll 1d100!&gt;96cs&gt;96cf&lt;5 And I didnt realise with was a simple plus, instead of a vs target - that simplifies the code a bit. I've gone through and replaced the rolls in my previous post.
1648878572

Edited 1648878781
GiGs
Pro
Sheet Author
API Scripter
Note: buttons using startRoll must be type="action" name="act_whatever" - it doesnt work with roll buttons. All the ones I just posted work with roll buttons.
and I realized I did not address your second line question.&nbsp; Here is the code for each of the RR fields on the CS &lt;tr&gt; &lt;td&gt; &nbsp; &lt;label&gt;Essence&lt;/label&gt; &lt;/td&gt; &lt;td&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type="text" name='attr_rrbase_essence' class="transparent" class='sheet-short' value="0"&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="text" name='attr_rrmisc_essence' class="transparent" class='sheet-short' value="0"&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="text" name='attr_rrtotal_essence' value="(@{rrbase_essence}+@{rrmisc_essence})" disabled="true" class='sheet-short'&gt; &lt;/td&gt; &lt;td&gt; &lt;button type='roll' name='roll_testattack' value='&amp;{template:custom} {{title=^{rressencecheck}}} {{^{result}=[[1d100!&gt;96cs&gt;96cf&lt;5 + @{rrtotal_essence}]]}}'&gt;&lt;/button&gt; &lt;/td&gt; &lt;/tr&gt;
the input level with the options of 1 to 30 were because I limited the array to 30 rows and 30 columns, but ultimately it could be a 50th level character attacking a 5th level character so I can do this with the button for each of the saves? &lt;button type="roll" name="roll_arcanesave" value="&amp;{default:template} {{name=@{character_name} makes Arcane Save}} {{Result= [[ 1d100!&gt;96cs&gt;96cf&lt;5 +[[50 + @{rrtotal_arcane} + [[{@{level},5}kl1 *5 + {[[{0,@{level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,@{level}-10}kh1]],5}kl1}]]&nbsp; +{0,@{level}-15}kh1]]&nbsp; - [[{ ?{Attacker level|0} ,5}kl1 *5 + {[[{0,?{Attacker level}-5}kh1]],5}kl1 *3 + [[2 * {[[{0,?{Attacker level}-10}kh1]],5}kl1}]]&nbsp; +{0,?{Attacker level}-15}kh1]] + ?{Attacker Bonus|0}]] ]] }}"&gt;&lt;/button&gt; very cool! thanks for all your help Gigs, this is helping me also understand the process a bit more
1648882522

Edited 1648883525
GiGs
Pro
Sheet Author
API Scripter
Yes, you should be able to do that each save, and it'll work for whatever levels are chosen - they aren't limited to 30.
GiGs said: Yes, you should be able to do that each save, and it'll work for whatever levels are chosen - they aren't limited to 30. WOW GiGs YOU ROCK, Thanks so much for your help!!!
1648974667
GiGs
Pro
Sheet Author
API Scripter
aww, hehe, thanks :)