Advertisement Create a free account

Creating custom roll macro for Qin

1578912346
Hi all, I want to create a macro for a specific roll used by the RPG "Qin". It uses two D10 for a roll : one as the Yin and the other as the Yang. The character has five Aspects (metal, water, fire, wood, earth) and each Aspect contains some Skills. A Skill test is like this : abs(Yang - Yin) + Aspect + Skill and we compare the result to a Difficulty value or an Opposition test. At first look, it is simple, but here is the trick. If Yin = Yang, two things can happen : - If Yin = Yang = 1, it's an automatic Critical Failure - Otherwise, it's a automatic Critical Success I wish to display the result like this : Yin : [result of 1D10] Yang : [result of 1D10] Skill Test : [final result] As [final result] replaced by CRITICAL SUCCESS or CRITICAL FAILURE if the results of Yin and Yang are the same. Is it possible to do this by a macro ?
1578919437

Edited 1578919803
GiGs
Pro
Sheet Author
I have bad news. It's not possible to fully represent this by a macro. You can do it with a custom API script, and you might be able to do it with a complex rolltemplate on a custom character sheet, but both of those options require a Pro subscription. You cant compare the dice against each other in one step, and add them to a bonus in another step. You cant do conditional effets (e.g. if result is critical, display Critical Result; if not, don't). That roll method seems to be well outside of what you can do with roll20's basic macros and probably the best you could do is something like &{template:default} {{name=Roll (replace this with whatever)}} {{Dice=[[abs(1d10cf1-1d10cf1)]]}} {{Bonus=[[?{Aspect|0} + ?{Skill|0}]]}} This will show you the roll on one row, and the bonus on another, and you'll have to add them together manually. If the roll shows 0, you know the dice are equal, so you have a potential critical success, and if its 0 and red, its a critical failure. If its red and any other number, you just have to ignore it. You can replace the Aspect and Skill queries with references or specific skills and aspects, and retrieve them from a character sheet. This macro is just a proof of concept.
1579028362
Hi GiGs and thank you for your answer. Now that I can use the Pro subscription features, I begin to create a custom character sheet for Qin. There is already an existing one in the community character sheets but it doesn't look very clean, visually speaking, and the test skill with PowerCards seems buggy. I then want to use PowerCards to do a roll including 1D10 for the Yin, 1D10 for the Yang, the value of an Aspect (Water for example) and the value of a Skill level (Evade for example, based on the Water aspect). I do this : !power {{ --name|Test of @{TalentName} --leftsub|@{TalentName} --rightsub|Water --Water:|[! @{Water} !] --Skill level:|[! @{TalentLvl} !] --Yin:|[! [^Yin] !] --Yang:| [! [^Yang] !] --Result:|[[ [NH] @{Water} + @{TalentLvl} + abs([$Yin] {1d10} - [$Yang] {1d10})]] --?? $Yin.base == $Yang.base AND $Yin.base > 1 ?? Critical Success !|Your Yin and Yang are in balance ! You regain $Yin Chi. --?? $Yin.base == $Yang.base AND $Yang.base == 1 ?? Critical Failure !|You fail miserably and lose 5 Chi. --?? $Yin.base > $Yang.base ?? You Yin is dominant. --?? $Yin.base < $Yang.base ?? Your Yang is dominant. }} this is based of what's already bein done in the existing character sheet. I am new to Roll20 character sheet and API. For a Skill Test, we have : - the Skill Level ("attr_TalentLvl" in the Character Sheet), - the Aspect level ("attr_Water" in the Character Sheet for my example), - one D10 to roll for the Yin - one D10 to roll for the Yang The test : abs(Yin - Yang) + Aspect level + Skill level. If Yin and Yang are both equal to 1 (regardless of the result), this is a critical failure and the character loses 5 Chi points. If Yin and Yang are both equal but different to 1, this is a critical success and the character regain an amount of Chi points equal to the value of Yin. Otherwise, a message tells us which one between Yin and Yang is dominant. With this PowerCards code, it doesn't work as expected : "Eau" and "Niveau de compétence" (Water aspect and Skill level) displays the good values. But Yin and Yang values are always equals, and the Result is wrong. And the final message in the end is buggy. How can I fix this ?
1579028778
GiGs
Pro
Sheet Author
I dont use Power cards, so I'm not familiar with the syntax. There's a dedicated thread for it - you hsould be able to get  good responses for how to use the script there. If you'd like, i could whip up a quick custom script for you to handle it, bypassing the need to use powercards.  In your example, you have @{TalentName} and @{TalentLvl} attributes. Do players just have one talent? If they have multiple talents and they are in a repeating section, you need to use the full repeating section name.
1579030529
Yes, they have multiple skills, regrouping in four Aspects (Water, Fire, Wood, Earth), and in my character sheet I put four repeating skills : <fieldset class="repeating_WaterSkill"> <fieldset class="repeating_FireSkill"> <fieldset class="repeating_WoodSkill"> <fieldset class="repeating_EarthSkill"> And in each fieldset, here we are : <input type="text" name="attr_TalentName" /> <select name="attr_TalentLvl">...</select> <button type="roll" value="roll_script">icon</button> Thank you for your time :)
1579032766

