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
This post has been closed. You can still view previous posts, but you can't post any new replies.

API Question

In cWOD there are wound penalties at different health levels and I want to find a way to automatically add the penalties into my macros. I know how to add/subtract an attribute in a macro, but not sure how to 'script' the different health levels vs the penalties. Since i don't code, is there any way to put the data into a table and use an API script to track it into an attribute I can use in a macro ?
How exactly does this work in your system? If there is a % reduction in abilities, you could do it in a macro like [[1D100 + @{selected|attribute}- ((@{selected|max_health}/@{selected|health}* (some_number))]] If it is more complex, try Powercards, a bit of work to set up, but it opens a lot of options for you not possible without it.
1459451377
Silvyre
Forum Champion
Wound penalty: [[ -1 * ( floor(?{Health Level|Perfect, 0|Bruised, 1|Hurt, 2|Injured, 3|Wounded, 4|Mauled, 5|Crippled, 6} / 2) + {?{Health Level} + d0}=6 * 2 ) ]] The above maps inputs to outputs as follows: Input 0 → Output 0 1 → 0 2 → 1 3 → 1 4 → 2 5 → 2 6 → 5 You could replace the Roll Query with an Attribute, and adjust the value of that Attribute from 0 to 6 as applicable (e.g. by linking it to a Token's Bar).
Silvyre said: Wound penalty: [[ -1 * ( floor(?{Health Level|Perfect, 0|Bruised, 1|Hurt, 2|Injured, 3|Wounded, 4|Mauled, 5|Crippled, 6} / 2) + {?{Health Level} + d0}=6 * 2 ) ]] The above maps inputs to outputs as follows: Input 0 → Output 0 1 → 0 2 → 1 3 → 1 4 → 2 5 → 2 6 → 5 You could replace the Roll Query with an Attribute, and adjust the value of that Attribute from 0 to 6 as applicable (e.g. by linking it to a Token's Bar). Something like that would be perfect but I'm not sure I understand. The script above assigns a value of 0 to -5 according to the Health Level of the character (Which is exactly what WOD uses) and assigns that value to an attribute called Wound Penalty ?   I have no knowledge of scripting and don't follow the above example very well.
1459465749

Edited 1459465965
Silvyre
Forum Champion
[[ -1 * ( floor(?{Health Level} / 2) + {?{Health Level} + d0}=6 * 2 ) ]] The above inline roll is just a bit of math to demonstrate how a wound penalty Attribute might look like. I might replace ?{Health Level} with an Attribute (e.g. @{HL}), which players would control the Current value of (which would range from 0 to 6, corresponding to the Health Level). Then, I might create an Attribute for wound penalty (e.g. @{WP}), with a Current value as follows: [[ -1 * ( floor(@{HL} / 2) + {@{HL} + d0}=6 * 2 ) ]] Then, you could add "+ @{WP}" to your Ability macros (or "+ @{ keyword |WP}" to your My Settings macros) as you desired.
Silvyre said: [[ -1 * ( floor(?{Health Level} / 2) + {?{Health Level} + d0}=6 * 2 ) ]] The above inline roll is just a bit of math to demonstrate how a wound penalty Attribute might look like. I might replace ?{Health Level} with an Attribute (e.g. @{HL}), which players would control the Current value of (which would range from 0 to 6, corresponding to the Health Level). Then, I might create an Attribute for wound penalty (e.g. @{WP}), with a Current value as follows: [[ -1 * ( floor(@{HL} / 2) + {@{HL} + d0}=6 * 2 ) ]] Then, you could add "+ @{WP}" to your Ability macros (or "+ @{ keyword |WP}" to your My Settings macros) as you desired. OK I understand the part of creating the attribute for the character's wound level (0-6) and how to add the calculated modifier (@{WP}) to all macros that could be effected by wound penalties, but how do I get it to calculate @{WP} so that whenever their would level changes it recalculates @{WP}?
1459480586
Silvyre
Forum Champion
Every time you use a macro that uses @{WP}, it will automatically pull the Current value of @{HL} from the relevant Character. :)
Silvyre said: Every time you use a macro that uses @{WP}, it will automatically pull the Current value of @{HL} from the relevant Character. :) excellent. Thank you very much. One day I should pick up a Java book and read it.
1459537031
The Aaron
Pro
API Scripter
Be sure you get one on Java script. Java and Javascript are almost completely unrelated and knowing one certainly won't help you to any great degree with the other.
The Aaron said: Be sure you get one on Java script. Java and Javascript are almost completely unrelated and knowing one certainly won't help you to any great degree with the other. yes Javascript :)  See... back was it was simple I knew a lot more--- Basic or Machine Language... not much choice then. Now there are probably 50 programming languages.
1459538391

Edited 1459559549
Silvyre said: Every time you use a macro that uses @{WP}, it will automatically pull the Current value of @{HL} from the relevant Character. :) OMG I've been using roll20 for a year and just realized you can assign a calculation to an attribute :(  I feel stupid now... I plugged in my own attribute names and it works perfectly. Thank you.
1459543620
Silvyre
Forum Champion
There's always something new to learn about Roll20! Happy rolling!
1459561656
Lithl
Pro
Sheet Author
API Scripter
Xargun said: Now there are probably 50 programming languages. Only 50? There's  a website that has at least one program to print out the lyrics to "99 Bottles of Beer" written in each of over 1500 different languages. Some of them are rather esoteric and wouldn't see much use (for example, the language 99 takes an empty input file and produces a program to output the lyrics to the song), and some language groups can be very similar (compare Fortran, FORTRAN 77, Fortran 90, FORTRAN IV, FORTRAN-II...), but 50 is still way on the low end of things. =)
1459609059
Gen Kitty
Forum Champion
Coughs, wandering by with a broom.   Y'all are heading off-topic :) Xargun, do you have any more questions on this topic or is Silvyre good to close this up?
GenKitty said: Coughs, wandering by with a broom.   Y'all are heading off-topic :) Xargun, do you have any more questions on this topic or is Silvyre good to close this up? Good to close up shop.. thanks again guys