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

Help Designing Macros for rolls with player inputs.

1624666579

Edited 1624666674
For my Tomb of Anninhilation game I've been adapting the travel rules from Adventures in Middle Earth 5e to make the Hex Crawl a bit more fun but to make it a little less gruelling to figure out, I thought I'd have bash at making a macro for the embarkation roll. I've figured out the formula for inputs but I have absolutely zero backgrounding in coding and don't understand the ! and {{ }} and my initial flurries with editing existing macros have failed so is there a "Here's How to Do It FAQ"? with like copy/pasatable modular instuctions for building input screens and drop-down option lists etc? or be blunt can anyone please help me turn this into a button? 1d12 + Persuasion Modifier + 1/2 Wisdom Modifier) - (DM's Determination of Peril + Terrain.) (+ 1 if Ranger acts as Guide in Jungle Terrain only) PERIL MODIFIERS Easy: 1 Moderate: 2 Hard: 3 Severe: 4 Dreadful: 5 TERRAIN MODIFIERS Easy: -1 Moderate: +0 Hard +1 Severe: +1 Dreadful: +2 DETERMINING  DIFFICULTY Easy:  DC 13 Moderate: DC 14 Hard: DC 15 Severe: DC 16 Dreadful DC 17 Thanks! 
1624668850

Edited 1624668914
Kraynic
Pro
Sheet Author
If it was me, I might create a "character" named HexMods.  Then I would create 3 attributes (on the Attributes & Abilities tab) called peril_mod, terrain_mod, and maybe also difficulty if you wanted to print that out as part of the macro.  I would give the players edit permissions, but not make it visible in their journals, so that they could use macros that access those attributes without actually being able to get to the sheet.  I would then create a token so that I could have it on the GM layer and see the bars/values.  Then I could either edit the values by hand through the token, through TokenMod, or ChatSetAttr. I don't play 5E, so I am not really familiar with the roll templates.  I'm also not that familiar with the sheet, but I do have a test game to look up things now and then, so I think I have the persuasion and wisdom calls correct.  This would just dump everything in chat.  I expect there is a 5E roll template that would pretty it up nice though.  If you want the half wisdom mod to be rounded up, then floor needs to be changed to ceil. Navigation: [[[[1d12 + @{selected|persuasion_bonus} + floor(@{selected|wisdom_mod}/2)]] - [[@{HexMod|peril_mod} + @{HexMod|terrain_mod}]]]] Remember to add [[1]] for the Ranger in Jungle Terrain only DC is [[@{HexMod|difficulty}]]
You can use something like this in a macro with a selected token. Not sure if this is what you are asking for. (?{Peril|Easy,1|Moderate,2|Hard,3|Severe,4|Dreadful,5}?{Terrain|Easy,-1|Moderate,+0|Hard,+1|Severe,+1|Dreadful,+2} + ?{Ranger|Yes,1|No,0})&{template:default} {{name= Embarkation }}{{Result= [[1d20r<1 + @{selected|persuasion_bonus} + @{selected|wisdom_mod}/2 - ?{Peril}?{Terrain}+?{Ranger} ]]}}{{Easy=DC *13*}}{{Moderate=DC *14*}}{{Hard=DC *15*}}{{Severe=DC *16*}}{{Dreadful=DC *17*}}
Thanks for the help guys!  I was a bit busy this weekend and didn't check all my messages.   Thanks for the tips I will try them out, see if I can get them working, and come back if I have any further questions.  Cheers.
Kraynic said: If it was me, I might create a "character" named HexMods.  Then I would create 3 attributes (on the Attributes & Abilities tab) called peril_mod, terrain_mod, and maybe also difficulty if you wanted to print that out as part of the macro.  I would give the players edit permissions, but not make it visible in their journals, so that they could use macros that access those attributes without actually being able to get to the sheet.  I would then create a token so that I could have it on the GM layer and see the bars/values.  Then I could either edit the values by hand through the token, through TokenMod, or ChatSetAttr. I don't play 5E, so I am not really familiar with the roll templates.  I'm also not that familiar with the sheet, but I do have a test game to look up things now and then, so I think I have the persuasion and wisdom calls correct.  This would just dump everything in chat.  I expect there is a 5E roll template that would pretty it up nice though.  If you want the half wisdom mod to be rounded up, then floor needs to be changed to ceil. Navigation: [[[[1d12 + @{selected|persuasion_bonus} + floor(@{selected|wisdom_mod}/2)]] - [[@{HexMod|peril_mod} + @{HexMod|terrain_mod}]]]] Remember to add [[1]] for the Ranger in Jungle Terrain only DC is [[@{HexMod|difficulty}]] Hi Kraynic,  I just tried out your solution to my query and encountered the following error. SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "H" found. I followed your instructions ( create token with sheet*, added Peril, Terrain and Difficulty as Attributes on the 3rd Tab, created a token, used ChrSetAttr to rig the settings to the value I wanted. ) Copy pasted the macro - and hit test macro and that is what it comes back with.   I am frankly unsure what it is telling me other than It didn't find what it was looking for and bugged out. Can you please provide any further instruction on what it would take to fix this? Thanks! *does it matter if the sheet is an NPC or a PC?  I went with PC, as it is simulating a player making the rolls.
1624861915

Edited 1624943878
aikidosama said: You can use something like this in a macro with a selected token. Not sure if this is what you are asking for. (?{Peril|Easy,1|Moderate,2|Hard,3|Severe,4|Dreadful,5}?{Terrain|Easy,-1|Moderate,+0|Hard,+1|Severe,+1|Dreadful,+2} + ?{Ranger|Yes,1|No,0})&{template:default} {{name= Embarkation }}{{Result= [[1d20r<1 + @{selected|persuasion_bonus} + @{selected|wisdom_mod}/2 - ?{Peril}?{Terrain}+?{Ranger} ]]}}{{Easy=DC *13*}}{{Moderate=DC *14*}}{{Hard=DC *15*}}{{Severe=DC *16*}}{{Dreadful=DC *17*}} Hi Aikidosama,  THANK YOU SO MUCH!    - This was exactly the kind of thing I had envisioned, a series of drop down menus choices that kicks out a result - that is AMAZING and it works PERFECTLY ! One question I have, however, is about Order of Operations in applying the maths. Looking at the results in the chat when I selected the ranger's token and ran the macro  I rolled a 7 on the D12 (I altered it from the D20)  and the resulting sum total was a 10. Hovering over the result gave me the working out which was  Rolling1d12r<1 + 3 + 2/2 - 3 +1 +1 = (7)+3+2/2 -3+1+1   The last three digits are the DM's modifiers for how easy/difficult the exploration phase is and whether the Ranger's skills benefits them. I just want to make sure that the Peril_Mod and the Terrain_Mod are Subtracted from the result (as that makes the outcomes on my results table worse) while the Ranger's Exploration bonus is Added to the result (which will make the results more favourable to the party.) Would it make more sense to put the Ranger's Bonus on the side of the equation which is calculating the PC's Character sheets attributes (performance, wisdom) becuase they are additive . And group the DMs Modifers in parantheses so that they can be subtracted together ? Other than this minor tweak to ensuring the code processes the inputs in the correct order, which I would still appreciate your help with so I don't screw up the code, this faboulous macro does exactly what I wanted so thank you again.
1624888864
Kraynic
Pro
Sheet Author
I probably won't have the time to set it up in a test game and see what is going on until I get home from work this evening.  If your needs are filled by the other solution, then I won't bother!
Kraynic said: I probably won't have the time to set it up in a test game and see what is going on until I get home from work this evening.  If your needs are filled by the other solution, then I won't bother! Thank you so much for your help with this Kraynic, I really appreciate the communities willingness to help out those of use who are hopeless at this sort of thing get the results we desire.   Aikidosama's solution was more what I had in mind functionally but I do want to express my sincere thanks for your time taking in working on my problem. 
1624957669
Ziechael
Forum Champion
Sheet Author
API Scripter
I may have reworded the reported spam attempt somewhat but I think it makes more sense than the original attempt... jeffrey9631 said: I'm a spammer, I've been reported and soon I shall be no more... worry not dear users for my time here is fleeting and my attempt to drive traffic elsewhere was pathetic and fruitless.
Ziechael said: I may have reworded the reported spam attempt somewhat but I think it makes more sense than the original attempt... jeffrey9631 said: I'm a spammer, I've been reported and soon I shall be no more... worry not dear users for my time here is fleeting and my attempt to drive traffic elsewhere was pathetic and fruitless. What spam attempt? Did I miss something?
(DM) RH said: Ziechael said: I may have reworded the reported spam attempt somewhat but I think it makes more sense than the original attempt... jeffrey9631 said: I'm a spammer, I've been reported and soon I shall be no more... worry not dear users for my time here is fleeting and my attempt to drive traffic elsewhere was pathetic and fruitless. What spam attempt? Did I miss something? Bot accounts will randomly post almost natural sounding gibberish on various posts here daily.  They get reported and removed, but sometimes it's amusing to poke fun at them before they disappear.