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

I need some help with the Text/Worker script

1525641234
Leon X.
Plus
Sheet Author
Hello, I need a little bit of help with the Text/Worker script! I am a bit new to this script let alone HTML in general. Anyway it is written out like this, <script type="text/worker"> on("change:affinity1", function () { getAttrs(["affinity1"], function (values) { //initialize variables let affinity1 = values.affinity1; let damagesupportmod1 = 0; let defensesupportmod1 = 0; let hitsupportmod1 = 0; let critsupportmod1 = 0; let avosupportmod1 = 0; let critavosupportmod1 = 0; // depending on affinity value, change other stats values. switch (affinity1) { case "Fire1": damagesupportmod1 = 0.5; defensesupportmod1 = 0; hitsupportmod1 = 2.5; avosupportmod1 = 2.5; critsupportmod1 = 2.5; critavosupportmod1 = 0; break; case "Ice1": damagesupportmod1 = 0; defensesupportmod1 = 0.5; hitsupportmod1 = 2.5; avosupportmod1 = 2.5; critsupportmod1 = 0; critavosupportmod1 = 2.5; break; case "Wind1": damagesupportmod1 = 0.5; defensesupportmod1 = 0; hitsupportmod1 = 2.5; avosupportmod1 = 0; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Thunder1": damagesupportmod1 = 0; defensesupportmod1 = 0.5; hitsupportmod1 = 2.5; avosupportmod1 = 0; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Earth1": damagesupportmod1 = 0; defensesupportmod1 = 0.5; hitsupportmod1 = 0; avosupportmod1 = 2.5; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Dark1": damagesupportmod1 = 0; defensesupportmod1 = 0; hitsupportmod1 = 0.5; avosupportmod1 = 2.5; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Light1": damagesupportmod1 = 0.5; defensesupportmod1 = 0.5; hitsupportmod1 = 2.5; avosupportmod1 = 0; critsupportmod1 = 2.5; critavosupportmod1 = 0; break; case "Anima1": damagesupportmod1 = 0.5; defensesupportmod1 = 0.5; hitsupportmod1 = 0; avosupportmod1 = 2.5; critsupportmod1 = 0; critavosupportmod1 = 2.5; break; } setAttrs({ "damagesupportmod1": damagesupportmod1, "defensesupportmod1": defensesupportmod1, "hitsupportmod1": hitsupportmod1, "avosupportmod1": avosupportmod1, "critsupportmod1": critsupportmod1, "critavosupportmod1": critavosupportmod1 } }); }); </script> Then I made a <select prompt </div> </div> </div> <div/> <select name="attr_affinity1" size="1"> <option name="attr_Fire1">Fire</option> <option name="attr_Ice1">Ice</option> <option name="attr_Wind1">Wind</option> <option name="attr_Thunder1">Thunder</option> <option name="attr_Earth1">Earth</option> <option name="attr_Dark1">Dark</option> <option name="attr_Light1">Light</option> <option name="attr_Anima1">Anima</option> </div> Then I have the formula... {{The foe takes= [[@{strength}+@{might1} + ?{Weapon Triangle|None, 0|Advantage, 1| Disadvantage, -1} + (@{damagesupportmod1}*@{supportrank1}*@{supportnext1})]] dmg}} The error message is that it has no idea what the @{damagesupportmod1}. Any help would be appreciated. The rest of everything is accounted for just can't figure out how to make this work. Thanks!
1525647848

Edited 1525647892
Be sure that your HTML has an attribute for damagesupportmod1. This can be a hidden input in your HTML (<input type="hidden" name="attr_damagesupportmod1" value="0">) but it needs to be defined for the Sheetworker to affect it.
1525647876

Edited 1525650223
GiGs
Pro
Sheet Author
API Scripter
You have an error in the brackets in the script.  It ends like this: setAttrs({ "damagesupportmod1": damagesupportmod1, "defensesupportmod1": defensesupportmod1, "hitsupportmod1": hitsupportmod1, "avosupportmod1": avosupportmod1, "critsupportmod1": critsupportmod1, "critavosupportmod1": critavosupportmod1 } // <--- here is the error }); }); That bracket in bold should be the same as the two following: }); Also, as Rabulias says, you need to define those attributes in the html, too.
1525658444
Leon X.
Plus
Sheet Author
Now it thinks everything is 0... I really don't understand any of this. If it's too hard to help with like this it's all good ^^;
1525661277
GiGs
Pro
Sheet Author
API Scripter
There's another error in your code, the select drop down: <select name="attr_affinity1" size="1"> <option value="Fire1">Fire</option> <option value="Ice1">Ice</option> <option value="Wind1">Wind</option> <option value="Thunder1">Thunder</option> <option value="Earth1">Earth</option> <option value="Dark1">Dark</option> <option value="Light1">Light</option> <option value="Anima1">Anima</option> </select> You shouldn't have the attr_ at the start of each of the option names, and they are values, not names. Also, you were missing the </select>.
1525662379
Leon X.
Plus
Sheet Author
Thank you but It still doesn't seem to be working. Just want to double check to see if everything *should* work before i give. ;3; </div> <div/> <select name="attr_affinity1" size="1"> <option value="Fire1">Fire</option> <option value="Ice1">Ice</option> <option value="Wind1">Wind</option> <option value="Thunder1">Thunder</option> <option value="Earth1">Earth</option> <option value="Dark1">Dark</option> <option value="Light1">Light</option> <option value="Anima1">Anima</option> </select> </div> </div> </div> </div> <input type="hidden" name="attr_damagesupportmod1" value="0"> <input type="hidden" name="attr_defensesupportmod1" value="0"> <input type="hidden" name="attr_hitsupportmod1" value="0"> <input type="hidden" name="attr_avosupportmod1" value="0"> <input type="hidden" name="attr_critsupportmod1" value="0"> <input type="hidden" name="attr_critavosupportmod1" value="0"> </div> </div> </div> This is at the end <script type="text/worker"> on("change:affinity1", function () { getAttrs(["affinity1"], function (values) { //initialize variables let affinity1 = values.affinity1; let damagesupportmod1 = 0, let defensesupportmod1 = 0, let hitsupportmod1 = 0, let critsupportmod1 = 0, let avosupportmod1 = 0, let critavosupportmod1 = 0; // depending on affinity value, change other stats values. switch (affinity1) { case "Fire1": damagesupportmod1 = 0.5; defensesupportmod1 = 0; hitsupportmod1 = 2.5; avosupportmod1 = 2.5; critsupportmod1 = 2.5; critavosupportmod1 = 0; break; case "Ice1": damagesupportmod1 = 0; defensesupportmod1 = 0.5; hitsupportmod1 = 2.5; avosupportmod1 = 2.5; critsupportmod1 = 0; critavosupportmod1 = 2.5; break; case "Wind1": damagesupportmod1 = 0.5; defensesupportmod1 = 0; hitsupportmod1 = 2.5; avosupportmod1 = 0; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Thunder1": damagesupportmod1 = 0; defensesupportmod1 = 0.5; hitsupportmod1 = 2.5; avosupportmod1 = 0; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Earth1": damagesupportmod1 = 0; defensesupportmod1 = 0.5; hitsupportmod1 = 0; avosupportmod1 = 2.5; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Dark1": damagesupportmod1 = 0; defensesupportmod1 = 0; hitsupportmod1 = 0.5; avosupportmod1 = 2.5; critsupportmod1 = 2.5; critavosupportmod1 = 2.5; break; case "Light1": damagesupportmod1 = 0.5; defensesupportmod1 = 0.5; hitsupportmod1 = 2.5; avosupportmod1 = 0; critsupportmod1 = 2.5; critavosupportmod1 = 0; break; case "Anima1": damagesupportmod1 = 0.5; defensesupportmod1 = 0.5; hitsupportmod1 = 0; avosupportmod1 = 2.5; critsupportmod1 = 0; critavosupportmod1 = 2.5; break; } setAttrs({ "damagesupportmod1": damagesupportmod1, "defensesupportmod1": defensesupportmod1, "hitsupportmod1": hitsupportmod1, "avosupportmod1": avosupportmod1, "critsupportmod1": critsupportmod1, "critavosupportmod1": critavosupportmod1 }); }); }); </script> This is the roll {{The foe takes= [[@{strength}+@{might1} + ?{Weapon Triangle|None, 0|Advantage, 1| Disadvantage, -1} + (@{damagesupportmod1}*@{supportrank1}*@{supportnext1})]] dmg}}
1525663068

Edited 1525663128
GiGs
Pro
Sheet Author
API Scripter
I just noticed the roll is inside {{ }}'s. Is it in a rolltemplate? If not, you can remove the outer {{ and }} Your html also seems to have a lot of &lt;/divs&gt; that don't seem necessary, but they shouldnt be affecting the roll. Can you share the entire html file, on <a href="https://pastebin.com/" rel="nofollow">https://pastebin.com/</a> , paste the link here, and I'll have a quick look at it later.
1525663938
Leon X.
Plus
Sheet Author
<a href="https://pastebin.com/iPUMXW9n" rel="nofollow">https://pastebin.com/iPUMXW9n</a> Thank you ;w;
1525669619

Edited 1525669647
GiGs
Pro
Sheet Author
API Scripter
I've tested the script, and it's working. You have way too many &lt;/divs, a lot of select fields that lack &lt;/select&gt; tags with redundant name= statements (you only need name= on the select line; each of the option lines should only have value=, and not name=). Those things need fixing, but the script itself is working. What exactly was the problem you were having? What wasn't working, and what was happening? All i can think of without further information is the roll: Can you describe what it supposed to do? [[@{strength}+@{might1} + ?{Weapon Triangle|None, 0|Advantage, 1| Disadvantage, -1} + (@{damagesupportmod1}*@{supportrank1}*@{supportnext1})]] It looks like a bunch of flat numbers that are added together, there's no actual roll here.&nbsp;
1525682623
Jakob
Sheet Author
API Scripter
Rabulias said: Be sure that your HTML has an attribute for damagesupportmod1. This can be a hidden input in your HTML (&lt;input type="hidden" name="attr_damagesupportmod1" value="0"&gt;) but it needs to be defined for the Sheetworker to affect it. This is not &nbsp;correct. Setting attributes without defined inputs works just fine — with the caveat that the default value of those attribute will of course be undefined before they have been set by a worker script, which may not be desirable.
1525705836

Edited 1525706308
Leon X.
Plus
Sheet Author
In fire emblem damage is not rolled, it is a flat number which is subtracted by the opponent's defense or res to get total dmg. I know as you said before, video games are weird =w= If you select Fire for example the math should be strength+weapon strength +weapon advantage+ (.5*supportlevel*are you next to them) but instead it always thinks .5 is 0 Dropping the value="0" seems to make it just do strength. Writing value="" makes the formula mad at me and removing the whole thingy&nbsp;gives me "No attribute was found for @{Astra|damagesupportmod1}"&nbsp; If this thing is impossible it's fine&nbsp;
1525708355

Edited 1525708411
GiGs
Pro
Sheet Author
API Scripter
It's not impossible. But mastering html, css, and javascript is hard, and if you want to complete the sheet, you'll have to get used to dealing with frustration. There'll be a lot more of it before you're finished. The reason that comes out as 0, is because you are multiplying three numbers, two of which are often 0.&nbsp; Have you checked that the supportnext and supportrank are set at something other than 0? Supportnext1 needs to be Yes, and supportRank1 needs to be something other than "None", otherwise that formula will always be zero.&nbsp; If it's not giving you expected results, you need to fix the syntax of those two select boxes. Look at the affinity select, and how it ends with an &lt;/select&gt; tag - your other selects don't. Also notice how it only has one name= statement, on the &lt;select&gt; line, not on the name lines. Correct the other two select boxes, and if the roll formula is accurate, it should work. You do have a lot of those incomplete select boxes throughout your sheet, btw. You'll need to fix them. Also, soooo many redundant &lt;/divs&gt;
1525709109

Edited 1525719058
Leon X.
Plus
Sheet Author
I know it's redundant&nbsp;but still. And don't worry I wrote it like that on purpose but here is what I'm looking at... Strength of 13 plus basic weapon being 7. Ignoring weapon advantage cuz that's done. The last&nbsp;part is +(0*4*1) where 4 is support level, 1 is cuz I'm&nbsp;next to them. The only thing missing is the .5. Are you having this problem when you do this on the sheet? None of the other parts are giving me problems. Everything else works. I am just using the&nbsp;damagesupportmod1 to test the water. It should work given what you all have suggested. I am really not sure what I'm doing wrong. Do I need something extra in API? I don't think there is a typo. Does it have something to do with setting the value to equal 0? Does the code have a grudge&nbsp;against me? Is there something wrong with the &lt;select? Should I have put out the other values the hitsupport1, avosupport1 etc?
1525729128
GiGs
Pro
Sheet Author
API Scripter
It works for me, here's a screenshot with Fire affinity selected (only damages filled in, dont worry about the 0's): Have you corrected the select dropdowns and the script?&nbsp;This is what that last section of your sheet should look like: &lt;div class="sheet-col-1-6" /&gt; &lt;select name="attr_supportnext1" size="1"&gt; &nbsp; &nbsp; &lt;option value="0"&gt;No&lt;/option&gt; &nbsp; &nbsp; &lt;option value="1"&gt;Yes&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- close inner modal div --&gt; &lt;/div&gt; &lt;div class="sheet-col-1-2"&gt; &nbsp; &nbsp; &lt;input type="text" name="attr_support1" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="sheet-col-1-6" /&gt; &lt;select name="attr_affinity1" size="1"&gt; &nbsp; &nbsp; &lt;option value="Fire1"&gt;Fire&lt;/option&gt; &nbsp; &nbsp; &lt;option value="Ice1"&gt;Ice&lt;/option&gt; &nbsp; &nbsp; &lt;option value="Wind1"&gt;Wind&lt;/option&gt; &nbsp; &nbsp; &lt;option value="Thunder1"&gt;Thunder&lt;/option&gt; &nbsp; &nbsp; &lt;option value="Earth1"&gt;Earth&lt;/option&gt; &nbsp; &nbsp; &lt;option value="Dark1"&gt;Dark&lt;/option&gt; &nbsp; &nbsp; &lt;option value="Light1"&gt;Light&lt;/option&gt; &nbsp; &nbsp; &lt;option value="Anima1"&gt;Anima&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;input type="hidden" name="attr_damagesupportmod1" value="0"&gt; &lt;input type="hidden" name="attr_defensesupportmod1" value="0"&gt; &lt;input type="hidden" name="attr_hitsupportmod1" value="0"&gt; &lt;input type="hidden" name="attr_avosupportmod1" value="0"&gt; &lt;input type="hidden" name="attr_critsupportmod1" value="0"&gt; &lt;input type="hidden" name="attr_critavosupportmod1" value="0"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="sheet-col-1-7" /&gt; &lt;select name="attr_supportrank1" size="1"&gt; &nbsp; &nbsp; &lt;option value="0"&gt;None&lt;/option&gt; &nbsp; &nbsp; &lt;option value="1"&gt;C&lt;/option&gt; &nbsp; &nbsp; &lt;option value="2"&gt;B&lt;/option&gt; &nbsp; &nbsp; &lt;option value="3"&gt;A&lt;/option&gt; &nbsp; &nbsp; &lt;option value="4"&gt;S&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;script type="text/worker"&gt; &nbsp; &nbsp; on("change:affinity1", function () { &nbsp; &nbsp; &nbsp; &nbsp; getAttrs(["affinity1"], function (values) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let affinity1 = values.affinity1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let damagesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let defensesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let hitsupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let critsupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let avosupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let critavosupportmod1 = 0; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (affinity1) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Fire1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Ice1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Wind1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Thunder1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Earth1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Dark1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Light1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case "Anima1": &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; damagesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defensesupportmod1 = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitsupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critsupportmod1 = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; critavosupportmod1 = 2.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setAttrs({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "damagesupportmod1": damagesupportmod1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "defensesupportmod1": defensesupportmod1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "hitsupportmod1": hitsupportmod1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "avosupportmod1": avosupportmod1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "critsupportmod1": critsupportmod1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "critavosupportmod1": critavosupportmod1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; }); &lt;/script&gt;
1525730913

Edited 1525731179
Leon X.
Plus
Sheet Author
Froths at mouth I copied and pasted that and it still won't do .5 Can only "Sheet Authors" do this? and you did nothing to the api? You didn't change anything besides that?
1525731900

Edited 1525731912
GiGs
Pro
Sheet Author
API Scripter
Yes, no other changes.&nbsp; To test again, I just now copied the sheet from pastebin and pasted it in to custom sheet, and replaced the text at the end with that i posted above. Reloaded the campaign, and clicked the attack button and got the same result as above. If you've tweaked the sheet since you posted to pastebin, maybe you have altered something that is interfering. oh... here's an idea: in the affinity button, change to something other than fire, then change back to Fire. If you haven't changed the affinity, the sheetworker might not have run. (There's a way to fix this, but let's see if its the problem first.)
1525732484
Leon X.
Plus
Sheet Author
@,w,@ thank you i changed it to purple in the code then changed it back then changed the thingy 3 times and it started to work... Sorry this has been so confusing, you are my hero
1525733413
GiGs
Pro
Sheet Author
API Scripter
You're welcome! To avoid this glitch in future, change the first line of the script from on("change:affinity1", function () { to&nbsp; on("sheet:opened change:affinity1", function () { This will force the script to run each time the character sheet is first opened, so you dont have to manually change the select to get it to work.