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

Corrupted Macro (Scriptcards) - Haunted by a ghost

I am using a macro that David M posted on the 1st edition character sheet page.    It works great.. however, there is a ghost haunting it What it does:  This macro will find all the weapon attacks on a character sheet, create a menu that lets me choose the weapon.  Once I choose the weapon, I can then enter mods, select a target and attack happens. What happens when it breaks:  When I run it, it immediately asks for a target and the user mods prior to showing the weapon menu. Once I select a weapon, it then attacks, but it messes up all the little things that happen (crits, fumbles, token-mod, etc) since it not working as intended. How to break it: I first copied the Macro into Notepad Once in Notepad, I can copy and paste it into chat, run it - it works fine If I copy it into a Macro and save it - It works fine This is where it gets fun... If I open up the macro (without touching the macro code) and re-save it.. it breaks it If I open up the macro to even just check the "show as token action" button - it breaks it If I open up the macro to select which players can see it - it breaks it If I open it up just to hit the Test Macro button - it breaks it Once it is broken, I can not even copy it out and back in.. it will still be broken.  I have to re-copy it from the notepad file that I now have saved to fix it. Has anyone seen anything like this in the past? have any idea what could cause this to behave like this?   Btw, there are no errors in Console Output. Here is a copy of the script if it helps Thanks in advance !script {{ --/|SCRIPT NAME: Attack-Menu-Basic --/|SETTINGS --=Crit_Multiplier|2 --/|FORMATTING --#titleCardBackground|#4d1635 --#titlecardgradient|1 --#tableShadow|0 --#oddRowBackground|#ffffff --#emoteState|visible --#emoteBackground|#f2f2f3 --#emotefont|Contrail One --#emoteFontColor|#4d1635 --#emoteFontWeight|regular --#emoteFontSize|16px --#bodyFontFace|Tahoma --#bodyFontSize|14px --#outputtagprefix|  --#nominmaxhighlight|1 --#buttonBackground|#4d1635 --#buttonFontFace|Tahoma --#buttonFontSize|14px --/|SCRIPT --#sourceToken|@{selected|token_id} --#reentrant|Attack_Menu_@{selected|character_id} --#whisper|self --#title|@{selected|token_name}'s Weapons Menu --#emoteState|invisible --&SelectedId|[*S:character_id] --Rfirst|[&SelectedId];repeating_weapon --&Buttons| --/|WEAPON LIST --?"[*R:weapon_name]" -ne "NoRepeatingAttributeLoaded"|[ --=Count|1 --:Weapon_Display| --&Button|[t][td style="text-align:left; padding: 0px 0px 0px 5px"][rbutton][*R:weapon_name]::PERFORM_WEAPON_ATTACK;[=[$Count.Raw]-1]|@{target|token_id}[/rbutton][rbutton]Adj::PERFORM_WEAPON_ATTACK;[=[$Count.Raw]-1]|@{target|token_id}|?{To Hit Adj.|0}|?{Damage Adj.|0}|?{Target AC Adj. (Negative values make AC Worse)|0}[/rbutton][/td][/t] --&PrintLine|+ [&Button] --=Count|[$Count] + 1 --Rnext| --?"[*R:weapon_name]" -ne "NoRepeatingAttributeLoaded"|Weapon_Display --+|[&PrintLine] --]| --X| --/|EXECUTE ATTACK --:PERFORM_WEAPON_ATTACK| --/|1=Weapon Slot, 2=Target Token ID, 3=User Attack Adj, 4=User Damage Adj, 5=User AC Adj --~params|string;split;|;[&reentryval] --?[$paramsCount] -eq 2|SKIP_USER_DEF_PARAMS --=UserEnteredAttackAdj|[&params3] --=UserEnteredDamageAdj|[&params4] --=UserEnteredTargetACAdj|[&params5] --:SKIP_USER_DEF_PARAMS| --&TARGET_TOKEN_ID|[&params2] --#targetToken|[&TARGET_TOKEN_ID] --=WeaponRow|[&params1] --Rbyindex|@{selected|character_id};repeating_weapon;[$WeaponRow] --&WeaponName| --&WeaponName|+[*R:weapon_name] --#whisper| --#emoteState|visible --#emoteText|[*S:t-name] attacks [*[&TARGET_TOKEN_ID]:t-name]! --#title|[*S:t-name]'s [&WeaponName] Attack --=AttackRoll|1d20 + [*R:weapon_tohitbonus] [BON] + [*R:weapon_magicbonus] [MAGIC] + [$UserEnteredAttackAdj] [USER] --=AC_Hit|[*S:thac00] - [$AttackRoll] --+Weapon|[&WeaponName] --=TargetAC|[*T:armorclass] - [$UserEnteredTargetACAdj] --+AC Hit|[$AC_Hit] ([$AttackRoll]) vs Target AC [$TargetAC] -->CHECK_FOR_CRIT| --=Damage_SM|[*R:weapon_damagesmallmedium] + [*R:weapon_attackdmgbonus] [BON] + [*R:weapon_magicbonus] [MAGIC] + [$UserEnteredDamageAdj] [USER] --=Damage_LG|[*R:weapon_damagelarge] + [*R:weapon_attackdmgbonus] [BON] + [*R:weapon_magicbonus] [MAGIC] + [$UserEnteredDamageAdj] [USER] --=Crit_Damage_SM|[$Damage_SM] * [$Crit] --=Crit_Damage_LG|[$Damage_LG] * [$Crit] --?[*T:size2] -ne L|Skip_LG_DMG --+Damage|[$Damage_LG] vs LG --?[$Crit] -eq 1|Skip_Crit_LG --+Critical Hit!|Damage is [$Crit_Damage_LG] vs LG --:Skip_Crit_LG| --^Skip_SM_DMG| --:Skip_LG_DMG| --+Damage:|[$Damage_SM] vs S/M --?[$Crit] -eq 1|Skip_Crit_SM --+Critical Hit!|Damage is [$Crit_Damage_SM] vs S/M --:Skip_Crit_SM| --:Skip_SM_DMG| --?"X[*R:weapon_notes]" -eq X|Skip_Notes --+Notes|[*R:weapon_notes] --:Skip_Notes| --X| --:CHECK_FOR_CRIT| --=Crit|1 --?[$AttackRoll.Base] -eq 20|=Crit;[$Crit_Multiplier] --/|Put more crit stuff here. For example, you can use one the unused fields for Crit chance if less than 20 and add a different multiplier based on weapon --/|=CritValueforWeapon|[*R:weapon_space] --/|[$AttackRoll.Base] -ge [$CritValueforWeapon]|=Crit;[$Crit_Multiplier] --<| }}
1675197305

Edited 1675197378
Gauss
Forum Champion
My guess, you are putting it into the Collection tab macros? That may be what is breaking it.  Some kinds of code, such as HTML entities revert when put into a Collection tab and then opened up again for editing.  Put it in the Ability macro on a character sheet, especially a Macro Mule, then call it from the Collection tab macro.  With that said, the above looks like it is part of an API script, so you might want to post in the Mod (API script) forum to guarantee that the folks responding are API folks. 
It breaks on a character sheet also for me. First thing I tried Thank you for the suggestion.  I am at a loss
1675203642
David M.
Pro
API Scripter
There are definitely HTML entities in that scriptcard (the  @  for the @'s and the  ?  for the ?'s) They' re in this line: --&Button|[t][td style="text-align:left; padding: 0px 0px 0px 5px"][rbutton][*R:weapon_name]::PERFORM_WEAPON_ATTACK;[=[$Count.Raw]-1]|@{target|token_id}[/rbutton][rbutton]Adj::PERFORM_WEAPON_ATTACK;[=[$Count.Raw]-1]|@{target|token_id}|?{To Hit Adj.|0}|?{Damage Adj.|0}|?{Target AC Adj. (Negative values make AC Worse)|0}[/rbutton][/td][/t] Gauss' suggestion *should* work, assuming you are copying them from the correct source. When you paste them into a character sheet ability, check that line and make sure they should up as the replacement value and not the resolved character. BTW, this must have been the other David M. that is floating around the forums, because I don't remember writing that!
Lol yes there is another one :-)  Thanks, I will try again