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

Repeating sections : sheetworkers and macros

1461531979
Phoxounet
Sheet Author
Translator
Hi there :) I am new to using sepeating sections. I know how to integrate them in the html code. here is an example <fieldsetstyle="background-color:#926239;"> <input type="text" name="attr_name"style="margin-left:5px;width:145px;"/> <input type="text" name="attr_dmg"style="width:30px;font-weight:lighter;"/> </fieldset> It creates a repeating section for weapons and damages. However, I don't know how to use the repeating sections in macros or in sheetworkers. I would like to be able to use these. For now, I am pretty limited in repeating sections usage. I read the wiki but I couldn't get it :( An example would be great for me to understand. So let's say the first row is Longsword, 1D8, second row is Dagger, 1D6 for a player. For an other one, 1st row is staff 1D6. My problems should to be able to update the repeating sections using sheetworkers(for other sections, like skills). In an other hand, I would like to be able to recover the row values so that I could create macro (like John Doe attacks with his 'weapon_1' and do 'X DMG'. Ultimately, I would like to be able to have a macro with a drop-down query where the player could choose the weapon when triggering the macro. This is just a simple example so that I could get it and effectively use it in my sheets. Regards.    
1461569471
Phoxounet
Sheet Author
Translator
Wow... I had a problem with a sheetworker and I tought that all the sheetworker affected to the repeating section was bad. Shame on me, I forgot to affect the values function to a variable in order to make a comparison... Thx again, Brian, if you read this. :) Now, my only true problem is to be able to recover repeating section values so that I can make a macro. <div > <fieldset class="repeating_skill"> <input type="text" name="attr_skill_name"style="margin-left:5px;width:145px;"/> <input type="text" name="attr_skillcarac"style="width:30px;margin-left:1px;font-weight:lighter;"/> <input type="radio" name="attr_skill" value="1" style="margin-left:15px;" checked/> <!--1/2--> <input type="radio" name="attr_skill" value="2"/> <!-- taken--> <input type="radio" name="attr_skill" value="3" style="margin-left:20px;"/> <!-- +10%--> <input type="radio" name="attr_skill" value="4"style="margin-left:23px;"/> <!-- +20% --> <input type="text" value="0" name="attr_totalskill" style="width:40px;height:18px;background:black;margin-left:25px;"/> <divstyle="width:10px;margin-left:1px;" >%</div> </fieldset> </div> Here is a repeating section I made for Warhammer 2 advanced skills. Sheetworker does well and my total skill is adjusted when values are modified. Anyway, I would like to be able to use these values in a macro.  Help plz ^^ Regards :)
1461576086
Finderski
Pro
Sheet Author
Compendium Curator
To call the skill name (from the above) the format I use is: @{repeating_skill_$0_skill_name} The $0 would call the skill name from the first item in the repeating section. If you wanted the second skill name, then you would use $1 instead, and so on. The same format would be used for each of the other fields.
1461583802
Phoxounet
Sheet Author
Translator
Thx for your answer. However, I have a problem : if i create a macro for 5 rows, and only have 3 rows created, the macro is not working... Since I can't predict the number of rows, I am stuck : if I create a macro with less rows than the actual sheet, the macro doesn't show all options in the drop down query. On the other if I create a macro for more rows than what is entered in the sheet, the drop dop query is totally ugly (and barely functioning). Any idea to circumvent this issue ? Thx :)
1461585198
Finderski
Pro
Sheet Author
Compendium Curator
Hmm...can you describe what you're trying to do? By that I mean, what type of output are you hoping to achieve? And can you show your current macro to give an idea of what you've done so far? I'm not sure I understand completely, because all of the macros I create are very specific and for a single row/repeating item. I'm guessing there's probably a way to use a sheet worker to help, but not sure.  What I'm thinking is you create a hidden field that is nothing but the text of the macro and when a row is added/deleted from the repeating section that field is updated with the appropriate values. Then your macro simply calls that hidden field.
1461588215

