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

Need help with a template

1608529482

Edited 1608529586
I found this macro in another thread (one for showing and not asking for help)  /desc &{template:default} {{name=**@{target|Currency|character_name}** **is Converting Currency:**}} {{Copper:=**[[(0 +@{target|Currency|cp}) -(floor((0 +@{target|Currency|cp}) /10) *10)]]**}} {{Silver:=**[[((0 +(@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +floor([[(0 +@{target|Currency|cp}) /10]])) -(floor([[(((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10]]) *10)]]**}} {{Gold:=**[[((0 +@{target|Currency|gp}) +(floor([[(((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10]]))) -(floor([[((0+ @{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) *10)]]**}} {{Platinum:=**[[((0 +@{target|Currency|pp}) +(floor([[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]))) -(floor(((0 +@{target|Currency|pp}) +[[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) /50) *50)]]**}} {{Platinum Ingots:=**[[floor(((0 +@{target|Currency|pp}) +[[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) /50) +((0 +@{target|Currency|repeating_inventory_$0_itemcount}))]]**}} I was trying to change to a more dnd ogl sheet style but I'm not having any luck
1608534163

Edited 1608545449
Oosh
Sheet Author
API Scripter
Are you just converting up to Platinum as much as possible? You can try this one: &{template:npcaction}{{rname=Platinum Converter}}{{description=**@{selected|character_name}'s starting wealth:** *Copper:* @{selected|cp} *Silver:* @{selected|sp} *Electrum:*** @{selected|ep} *Gold***: @{selected|gp} *Platinum*: @{selected|pp} [ ](#" style="border: none; border-top: 0.25em solid transparent; border-bottom: 0.25em solid transparent; border-left: 14em solid #7e2d40; line-height: 1.25em; font-size: 1.05em; display: block) **After currency exchange:** ***Copper:*** [[ floor(0@{selected|cp}%10) ]] ***Silver:*** [[ floor((0@{selected|sp} + floor(0@{selected|cp}/10))%2.5) ]] ***Electrum:*** [[ floor(0@{selected|ep} + floor(0@{selected|sp} + floor(0@{selected|cp}/10) )/2.5)%4 ]] ***Gold***: [[ floor(0@{selected|gp} + floor((0@{selected|ep} + floor(0@{selected|sp} + floor(0@{selected|cp}/10))/2.5)/4) )%10 ]] ***Platinum***: [[0@{selected|pp} + floor((0@{selected|gp} + floor((0@{selected|ep} + floor(0@{selected|sp} + floor(0@{selected|cp}/10))/2.5)/4)) /10) ]] }} This (obviously) doesn't actually adjust anything on the sheet, but that can be inserted easily enough with chatSetAttr if needed.
I saw that one too and I might end up using it thank you, but I wanted to see someone fix that code so I could look at both and see where my mistake was and hopefully learn from there. I know very little about writing a code, I know enough to edit and change things to what I want (sometime) I'm wanting to learn more.
1608543653

Edited 1608545500
Oosh
Sheet Author
API Scripter
If you want it in a Roll20 5e template, you need to remove the /desc, change the template name (may as well use npcaction, since it's in my example), change {{name}} to {{rname}}, then remove all other property syntax {{ }} and =, and enclose the rest of the macro in a single handlebar property {{description=<rest of macro here>}}. As for the math.... no idea. I don't know what an ingot is worth, and wasn't aware of them being part of the core rules. edit - huh, turns out they were both wrong! I've fixed mine up, but my brain will snap if I try to fix up someone else's nested math.
Here's your code with the npcaction template: &{template:npcaction} &{noerror} {{rname=@{target|Currency|character_name}}} {{name=Currency Conversion}} {{description=Copper: **[[(0 +@{target|Currency|cp}) -(floor((0 +@{target|Currency|cp}) /10) *10)]]** Silver: **[[((0 +(@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +floor([[(0 +@{target|Currency|cp}) /10]])) -(floor([[(((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10]]) *10)]]** Gold: **[[((0 +@{target|Currency|gp}) +(floor([[(((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10]]))) -(floor([[((0+ @{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) *10)]]** Platinum: **[[((0 +@{target|Currency|pp}) +(floor([[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]))) -(floor(((0 +@{target|Currency|pp}) +[[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) /50) *50)]]** Platinum Ingots: **[[floor(((0 +@{target|Currency|pp}) +[[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) /50) +((0 +@{target|Currency|repeating_inventory_$0_itemcount}))]]**}} If you wanted to add in some of Oosh's styling: &{template:npcaction} &{noerror} {{rname=@{target|Currency|character_name}}} {{name=Currency Conversion}} {{description=**@{target|Currency|character_name}'s starting wealth:** *Copper:* @{target|Currency|cp} *Silver:* @{target|Currency|sp} *Electrum:*** @{target|Currency|ep} *Gold***: @{target|Currency|gp} *Platinum*: @{target|Currency|pp} [ ](#" style="border: none; border-top: 0.25em solid transparent; border-bottom: 0.25em solid transparent; border-left: 14em solid #7e2d40; line-height: 1.25em; font-size: 1.05em; display: inline-block) **After currency exchange:** Copper: **[[(0 +@{target|Currency|cp}) -(floor((0 +@{target|Currency|cp}) /10) *10)]]** Silver: **[[((0 +(@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +floor([[(0 +@{target|Currency|cp}) /10]])) -(floor([[(((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10]]) *10)]]** Gold: **[[((0 +@{target|Currency|gp}) +(floor([[(((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10]]))) -(floor([[((0+ @{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) *10)]]** Platinum: **[[((0 +@{target|Currency|pp}) +(floor([[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]))) -(floor(((0 +@{target|Currency|pp}) +[[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) /50) *50)]]** Platinum Ingots: **[[floor(((0 +@{target|Currency|pp}) +[[((0 +@{target|Currency|gp}) +((((0 +@{target|Currency|sp}) +((0 +@{target|Currency|ep}) *5)) +((0 +@{target|Currency|cp}) /10)) /10)) /10]]) /50) +((0 +@{target|Currency|repeating_inventory_$0_itemcount}))]]**}} And as Oosh mentioned, the formula calculation is incorrectly converting the total, so you'll want to take a look at that as well.  But hopefully this helps get you to the style you're looking for!
Thank you very much