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

loop thru repeating sections in fireball script rework for pathfinder 1st by roll20

i have reworked the fireball script by Kurt to fit my pathfinder 1st Edition game. Now I ran into the problem, that I want to check the repeating feats for a certain feat and the way I have tried doesn't work. The part that isn't working can be found below (bold and bigger text) . I think the @{target|token_id} is the problem. Maybe someone can help me with that. !script {{   --/Description|Deals fireball damage to all tokens that represent creations in a 20' radius around target token   --/|Set up the card appearance     --#SourceToken|@{selected|token_id}   --Lsettings|Samuel   --#title|@{selected|character_name} casts Fireball!       --#leftsub|Save DC [*S:caster1_dc_level_3]   --/|Get a spell slot level from the caster.   --=SpellLevel|[*S:caster1_level]   --#rightsub|Slot Level: [$SpellLevel]   --/|Calculate damage based on spell slot. Fireball is 8d6 for 3rd level, so 5+SpellLevel d6 total.   --?[$SpellLevel.total] -le 10|=DamageDice;[$SpellLevel.Total]|=DamageDice;10   --=Damage|[$DamageDice.Total]d6     --/|Since we want to be able to hover over a roll and see the dice details, output the rolled damage at the   --/|top of the card. If all critters make their save, the half damage roll won't contain the details.   --+|[c][b]Damage Roll: [/b][$Damage][/c]   --+|    --/|Get all tokens on the page into the "alltokens" array   --~|array;pagetokens;alltokens;@{target|token_id}   --/|Create the "inRange" array. It will have a blank item in it to begin with, which we will remove later.   --~|array;define;inRange;   --/|Loop through all of the tokens in "alltokens" to check their distance   --~tokenid|array;getfirst;alltokens   --?[&tokenid] -eq ArrayError|endOutput   --:loopCheck|   --/|Skip targets that are not on the token layer or that don't represent creatures   --?[*[&tokenid]:t-layer] -ne objects|continue   --?"[*[&tokenid]:t-represents]" -ninc "-"|continue   --/|Check the distance between the target token and the current array token. 20 feet is 4 units   --~dist|distance;@{target|token_id};[&tokenid]   --?[$dist] -gt 4|continue   --/|If we didn't skip over this part, the token is within 20 feet, so add it to the inRange array   --~|array;add;inRange;[&tokenid]   --:continue|   --~tokenid|array;getnext;alltokens   --?[&tokenid] -ne ArrayError|loopCheck   --/|Remove the dummy first item in the inRange array   --~|array;removeat;inRange;0   --/|Loop through the inRange tokens and roll saves for each one and apply damage   --~tokenid|array;getfirst;inRange   --?[&tokenid] -eq ArrayError|endOutput   --:loopDisplay|     -->MakeSavingThrow|[&tokenid];reflex;[*S:caster1_dc_level_3];[$Damage.Total];fire;thisTokenDamage;saveResult;reflex   --+[*[&tokenid]:t-name]:|Save [$savingThrow] [r][$thisTokenDamage] fire damage[/r]   --/|Put a burn-fire visual effect on impacted tokens   --vtoken|[&tokenid] burn-fire   --/|Get the next token and continue the loop until we run out.   --~tokenid|array;getnext;inRange   --?[&tokenid] -ne ArrayError|loopDisplay   --/|Add some extra visual effects - a nova-fire at the target, and a beam-fire from source to target   --vtoken|@{target|token_id} nova-fire   --vbetweentokens|@{selected|token_id} @{target|token_id} beam-fire   --:endOutput|   --X|   --/|Subroutine to make saving throws and calculate damage amounts   --:MakeSavingThrow|tokenid;savetype;dc;damage;damagetype;damagevariable;saveresultvariable;shortabilityname   --Rfind|@{target|token_id};Entrinnen;repeating_feats;name   --?"[*R:name]" -eq "NoRepeatingAttributeLoaded"|&Entrinnen;no|&Entrinnen;yes   --+Entrinnen?|[&Entrinnen]  <   --=savingThrow|1d20 + [*[%1%]:[%2%]]   --&dmgmult|   --?[$savingThrow] -ge [%3%]|>set_string;dmgmult; \ 2   --?[$savingThrow] -lt [%3%]|>set_string;[%7%];fail   --?[$savingThrow] -ge [%3%]|>set_string;[%7%];success   --?"[*[%1%]:resist]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; -[*[%1%]:resistfire]   --?"[*[%1%]:resist]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult; -[*[%1%]:resistfire]   --?"[*[%1%]:weaknesses]" -inc "[%5%]" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult; * 1.5   --?"[*[%1%]:weaknesses]" -inc "[%5%]" -and [$savingThrow] -lt [%3%]|>set_string;dmgmult; * 1.5   --?"[&Entrinnen]" -inc "yes" -and [$savingThrow] -ge [%3%]|>set_string;dmgmult; * 0   --?"[*[%1%]:immune]" -inc "[%5%]"|>set_string;dmgmult; * 0    --=[%6%]|[%4%] [&dmgmult]    --?[$[%6%]] -lt 0|=[%6%];0   --<|   --:set_string|mod_variable;value   --&[%1%]|[%2%]   --<|     --/|Subroutine to apply damage with TokenMod. Could be replaced with alterbars or chatsetattr   --:ApplyDamageTokenmod|Parameters are [&tokenid];1;[$thisTokenDamage]   --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%]   --<| }}
Not super familiar with the Pathfinder sheet but probably want to confirm that the section is called repeating_feats. Just to confirm that bit. Also you will want to pass in the character_id into Rfind. So something in your sub to take the passed in tokenid and get the character_id from t-represents. --/|Subroutine to make saving throws and calculate damage amounts --:MakeSavingThrow|tokenid;savetype;dc;damage;damagetype;damagevariable;saveresultvariable;shortabilityname --&targetCharID|[*[%1%]:t-represents] --Rfind|[&targetCharID];Entrinnen;repeating_feats;name --?"[*R:name]" -eq "NoRepeatingAttributeLoaded"|&Entrinnen;no|&Entrinnen;yes The  ScriptCards wiki section on repeating sections . This does assume you want to check each fireball target passed in for this feat and not just the initial target token.
1702191011

Edited 1702191130
Thanks Joshua. I will give it a try. I'm not a native speaker. That makes my message a little bit unprecise.And that is the reason why I'm having problems understanding all the infos about the commands on the scriptcards wiki.
You're welcome Rholan. And your English is very very good. I wish I spoke German to be able to help you more. Let me know how that works for you and we can work through any issues you have.
You don't know that it took me hours to write that post! :D just joking! But it would be much easier in german. Your solution works fine. thanks alot.