Edited 1579033240
GiGs
Pro
Sheet Author
I see a couple of problems. Your repeating section names are not in all-lower case - this can cause problems with scripts. The roll20 character sheet creation guidelines suggest all attributes should be lower case, but this is especially important for repeating section names. So I strongly recommend changing them to repeating_fireskill, repeating_waterskill, etc. The second problem: to access a skill within the repeating section you have to use the full attribute name, which includes an identifier for the row. Think about it: imagine your repeating_water section has 4 skills, each called TalentName. And you want to create a  macro to use the second skill in the section. How can you refer to that specific skill called TalentName, and not pick the 1st, 3rd or 4th by mistake? The answer is, each row has an identifier. So, the names in attributes in repeating sections have three parts: The repeating section name An ID for which row to select. In the simplest form, $0 is the first row, $1 is the second row, $2 is the third row, and so on. The numbering starts at 0. And the attribute name So, to pick the 2nd skill in the repeating_water section, we would use @{repeating_waterskill_$1_talentname} , and to get its level, we use @{repeating_waterskill_$1_talentlvl} . I assumed you changed all the names to lower case there for simplicity. Now it looks like your macro above is getting the name and level accurately, but I'm guessing you only have one skill created. Once you have more than one, or you try to get the second or higher skill in a section, it will stop working reliably. Hope this helps - I'll see if I can get a test script up tomorrow.  Edit:  just realised your roll section is inside the repeating section, so you just need to use the 3rd part of the full attribute name (@{talentname} and @{talentlvl}). Your dont have to use the full name. I'll leave the explanation of how repeating section names work for later reference. The first problem though - that of upper case in repeating section names - will still be a problem and should be corrected.
1579040055
Kraynic
Pro
Sheet Author
One other thing to note about roll buttons is that if they don't have a name designation (roll_waterskill, roll_fireskill, or whatever), players won't be able to drag them to the quick macro bar for easy access.
1579079181
GiGs
Pro
Sheet Author
Good point, and you cant refer to them as pre-built macros or use them in chat menus. Buttons should always have a roll name.
1579100564
Thanks a lot for your time both of you :) @GiGs : That's right, roll buttons are within the repeating skill on purpose, so players can do skill tests easily. I will add name attributes to each of them, and pass all names in lowercase.
1579282378
Hi, I've managed to code a character sheet and an API script. So far, it does a pretty good job ! I think it can be further optimized, but it's a start ! You can find it here :&nbsp; <a href="https://github.com/JerryCow33/roll20-qin-fr-character-sheet" rel="nofollow">https://github.com/JerryCow33/roll20-qin-fr-character-sheet</a> (I never used GitHub before this) Some parts of the character sheet are yet to code, like Taos ans Magic, Weapons and Protection. Thanks again for your time :)
1579284000
GiGs
Pro
Sheet Author
Congrats! Normally people put a screenshot of the character sheet in the folder, so people can see roughly what it looks like before installing.&nbsp;