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

Macros for 1e DMG Random Dungeon Generation

January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)

Hi all,

Apologies if this has been asked and answered. I searched the forums and couldn't find it.

My friends and I were thinking of giving the DM a break and doing some really old-school Random Dungeon crawling from the back of the 1st edition AD&D Random Dungeon tables.

I started making tables and even fooled around with a little AI script help (I am no coder), but I am not really getting the result I want. Ideally I would like to create a set of macros/tables/api/script/buttons...whatever to let us push as few buttons as possible and generate a random dungeon, one room at a time (those of you who have seen it know what I mean) and encounter that room before moving on to the next room.

Many of the rolls on the DMG tables require one to go to another table and make a roll, and so on. How does one set up something like this so we can push the button, so to speak, and have it generate the random rooms for us? Essentially create a macro that rolls on a table and gives the table result, which is sometimes a macro (if tables can do this) that we can push to generate the next table result, and so on?

I fear it it going to have to be done with script, but I hold out hope someone here knows how to make it work with macros and tables. Thank you for your responses in advance.

January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)
vÍnce
Pro
Sheet Author

Hi Don,

Have a look at the Recursive Tables mod.  (Pro sub req.) I believe you'll be able to accomplish what your looking for.

https://app.roll20.net/forum/post/2845333/script-recursivetables-expands-inline-rolls-in-rollable-table-results/?pagenum=1


January 20 (3 weeks ago)
vÍnce
Pro
Sheet Author

Also Table Export/Import Mod

https://app.roll20.net/forum/post/1144568/script-tableexport-a-script-for-exporting-and-importing-rollable-tables-between-accounts


January 20 (3 weeks ago)


vÍnce said:

Also Table Export/Import Mod

https://app.roll20.net/forum/post/1144568/script-tableexport-a-script-for-exporting-and-importing-rollable-tables-between-accounts



Thank you

January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)

It was a good shot but not exactly what I needed, or I can't figure it out from there. Most of the tables which a previous table would refer to do not have inline rolls. I would post a pic from the DMG but I don't want to violate copyright.

Here is the first table in my macro sequence:




Let's say I roll Door (Table II.). I would love for the result to be a button that I could push to roll on Table II rather than the pic that appears now. Apologies if I am not describing it correctly.

January 20 (3 weeks ago)

Not sure why but my table picture isn't showing.


January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)
vÍnce
Pro
Sheet Author

You have to save images to your local environment and upload to your post.  Copy/paste seems to fail on these forums.

You can make rollable tables of text. They don't necessarily have to include inline rolls.

I think Keith Curtis has a tool to help format table data into the proper format for the Table Export mod; https://app.roll20.net/forum/permalink/5719572/


These are older scripts/mods so I'm not sure they still work.  I'm sure someone that has actually used these can better explain. I dabbled with both scripts years ago...


January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)

Thank you Vince I appreciate the help. I gutted it out and made a chat menu with macros and tables that should suffice. If only I could change the text color without popping a brain-fuse. Whoever thought pink text was a good idea... ::shiver::



The other thing that would be nice is an easy way to format the text/padding, justification, etc.:



January 20 (3 weeks ago)

Both of these can be done with relative ease - link color can be changed by adding "style= color:black; in the parentheses after the link content (for black, but you can use other colors if your liking). And you're using the default template - templates use = as the separator between the name and content of a field, and default template displays both, aligning the divider for all rows in the template. Notably, this makes changing the color of text in the name portion of a field tricky, so it's easier if you put a number and a = before each item, to put the links on the content side.

Also, this whole thing can be done without scripting, via template tricks. I can lay that out for you, if you'd like.

January 20 (3 weeks ago)
timmaugh
Pro
API Scripter

Getting a button to render from a rollable table is tricky (I won't say it can't be done, because that's when someone like Tuo or RainbowEncoder shows how it can be done). =D

However.

I know you can do it with the Metascript Toolbox. (Metascripts are a class of scripts that help other scripts and provide basic functionality Roll20 does not expose; watch this video to learn more.)

Before I begin, I should say that I don't know the system, and that I'm operating with a few basic assumptions:

1) The expected gameplay is that when your party enters a room, the GM can click a button and have the room auto-generated by reading tables, and pursuing deeper levels of info from related tables

