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 .
×

Nested macro issue

Greetings  i am attempting to use an input from a player then multiply that number by 2 then add 4. display that number then subtract that final number from an attribute. It all works except the last 2 bits. It wont add the 4 and it wont subtract from an attribute. If i remove the subtraction bit it works up to before the Add 4.  But when i include it the whole macro crashes. Html encode maybe. Been staring at it too long i need a pair of fresh eyes and more experience to show what i have missed. Hope you can help, -Chuck This works but it wont add the 4 i tried calling {I.S.P. Cost} instead of +4 but it didn't like that either. &{template:default} {{name=Restore P.P.E.}} {{P.P.E. Restored=[[?{How much P.P.E. to restore?|1}]]}}{{I.S.P. Cost= [[4]]}} {{I.S.P. Conversion=[[?{How much P.P.E. to restore?}*2}]]}} {{Total I.S.P. Cost=[[{I.S.P. Conversion}+4}]]}} This bit crashes the whole macro. Do i need to sub out the target token id characters as well? !ammo @{selected|token_id}  character_isp  -{Total I.S.P. Cost}  I.S.P.
1613675685

Edited 1613676070
Kraynic
Pro
Sheet Author
I'm not sure you need any of those html replacements.  This seems like it should work to me. &{template:default} {{name=Restore P.P.E.}} {{P.P.E. Restored=[[?{How much P.P.E. to restore?|1}]]}}{{I.S.P. Cost= [[4]]}} {{I.S.P. Conversion=[[?{How much P.P.E. to restore?}*2}]]}} !ammo @{selected|token_id} character_isp -[[?{How much P.P.E. to restore?|1}*2+4]] ISP That is all issued as one command, so that when you answer the PPE question, it will use that same answer in both places in the roll template and in the Ammo script call. Edit:  I'm assuming you are running this in a game where the creator of the game has a pro subscription and has installed the Ammo api script, otherwise the api command will not work.
Yes the GM is running API and ammo script is loaded.  it works. Thank you for the corrections. i think i see where i went wrong.