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

Hit Location Macro

So I'm new at this and in a bit of a bind,  Creating a Macro for hit locations, and though I can get a Macro to roll from a specific Roll Table I can't seem to get what i'm going for. Using /w gm [[1t[Location] ]] to get location, but I have another table after that which i'd like it to read from to get a more specific result. I'll try to clarify: Rolling [[1t[Location] ]] (lets say it roll can be hand, foot, arm, leg but in this case the roll table = hand) I'd like it to roll on another table noticing it is = hand and not foot, arm, etc, to decide which finger from another roll table gets struck. I tried if else statements only to learn they are not supported.
1561951186
Pat
Pro
API Scripter
Macros are single-threaded, to put it inaccurately - they can't get a result and plug that result in because the table they roll from is a separate process/method, and they can't return anything from that process/method until the thread is released. In other words, in a macro, I can't roll on a table and store that result and use that result in the same statement. I have to release the thread first. Which usually means two separate macros. 
1561968204
GiGs
Pro
Sheet Author
API Scripter
Pat, that seems a pretty roundabout way of describing it. In simple terms, roll20 macros cannot remember previous values. There's no way to use the result of one roll in another roll. One way to get aorund this would be to combine your location tables into a single larger table. For instance let's say you have a table like 1 head, 2 body, 3 right arm, 4 left arm, 5 right leg, 6 left leg. This is a d6 roll, so 6 results. And say each location had a d6 roll to get the sublocation (like arm might be 1 shoulder, 2 upper arm, 3 elbow, 4 lower arm, 5 wrist, 6 hand) You could combine these into a single table with 36 results, which show all the sub-locations. You might still need to create the subtables for specific uses (like when someone aims specifically at the arm), but for general use, this world work. Why you'd need such specific tables to show which finger gets hit is beyond me, but this approach is the only way to do it without upgrading to Pro and using API scripting.
1562113791

Edited 1562113845
Pat said: GiGs said: Pat, that seems a pretty roundabout way of describing it. In simple terms, roll20 macros cannot remember previous values. There's no way to use the result of one roll in another roll. One way to get aorund this would be to combine your location tables into a single larger table. For instance let's say you have a table like 1 head, 2 body, 3 right arm, 4 left arm, 5 right leg, 6 left leg. This is a d6 roll, so 6 results. And say each location had a d6 roll to get the sublocation (like arm might be 1 shoulder, 2 upper arm, 3 elbow, 4 lower arm, 5 wrist, 6 hand) You could combine these into a single table with 36 results, which show all the sub-locations. You might still need to create the subtables for specific uses (like when someone aims specifically at the arm), but for general use, this world work. Why you'd need such specific tables to show which finger gets hit is beyond me, but this approach is the only way to do it without upgrading to Pro and using API scripting. Macros are single-threaded, to put it inaccurately - they can't get a result and plug that result in because the table they roll from is a separate process/method, and they can't return anything from that process/method until the thread is released. In other words, in a macro, I can't roll on a table and store that result and use that result in the same statement. I have to release the thread first. Which usually means two separate macros.&nbsp; Thank you for the responses, What I have done as a quick fix is create the /w gm [[1t[Location] ]] table, as well as a table for each location, so it looks like&nbsp;/w gm [[1t[Location] ]] = [[1t[Arm] ]], [[1t[Leg] ]], [[1t[Body] ]], [[1t[Head] ]] Which will give me the location and the sub location of each class. As much as i'd like it to single out only the table I need, this will do fine for now. It ends up looking like&nbsp;&nbsp; (To GM): &nbsp; <span class="inlinerollresult showtip tipsy-n-right" title="Rolling 1t[Location] = ( L-Leg )" style="box-sizing: content-box; background-color: rgb(254, 246, 142); border: 2px solid rgb(254, 246, 142); padding: 0px 3px; font-weight: bold; cursor: help; font-size: 1.1em; color: rgb(64, 64, 64); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;">L-Leg &nbsp;=&nbsp; <span class="inlinerollresult showtip tipsy-n-right" title="Rolling 1t[Arm] = ( Shoulder )" style="box-sizing: content-box; background-color: rgb(254, 246, 142); border: 2px solid rgb(254, 246, 142); padding: 0px 3px; font-weight: bold; cursor: help; font-size: 1.1em; color: rgb(64, 64, 64); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;">Shoulder ,&nbsp; <span class="inlinerollresult showtip tipsy-n-right" title="Rolling 1t[Leg] = ( Shin )" style="box-sizing: content-box; background-color: rgb(254, 246, 142); border: 2px solid rgb(254, 246, 142); padding: 0px 3px; font-weight: bold; cursor: help; font-size: 1.1em; color: rgb(64, 64, 64); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;">Shin ,&nbsp; <span class="inlinerollresult showtip tipsy-n-right" original-title="Rolling 1t[Body] = ( Gouge )" style="box-sizing: content-box; background-color: rgb(254, 246, 142); border: 2px solid rgb(254, 246, 142); padding: 0px 3px; font-weight: bold; cursor: help; font-size: 1.1em; color: rgb(64, 64, 64); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;">Gouge ,&nbsp; <span class="inlinerollresult showtip tipsy-n-right" original-title="Rolling 1t[Head] = ( Right Eye )" style="box-sizing: content-box; background-color: rgb(254, 246, 142); border: 2px solid rgb(254, 246, 142); padding: 0px 3px; font-weight: bold; cursor: help; font-size: 1.1em; color: rgb(64, 64, 64); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;">Right Eye
1562146555
GiGs
Pro
Sheet Author
API Scripter
Nice. Thats a decent way of working within macro limitations.