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 .
×

Macro Assistance

1547618060

Edited 1547618083
Hello People who are far more intelligent then i, I'm Trying to make a Roll querie to clear up some of the macros currently needed for my Witcher RPG game and I've come to a problem I've not been able to fix. I'm hoping someone can tell me what I'm doing wrong because from what i can see it should all work. Below is what i have so far: //Macro 1 //This is working fine for its function ?{Macro To Use| Strike,#Strike | Strong Strike,#Strong-Strike } //Macro 2 - (Strike) //I replaced the | with | //I replaced } with } [[(@{Character_Name|primary_weapon_damage})-?{Armor Rating}]] //This works as its own macro //When trying to access it through Macro 1 it returns " TypeError: Cannot read property 'substring' of undefined" //Macro 3 - (Strong-Strike) //same as above [[((@{ Character_Name |primary_weapon_damage})*2)-?{Armor Rating}]] Thank you in advance
1547630399

Edited 1547630784
Ziechael
Forum Champion
Sheet Author
API Scripter
In your nested macros you'll only need to replace the } in the armour rating query. Attribute calls don't require html replacements in a nested query. Bear in mind that if macros 2 and 3 are global macros the html will replace itself if you ever reopen the macro so once saved, leave it closed or be prepared to add the html back in again ;)
OMG @Ziechael THANK YOU SO MUCH After 4 hours of trying to work it out that's what i missed lol
1547632191

Edited 1547632226
Ziechael
Forum Champion
Sheet Author
API Scripter
It's a steep learning curve but worth the climb. As a long term sufferer of advanced macro creation myself I'd always recommend looking at using chat menus which save the need for having to do html replacements in your global macros.
1547670826

Edited 1547671032
Hello Ziechael, I've come to my next section of confusion, so taking what you have said I've made the following ?{Macro To Use| Attack, ?{Attack Type| Fast Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]]| Torso,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-1))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Arms,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-3))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Legs,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Monster Limb,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Random,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP}))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] } | Strong Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]]| Torso,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-1))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Arms,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-3))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Legs,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Monster Limb,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Random,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP}))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] } } | Grunt, ?{Attack Type| Fast Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]]| Torso, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-1))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Arms, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-3))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Legs, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Monster Limb, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Random, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP}))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] } | Strong Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]]| Torso, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-1))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Arms, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-3))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Legs, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Monster Limb, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Random, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP}))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] } } | Grunt Extra, ?{Attack Type| Fast Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]]| Torso, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-1))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Arms, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-3))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Legs, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Monster Limb, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Random, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP}))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] } | Strong Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]]| Torso, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-1))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Arms, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-3))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Legs, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Monster Limb, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Random, [[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP}))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] } } } The Macro repeats itself for alot of it but the bit where it has broken is  ?{Macro To Use| Attack, ?{Attack Type| Fast Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]]| Torso,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-1))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Arms,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-3))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Legs,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Monster Limb,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-2))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] | Random,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP}))-(d10+?{NPC Roll})]][[(@{Toby Stonebend|primary_weapon_damage})-?{Armor Rating}]] } | If i break it down even further the following works fine //working ?{Macro To Use| Attack, ?{Attack Type| Fast Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))]]| //Not working ?{Macro To Use| Attack, ?{Attack Type| Fast Strike, ?{Location| Head,[[(d10+((@{Toby Stonebend|REF}+@{Toby Stonebend|SWORDSMANSHIP})-6))-(d10+?{NPC Roll})]]| I know its the -(d10+?{NPC Roll}) that is breaking the code i just can't work out why was wondering if you had an insite, Im sure ive missed something small again Thank you
1547721788
Ziechael
Forum Champion
Sheet Author
API Scripter
Yup... you are right... again lol. You need to nest your nested html one step further for each depth of query... as the attack type is the second query } is resolved to } after your first query selection which is therefore then 'closing' the next query. For each level of depth add a amp; in there: ?{NPC Roll} becomes ?{NPC Roll} Additional levels of query can be represented with } or deeper (} etc). Enjoy following the rabbit hole ;)
1547722166
Ziechael
Forum Champion
Sheet Author
API Scripter
To save yourself a world of hurt it can be advisable to keep common elements outside of the nesting so that you don't have to worry too much about the html. As you say, it seems to repeat itself a lot, that would suggest that most of it could be the 'standard' macro with only the variables being the result of the queries... whats the difference between the various attack types (or is the above representative rather than final version)?