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

[Help] Getting Modifiers to display instead of the math

1431756758

Edited 1431756768
I am trying to get a macro to call to the API for a power card display. When I call to the Ability Modifier say @{player|charisma-mod}. I just get floor((13-10)/2)) which is the math that would get me to what I want, but I would like to just see 1. I can add an attribute to the character sheet specifically for charisma-mod but then I don't know how to get it to respond to changes in the character sheet. My charisma attribute changes when changed on the character sheet but the charisma-mod attribute stays with whatever I input. Which also rises the question. How could I get the math to round down, or up on an decimal number or half number? Thanks for the help. Ryeaa
1431760464
vÍnce
Pro
Sheet Author
Hi Ryeaa. Have you tried placing the attribute within an inline roll? [[@{player|charisma-mod}]] You can round up/down using ceil() and floor() wiki link( Rounding Rolls and Math Functions )
PowerCards doesn't work with nested inline rolls yet. Waiting on Riley to finish updating that on the dev server before I finish re-writing that part of the script
But you can get around this by putting the inline roll in an attribute. On your attributes & abilities tab, create a my-charisma-mod attribute and enter [[floor((@{Charisma}-10)/2))]]. Then in your macro, just add @{my-charisma-mod} inside the rolls you want to add it to. This will get around the bug with powercards and nested inline rolls. [[1d20 + @{my-charisma-mod}]] will work. [[1d20 + [[floor((@{Charisma-10)/2)]] ]] will not.
1431761160

Edited 1431761210
vÍnce
Pro
Sheet Author
HoneyBadger said: PowerCards doesn't work with nested inline rolls yet. Waiting on Riley to finish updating that on the dev server before I finish re-writing that part of the script Can't wait for that. For the OP problem, it wouldn't necessarily have to be a nested inline roll to solve the issue though, correct? It just needs to be within an inline's roll [[foo+foo]] or [[1d20+@{player|charisma-mod}]]...?
1431761293

Edited 1431761553
Charisma = 14 Dexterity = 18 Cha_Mod = [[floor((@Charisma-10)/2)]] Dex_Mod = [[floor((@{Dexterity-10)/2)]] !power {{ --name| Sly Flourish --format|atwill --Attack:|[[1d20 + @{Dex_Mod} [Dex Mod] + 3 [Wpn Prof]]] vs AC --Hit:|[[1d8 + @{Dex_Mod} [Dex Mod] + @{Cha_Mod} [Cha Mod]]] piercing damage }}
Vince said: Hi Ryeaa. Have you tried placing the attribute within an inline roll? [[@{player|charisma-mod}]] You can round up/down using ceil() and floor() wiki link( Rounding Rolls and Math Functions ) No, I have not, and I guess I wont until the new update comes out. But while on the subject, putting [[ and ]] around a function makes it inline? I have the ability to see your guys scripts and API and make small changes (after several trails and error) So I am not sure what making it Inline does or what Inline actually means.
1431761441

Edited 1431761494
HoneyBadger said: But you can get around this by putting the inline roll in an attribute. On your attributes & abilities tab, create a my-charisma-mod attribute and enter [[floor((@{Charisma}-10)/2))]]. Then in your macro, just add @{my-charisma-mod} inside the rolls you want to add it to. This will get around the bug with powercards and nested inline rolls. [[1d20 + @{my-charisma-mod}]] will work. [[1d20 + [[floor((@{Charisma-10)/2)]] ]] will not. I tried something very similar to that once, but I didn't add the floor part or as many [[ and ]] You script writes make me jealous of your abilities, but with that said, your amazing :-)
1431784916

Edited 1431785914
For anyone else who is going to use this as a copy paste for their macros. HoneyBadger said: Charisma = 14 Dexterity = 18 Cha_Mod = [[floor((@Charisma-10)/2)]] Dex_Mod = [[floor((@{Dexterity-10)/2)]] Has some typos. You will need to add { and } to Both otherwise you'll just get this error You add them After the @ for the Charisma one and you need change the ) after both Charisma-10 and Dexterity-10 to }
1431793646
Lithl
Pro
Sheet Author
API Scripter
HoneyBadger said: PowerCards doesn't work with nested inline rolls yet. Waiting on Riley to finish updating that on the dev server before I finish re-writing that part of the script I haven't had problems with nested inline rolls in power cards. Here's my Melee Basic Attack macro from my current 4e game: !power --format|atwill --charid|@{character_id} --emote|@{character_name} swings his dagger. --name|@{power-1-name} --leftsub|@{power-1-useage} --rightsub|@{power-1-action} --!Range|@{power-1-range} --Target:|One creature --Keyword:|Weapon --Attack:|[[1d20 + [[@{power-1-attack}]]]] vs. @{power-1-def} --Hit:|[[[[floor(@{level} / 21)]] [Lv21] * @{power-1-weapon-num-dice}d@{power-1-weapon-dice} + @{power-1-weapon-num-dice}d@{power-1-weapon-dice} + [[@{power-1-damage}]] + #bloodiedTarget ]] damage. The attack line produces 1d20 + 9 and the damage line produces 0 [Lv21] * 1d4 + 1d4 + 0 + 0 * 2 [Gauntlets of Blood] My GM reports that the campaign is using version 2.3.7.
1431798705
Gen Kitty
Forum Champion
Ryeaa said: No, I have not, and I guess I wont until the new update comes out. But while on the subject, putting [[ and ]] around a function makes it inline? I have the ability to see your guys scripts and API and make small changes (after several trails and error) So I am not sure what making it Inline does or what Inline actually means. Dice roll: /roll 1d20 Inline dice roll: [[1d20] They both roll 1d20, but the latter method hides all the spammy bits and tucks it 'in line' with the rest of the text. You can't do /me attacks with his longsword, hitting AC /roll 1d20+4! but you can do /me attacks with his longsword, hitting AC [[1d20+4]]! However, there's a few things that inline rolls don't (didn't?) handle gracefully, for reasons I have never managed to pick up. Among them, using floor/ceiling. (I don't know if that is still the case.)
1431801070
vÍnce
Pro
Sheet Author
GenKitty said: However, there's a few things that inline rolls don't (didn't?) handle gracefully, for reasons I have never managed to pick up. Among them, using floor/ceiling. (I don't know if that is still the case.) I didn't realize that GenKitty... I'll have to experiment now.
1431802230
Gen Kitty
Forum Champion
Thing is, Vince, I've seen floor/ceiling be used ok... and yet it is also a source of issues for some macros. I'm not clear on where the line is, I just know it is (was?) something to avoid when possible. Hopefully someone with more knowledge will pop up and educate us!
1431808884
Lithl
Pro
Sheet Author
API Scripter
GenKitty said: Thing is, Vince, I've seen floor/ceiling be used ok... and yet it is also a source of issues for some macros. floor/ceiling/abs cause issues with /roll in the same cases where they cause issues with inline rolls. Most commonly, people try to use these functions in a macro to calculate the number of dice to roll, which doesn't work.