Edited 1461588922
Phoxounet
Sheet Author
Translator
I am trying to make a powercard for the skills : !power {{ --corners|10 --charid|@{character_id} ?{Skill ? ?| @{repeating_skill_$0_skillname} (@{repeating_skill_$0_totalskill} %), --name|@{repeating_skill_$0_skillname} --emote|**@{character_name}** rolls for **@{repeating_skill_$0_0_skillname}** ! --rightsub|Advanced Skill --Skill:|**@{repeating_skill_$0_totalskill} %** --Degree of Success:|[[ [$Roll] floor((@{repeating_skill_$0_totalskill}+?{Bonus|0}-1D100cs<@{repeating_skill_$0_totalskill}cf>@{repeating_skill_$0_totalskill})/10)]] --?? $Roll >= 0 ?? Success| ! --?? $Roll< 0 ?? Fail| ! | @{repeating_skill_$1_skillname} (@{repeating_skill_$1_totalskill} %), --name|@{repeating_skill_$1_skillname} --emote|**@{character_name}** rolls for **@{repeating_skill_$1_skillname}** ! --rightsub|Advanced Skill --Skill:|**@{repeating_skill_$1_totalskill} %** --Degree of Success:|[[ [$Roll] floor((@{repeating_skill_$1_totalskill}+?{Bonus|0}-1D100cs<@{repeating_skill_$1_totalskill}cf>@{repeating_skill_$1_totalskill})/10)]] --?? $Roll>= 0 ?? Success| ! --?? $Roll< 0 ?? Fail| ! } }} For now, I have to create as many macro items ($0, $1, $n) that the pc has in the sheet. Not really user friendly... I used sheetworkers to update the skill value and it's working as intended. Now, I want to have a drop down query that proposes a list of skills. Then it triggers a powercard that displays the result of the test. Problem is that i can't predict how many advanced skills a pc will have. In other words, I can't predict what n will be. I am not sure if it is possible to make a single macro no matter the n value is.
1461592592
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
FYI: I am currently struggling with something similar, and what I am trying is creating abilities, which I am doing from the API side since I don't think sheetworkers can access them. If you have access to the API you might try that. 
1461613117
Silvyre
Forum Champion
I, too, would love to be able to write macros that can survive the nonexistence of [repeating] Attributes. I made a Suggestion that could help with this issue. Otherwise, you might be able to use API Command Buttons in place of Roll Queries as a workaround. e.g. [@{repeating_skill_$0_skillname}](!power {{ --corners|10 --charid|@{character_id} --name|@{repeating_skill_$0_skillname} --emote|**@{character_name}** rolls for **@{repeating_skill_$0_0_skillname}** ! --rightsub|Advanced Skill --Skill:|**@{repeating_skill_$0_totalskill} %** --Degree of Success:|[[ [$Roll] floor((@{repeating_skill_$0_totalskill}+?{Bonus|0}-1D100cs<@{repeating_skill_$0_totalskill}cf>@{repeating_skill_$0_totalskill})/10)]] --?? $Roll >= 0 ?? Success|   ! --?? $Roll< 0 ?? Fail| ! }}) [@{repeating_skill_$1_skillname}](!power {{ --corners|10 --charid|@{character_id} --name|@{repeating_skill_$1_skillname} --emote|**@{character_name}** rolls for **@{repeating_skill_$1_skillname}** ! --rightsub|Advanced Skill --Skill:|**@{repeating_skill_$1_totalskill} %** --Degree of Success:|[[ [$Roll] floor((@{repeating_skill_$1_totalskill}+?{Bonus|0}-1D100cs<@{repeating_skill_$1_totalskill}cf>@{repeating_skill_$1_totalskill})/10)]] --?? $Roll>= 0 ?? Success|   ! --?? $Roll< 0 ?? Fail| ! }})
1461616423

Edited 1461616445
Phoxounet
Sheet Author
Translator
Thx Silvyre. I added my vote to your suggestion and made one too : a looping system for repeating sections that would allow  a macro to loop and check all values in a repeating section and to pass all these values into the macro. Alongside drop down queries, it could be very powerfull, yet simple to make a single macro that could automatically adapt to the size of the repeating section. Here is my suggestion