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 .
×
May your rolls be chill this holiday season!
Create a free account

Can I use an aytocalc field inside a macro?

Hi friends, I'm not so skilled with roll20, and maybe this question was alread made by someone else, so forgice me.  I want to use the result of an autocalc field with a macro.  I tried this /roll 1d10+@{selected|combatskilltotal} where {combatskilltotal} is the result of an autocalc field. It doesn't work. As I said, I don't have a decent skill in roll20, so what can I do? Thank you guys, hope someone can fix this! Marco
1590867621

Edited 1590867637
GiGs
Pro
Sheet Author
API Scripter
The above code should work, if the attribute is set up correctly, and the token is set up correctly. Is this a custom character sheet? If so, post the html for the combatskilltotal attribute. If not, let us know which sheet you are using.
1590878419

Edited 1590878604
I'm using a custom sheet, for the Lone Wolf RPG by Cubicle 7. Here's the code for the combtot autocalc field:  <div><input type="number" name="attr_combtot" value="@{combbase}+@{tratto1btcomb}*@{tratto1btcombact}+@{tratto1bfcomb} +@{tratto2btcomb}*@{tratto2btcombact}+@{tratto2bfcomb}+@{tratto3btcomb}*@{tratto3btcombact}+@{tratto3bfcomb} +@{tratto4btcomb}*@{tratto4btcombact}+@{tratto4bfcomb} +@{bcombarma1}*@{arma1act}+@{bcombarma2}*@{arma2act}+@{bcombarma3}*@{arma3act}+@{bcombarma4}*@{arma4act} +@{combspb1}*@{combspb1act}+@{combspb2}*@{combspb2act}+@{combspb3}*@{combspb3act}+@{combspb4}*@{combspb4act}"  disabled="true" /></div>  I tried a simple macro thing, like /roll 1d10+@{selected|combbase} and it works. The trouble start when I want to use directly the result of the autocalc field. Sorry for the names of the variables. My mother language is italian, and I wrote the code mixing italian and english. I checked the sheet, the autocalc field works, So what I need for the macro is the value of the combtot attribute.  I'm totally new at programming, and I know that using the sheetworkers is much better, but for my skills the sheetworkers are too difficult :( Thanks a lot!
1590878687
GiGs
Pro
Sheet Author
API Scripter
Your original macro uses the wrong attribute name, it should be /roll 1d10+@{selected|combtot} If that still isnt working, first check your token has the correct character set in its Represents dropdown. Then you need to check all of those attributes above individually to see if they are correect. You do this by typing in chat: @{selected|PUT NAME HERE} so for the first: @{selected|combbase} Go through them all, and make sure they are each showing a number into chat. Tell us the result.
Sorry for the delay with my answer.  I did everything you suggested, and I found this solution. It works!!! This is the final macro: #combbonusfissi +#bcombarma1 +#bcombarma2 +#bcombarma3 +#bcombarma4 +#combspb1 +#combspb2 +#combspb3 +#combspb4 +#tratto1btcomb +#tratto2btcomb +#tratto3btcomb +#tratto4btcomb  that is composed of smaller macros. The key was in the multiply operation of some of them. Multiplying variables was tricky. Once I wrote them in a working way. like this [[@{selected|bcombarma1}*@{selected|arma1act}]] everything went smoothly. Thank you!!!
1591121444
GiGs
Pro
Sheet Author
API Scripter
Well done! Yes, you do need to be careful of ordering with that kind of thing, and brackets of the ( ) or [[ ]] kind can be essential to get everything working properly.