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

ammo problem

1591180687

Edited 1591180794
hello, i am using Ammo v0.3.10. i have this basic text worker: <script type="text/worker"> //test     on("change:ChargeItem_test sheet:opened", function()      {          getAttrs(["ChargeItem_test"], function(values)          {                 let Charge =  parseInt(values.ChargeItem_test,10)||0;                 console.log("---IN---");                 console.log(Charge);                 if(Charge<=0)                 {                     console.log("---0000<-----");                     console.log(Charge);                    }              });     }); when i manually increase / decrease  ChargeItem_test the worker fires. when i use the command "!ammo @{selected|character_id} ChargeItem_test -1 arrow" it wont. i had the same problem with ChatSetAttr help please! thank you!
1591182014

Edited 1591182029
GiGs
Pro
Sheet Author
API Scripter
Scripts by default dont trigger sheet workers. chatSetAttrs uses a version of the function that should  trigger sheet workers, but I have had cases where it doesnt work. I have no idea about ammo. But what are you trying to achieve here? Chances are whatever you are doing, you can do with the script instead of relying on a sheet worker to detect the script.
1591188896

Edited 1591188952
hello,  thank you for replying.  what i am trying to do is. i have magic items with charges ( the attribute "ChargeItem_test") when the charges are 0 the item continue to work but instead the user looses points from an other attribute called "energy". i dont know how to use the api to make this. i was using the sheet worker to use its "if, then". That i cant use in a script. thank you! :) can you provide me a simple api for the above?