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

Nested Macro problem - TokenMod

1591199401

Edited 1591199936
I got this baseball game I'm working on, and ran into some problems with Nested Macros.  (That's a rite of passage, isn't it?) Luckily, most of my nesting is working fine.... Which, reading through for a couple hours today, I have zero idea why  any of it works. What didn't work, however, makes me pretty sad.  When looking at the "Fielding" in the game was this: ?{Which Fielding Type?|Routine,#routine-field |Difficult,#difficult-field |Very Difficult,#very-difficult-field |Highlight Reel,#highlight-reel-field } Example of the #fieldingmacros being called by that: @{selected|character_name} [[1t[very-difficult-sayings]]] /roll {1d20+ @{selected|fielding_mod}}>?{Difficulty Class|15} !token-mod --set currentside|3 So IF I delete off the !token-mod line AND take out the >?DC check, then the entire thing works fine.  I'm thinking I can just add in a piece of text for the chat that says "total must be >15" as far as the DC check goes.  I'm more disappointed not being able to set the fielder's token.  (from a standing sprite to a diving one, in this example.)  If I take out the DC check but leave Token-mod, the Which Fielding macro outputs: "Which fielding type? Routine 1 Difficult 2 Very Difficult 3 Highlight Reel 4" (the 1,2,3,4 are clearly coming from the tail-end of the currentside|n ... Not understanding at all why that's the only bit being displayed.  I tried moving the Token-Mod to the start of the macros.  That also didn't work) I'm pretty sure there's some order of operations // nesting mumbo jumbo going on here.  I just don't understand what.  I tried replacing select } with } , but that actually didn't fix my problems... I am supposing I'm replacing the wrong }, or don't have the correct punctuation in there or something ... . I tried putting these macros inside character abilities, my initial attempts at that returned the same error(s).  (Changed #-->%{@charactername|macroname}, it was pulling correctly, still not working). Lastly: Roll Templates.  I don't understand how to build a roll template.  And I'd like to if possible.  Most of these macros are basic game functions that need to be universally available.  Putting them right in the character sheet seems ideal.   But I can't figure out how to build even a basic roll template for this game! =(.  The examples cite things that I think are being referenced elsewhere in other character sheets, and I don't know how it relates to what I've got in my character sheet / game. If this is a good idea for me to pursue, if anyone could help me to turn this Macro into a Roll Template, that'd be awesome.  I think once I can write one, I'll be golden.. (I found the code button! I don't have to copy paste that anymore! =P) /em @{selected|character_name} Is bringing that High Stinky Cheddar! /roll 1d20 + @{selected|accuracy_mod} - [[@{selected|exhaustion}d2]] - @{target|contact} Strikeout Roll = [[19 + @{selected|accuracy_mod} + [[@{selected|exhaustion}d2]] - @{target|contact}]] Homerun Roll = [[1 + @{selected|accuracy_mod} + [[@{selected|exhaustion}d2]] - @{target|contact}]] !token-mod --set bar1_value|+1 (^note: I've got the Strikeout Roll and Homerun Roll on there for the player to visually inspect... From what I've read I can have a RollTemplate look for criticals/fumbles, so I assume I could have that be a lot more elegant...  Some pitches have different Critical/Fumble ranges though.  Fastball is 19-20 critical, 1 fumble.  Knuckleball is 20 critical, 1-3 fumble.  So, not sure how to write that.  [of course that's all subject to change anyway, BUT gotta figure out how best to write any of this stuff.  Sigh.  Thanks for reading!])
Sigh.  Trying to figure out this nested macro thing.  I used this Roll20 Dropdown Nester that Scott C. made..  Got it to replace my code with HTML happy stuff... : !power {{ -- @{selected|character_name} throws a sinking fastball! |[[ [$R] 1d20+@{selected|sinker_mod} ]] -- ?? $R <= 1 ?? |@{selected|character_name} watches as the ball soars out of here, that home run is gonna land in the [[1t[Home-Run-Landing]]] -- ?? $R == 2 ?? |@{selected|character_name} looks over his shoulder, that ball is carrying out to the wall! Will the [[1t[Outfield-Direction]]] be able to bring that one back in!? -- ?? $R == 3 ?? |@{selected|character_name} watches as that ball is scorched into a gap! OH no! That ball is bouncing around like it's filled with jumping beans! It looks like that's gonna be a stand-up triple -- ?? $R == 4 ?? |@{selected|character_name} watches as that ball is scorbed into a gap! And the hitter is in for an easy stand-up double. -- ?? $R >= 5 AND $R <= 7 ?? |@{selected|character_name} watches as that ball finds a hole in the defense and sneaks through for a base hit. -- ?? $R == 8 ?? |@{selected|character_name} can't find the strike zone, that's gonna be a base on balls. -- ?? $R >= 9 AND $R <= 10 ?? |@{selected|character_name} watches as this one is skied high up into the air, that Fly Ball is in play! -- ?? $R >= 11 AND $R <= 13 ?? |@{selected|character_name} watches as this one is pounded into the dirt, that Ground Ball is headed to the [[1t[Infield-Direction]]] and it is [[1t[Hit-Difficulty]]]! -- ?? $R >= 14 AND $R <= 18 ?? |@{selected|character_name} watches as this one is pounded into the dirt, that Ground Ball is headed to the [[1t[Hit-Direction]]] and it is [[1t[Hit-Difficulty]]]! -- ?? $R >= 19 ?? |@{selected|character_name} rocks back and delivers a dart! The batter is caught looking there, he stuck him out with the gravity ball!}}} After making the replacements, the macro works by itself. But the nesting Macro still is not working. Not sure what I'm missing. 
First some context: I've spent north of 6 hours trying to troubleshoot nesting macros.  I haven't kept time on it, but it's been a multi-day excursion.  I've read and re-read the Wiki start to finish.  I've read multiple forum posts on it.  I'm using this google tool I found. I know I'm missing something, just blarg.  Can't figure it out.  Next I'm gonna try to write a simpler Macro, and practice nesting simpler macros, then expand to see if I can ID where the problem might be - But wanted to ask another question: I feel like I have tried every possible iteration of changes... I am like, 98% sure I'm supposed to leave the } after Character_name alone since that's an attribute.  Since I've tried step-by-step replacing every other "problem" character, that leaves me thinking that maybe I'm missing some needed characters in my code?  Like, there should be brackets somewhere that there aren't?  I have no idea.  Grasping at straws clearly.  
I FINALLY GOT IT!!!!!  AHHHHHHHHHHHHHHHHHHH ... sorry I'm excited hah. I'm still curious about putting Macros such as this into a Roll template...  If anyone wants to add anything there, I'm all ears.  But I got this Nested crud figured out finally lol (Here's what I ended with in case some poor soul stumbles on this in the future) @{selected|character_name} throws a pitch! !power {{ --Pitch:|[[ [$FB] 1d20 + @{selected|4fastball_mod} ]] -- ?? $FB <= 10 ?? | @{selected|character_name} watches that home run is leave the stadium. -- ?? $FB >= 11 ?? | @{selected|character_name} strikes out the batter. }}