Advertisement Create a free account

Macro + Table

1560210687
I looked and could not find this asked before. How can I get a Table to roll inside of a Macro, only if the Macro rolls a certain variable? I want a Macro to roll a d20. Than if the result is a 1, I want it to roll on a table. If the result is anything but a 1, I want the Macro to post in chat "It failed"
1560211431
keithcurtis
Forum Champion
API Scripter
I'm not sure this can be done without the API. Also, conditionals are not possible in macros; they can't act one way on one die roll and another way on a different result--they don't "remember" what they have rolled. However, let's say your table has 100 entries. Create a table with those hundred entries, each with a weight of 1. Then create a result of "nothing happens" with a weight of (100*19)=1900. I think that should emulate the system, although a math genius may be along to point out where I have gone wrong. :)
1560214150
thank you very much.  not I can stop racking my brain on this. lol
1560216648

Edited 1560216799
Couldn't the table have two entries, Nothing Happened with a weight of 19 and the other result with a weight of 1? Edit:. Oh I see.  In the result of the weight of 1 you have another table.  You'd need the Recursive Tables API script for that.
1560217593
i think i got something to work.  I was trying to use a table for the wild magic. on a roll of 2 -20 the spell goes off as normal.  on a 1 there are 50 possible outcomes. so I had the table of 50 made.  I just added "the spell goes off as normal" and set it's weight to 950..   19*50   i think this is right because, for every outcome on the "wild magic surge" list, there is 19 chances that you wouldn't have rolled on that table. I don't know for sure, but it seems to work.
1560244630
Ziechael
Forum Champion
Sheet Author
API Scripter
I'm late to the party and this has already been solved but I never miss the opportunity to promote the Stupid Tricks thread ... You could do this with relative ease using the 'trick' mentioned here . In theory you would have your wild magic table as standard but renamed to '1' and a second table with only one entry in it of 'Nothing happens' named '0'. Then, your roll would only need to be: [[ 1t[[[1d20<1]]] ]]
1560249891

Edited 1560249934
I haven't tried, but this should also work if you need a name before the 1 or 0. your tables would be "magic1" and "magic0" and the macro [[ 1t[magic[[1d20<1]]] ]] I use this with querys all the time.
1560249981

Edited 1560251242
Ziechael
Forum Champion
Sheet Author
API Scripter
Interesting point, going to test that now lol edit: Bah, doesn't seem to work in any configuration I had time to try :(
1560250178
Although I have to say for this particular problem, the solution with weighing it accordingly is probably the easiest. ^^
1560260481
keithcurtis
Forum Champion
API Scripter
Ziechael said: I'm late to the party and this has already been solved but I never miss the opportunity to promote the Stupid Tricks thread ... You could do this with relative ease using the 'trick' mentioned here . In theory you would have your wild magic table as standard but renamed to '1' and a second table with only one entry in it of 'Nothing happens' named '0'. Then, your roll would only need to be: [[ 1t[[[1d20<1]]] ]] I had completely forgotten that trick!
1560590320

Edited 1560590344
To clarify my suggestion: I looked into it and found I use the script rollable table macros with it. So it might not apply here. Sorry for the confusion.