2) For certain returns, there could be either a) choices, or b) applicable options that are dependent on circumstances or gameplay (in other words, there might be a time where you know exactly what the room is, but there might be other times where it's a "Roll from table X if a character is wearing iron" and/or "Roll from table Y if a character is actively maintaining any spell", etc.)

So.

Let's say that you have a macro/ability named "OchGetARoom"

That macro would roll against a table I'll call "BaseRoomGenerator":

!&{template:default} [[ 1t[BaseRoomGenerator] ]].items {&simple}

The BaseRoomGenerator table has items that look like this:

{{name=Storage Room}} {{Size= [[ 1t[StorageRooms] ]].items }} {{Description=..color text here...}} {{Options=<<discussed below>>}}
{{name=Cavern}} {{Size= [[ 1t[CavesAndCaverns] ]].items }} {{Description=..color text here...}} {{Options=<<discussed below>>}}
...etc...

In other words, the BaseRoomGenerator table has the template fields that will complete the original macro's call to use the default template (you can use other templates -- I just don't want to make an assumption about what system you're using, nor craft a solution that's so specific to your case that others who come across this post wouldn't be able to use it). Note that further calls to other tables (like getting the size of each room) should be structured as:

[[ 1t[TableName] ]].items

...in order to extract the text from the return and make it able to recursively descend through the table rolls.

If the roll against the table sits within a single template part (like the calls to get the Size), then the data returned should just contain text (or calls to tables that provide only text). If the data you need to return from a table contains whole template parts ITSELF, then you should put the inline roll that will retrieve said data *outside* a template part. For instance...

If a call to the StorageRooms table will return only a size (such as 24x24 ft), then the inline roll referencing the information should be in a template part:

{{Size= [[ 1t[StorageRooms] ]].items }}

On the other hand, a room may require you to roll for occupants who are present in the room. Let's say that the RoomOccupants table is structured as a series of template parts:

{{Orc=An orc sharpening his blade.}}
{{Orcs (2)=A pair of orcs are having a contest to decide who can weave the prettiest macrame.}}
{{Bog Troll=A smelly beast armed with a [[1t[WeaponRandomizer] ]].items }}

...then the call to roll a series of times against that table should be between template parts:

{{Some Part=Previous template part.}} [[ [[1d4]]t[RoomOccupants] ]].items

That would roll between 1 and 4 times against the RoomOccupants table, returning each as a new template part to be appended to the main template message. (If you were using a different template that didn't have the freedom of just naming a new template part and having it automatically be included, you could obviously structure this so that it returned within a single template part -- in fact the ".items" syntax defaults to a comma-delimited output of the returned items, so you could easily structure the table entries without the double braces that denote a template part.)

Outputting Buttons

Now, back to the idea of outputting buttons from a table in case you have to manually continue generating details. The way the Metascript Toolbox works (specifically, ZeroFrame, one of the metascripts in the toolbox) is that if you have button syntax in your table, it will output the button to chat for you. I keep a table in my game to remind me the formats that are available:


(in fact, I think I don't have all of the tricks represented, as I don't have the formats that utilize a tick mark...)

Note that the lines for a Macro button, a ZF Template button, and an FX button all have a the HTML code for a line break (i.e., &#13; ) immediately after the opening exclamation point.

So if I run a command like:

![[ 1t[TableOfButtons] ]].items {&simple}

I will get an output of a button:


And if I click on that button, it will work just as normal. If I increase the number of calls against that table:

![[ 4t[TableOfButtons] ]].items {&simple}

...I'll get that number of returns of buttons:

You can separate the returned items using characters other than a comma (for instance, line breaks might be nice). Read this post to learn more about the ".items" inline roll syntax.

One other thing... the button in that table that is the "ZF Template" option references a macro called TemplateResolutionTest. The text of that macro is:

!&{template:default}{{name=Deep Template}}{{Result=[[1t[TableOfButtons]]].items}}{&simple}

In other words, it is going to go back to the TableOfButtons and get a new button to drop into the template output. So if I get a "ZF Template" button as my return from the TableOfButtons:

...then, when I click it, I will get a new return from the TableOfButtons, this time contained in a default template layout, and returning a new random return from the TableOfButtons:


...which shows how the whole process can continue from message to message until you've built/finalized your room.


Anyway, that's a ton of info which all sort of comes into play in the process, but I can understand it might not be as clear to see how it matters when you're just starting out trying to replicate this setup. If you can't see the finish line from here, post back and I can mock this up in my own game and show a working model with screenshots.

January 20 (3 weeks ago)
vÍnce
Pro
Sheet Author

\/*\/*\/*\_ Meta-Magic™ _/*\/*\/*\/

January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)

Thank you. Now I just need to figure out how to not make it pink to preserve my retinas.

timmaugh said:

Getting a button to render from a rollable table is tricky (I won't say it can't be done, because that's when someone like Tuo or RainbowEncoder shows how it can be done). =D


January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)
vÍnce
Pro
Sheet Author

What sheet are you using?  You might get a better look(or worse...) using the sheet's roll template.

January 20 (3 weeks ago)

It's set up for 1st edition AD&D.

January 20 (3 weeks ago)

Just saw your response Tuo, thank you!

January 20 (3 weeks ago)
Gauss
Forum Champion

Tuo has that answer here
If you need more Tuo offered to help with that. 
Yes, the Default Template can accomodate other colors via CSS wizardry. 

Don H. said:

Thank you. Now I just need to figure out how to not make it pink to preserve my retinas.

timmaugh said:

Getting a button to render from a rollable table is tricky (I won't say it can't be done, because that's when someone like Tuo or RainbowEncoder shows how it can be done). =D





January 20 (3 weeks ago)

Thank you

January 20 (3 weeks ago)

Edited January 20 (3 weeks ago)
vÍnce
Pro
Sheet Author

Not sure if the 1e template will be any better for you here...


&{template:general} {{name=Random Dungeon Generator}} {{color=black}} {{=
[Table I. Periodic Check](~something)}} {{ =[Table II. Doors](~something)}} {{ =[Table III. Side Passage](~something)}} {{ =[Table III.A. Passage Width](~something)}} {{ =[Table III.B. Special Passage](~something)}}

caveats: the template was designed to center-align and it applies a "button" style to inserted hyperlinks.  You can include a backtick " ` " before each " ~ " in the button links to remove the button style, but then you will still get the pink links. (maybe apply the style="color:#000;" trick mentioned above...) To force things to be right-aligned I used "spaces" on the left of the equal sign in the key=value pairs.  (see example macro) Adding an additional space in front of the equal sign for each new row ensures the roll template doesn't only show the last version of a custom key.

example using backtick and style

&{template:general} {{name=Random Dungeon Generator}} {{color=black}} {{=
[Table I. Periodic Check](`~something "style=color:black;)}} {{ =[Table II. Doors](`~something "style=color:black;)}} {{ =[Table III. Side Passage](`~something "style=color:black;)}} {{ =[Table III.A. Passage Width](`~something "style=color:black;)}} {{ =[Table III.B. Special Passage](`~something "style=color:black;)}}




January 20 (3 weeks ago)

Thank you. It both is and isn't, but I do think it's at least easier on the eyes.