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

Needing some guidance. If this, then that?

If this, then that?  I am really new to any kind of coding. So far, I do have some basic stuff.  I have created a bunch of tables but am looking to see how to code something a bit more complicated. The first part is simple.  25% chance of Person, Creature, Thing, or Place. 1. if person is selected, it would use the resulting information gathered from 9 different tables to create a random NPC 2. If creature is selected, it would use the resulting information gathered from 1 "creature" table 3. If a thing is selected, it would select 3 random words taken from 5 separate tables (or to be easier, 1 or 2 words from each table) 4. If a place is selected, it would choose a location from 1 table.  One of the choices on that table would also be determined by a choice from another separate table. Well... I hope this makes sense and is possible. Here is the most complicated macro I have so far... it is just choosing one item from 5 separate tables: &{template:default} {{name=Type of Tavern}} {{Available Rooms=[[1t[TavernRooms]]]}} {{Quality of Tavern= [[1t[TavernQuality]]]}} {{Innkeeper=[[1t[TavernInnKeep]]]}} {{Rumors to be heard=[[1t[TavernRumors]]]}} {{Innkeeper=[[1t[TavernInnKeep]]]}} {{Customer Service=[[1t[TavernCustomerService]]]}}
Macros can't really do any 'if -> then' logic, and definitely not to the level that you're looking for.  If you have a Pro Subscription, this type of table rolling could be done with a custom API script, or possibly from the Recursive Tables script.
1612862675

Edited 1612863046
Ziechael
Forum Champion
Sheet Author
API Scripter
You could likely do it with a query: &{template:default} {{name=?{What|Tavern,Tavern}}{{ Available Rooms: [[1t[TavernRooms]]] Quality: [[1t[TavernQuality]]] Innkeeper: [[1t[TavernInnKeep]]] Rumors: [[1t[TavernRumors]]] Service: [[1t[TavernCustomerService]]] |Creature,Creature}}{{ Creature Features: [[1t[CreatureTable]]] |Thing,Thing}}{{ Table1: [[1t[ThingTable1]]] Table2: [[1t[ThingTable2]]] Table3: [[1t[ThingTable3]]] Table4: [[1t[ThingTable4]]] Table5: [[1t[ThingTable5]]] |Place,Place}}{{ Location: [[1t[LocationTable]]] Determinator: [[1t[LocationDeterminatorTable]]]} }} 3 and 4 are the tricky ones with a basic query since as Jarren rightly points out, there is no if>then logic (easily) with macros but the above should hopefully give you an idea of how you could do it as a 'best fit' scenario.
1612864331

Edited 1612864367
Oosh
Sheet Author
API Scripter
Which character sheet are you using? The 5e sheet comes with a roll template that does selective output: &{template:mancerroll} {{title=Make Stuff}} {{c1=[[1d4]]}} {{option1=[[1t[NPC1]]]}} {{option2=[[1t[Creature1]]]}} {{option3=[[1t[Thing1]]]}} {{option4=[[1t[Place1]]]}} It's a once-off trick (you can't nest templates) but it's clean.
1612865884
Ziechael
Forum Champion
Sheet Author
API Scripter
Haha, "Always read the OP dummy" <-- my mantra and something I should have actually done in this regard: The first part is simple.  25% chance of Person, Creature, Thing, or Place. Totally didn't address that part of the actual question lol
1612874943
David M.
Pro
API Scripter
Oosh said: Which character sheet are you using? The 5e sheet comes with a roll template that does selective output: &{template:mancerroll} {{title=Make Stuff}} {{c1=[[1d4]]}} {{option1=[[1t[NPC1]]]}} {{option2=[[1t[Creature1]]]}} {{option3=[[1t[Thing1]]]}} {{option4=[[1t[Place1]]]}} It's a once-off trick (you can't nest templates) but it's clean. Wha--? Where the heck did that template come from? That needs to be on the 5e templates wiki! Are there other undocumented 5e templates out there on the dark web?
1612913738
Oosh
Sheet Author
API Scripter
Well it's been around for a long time - it's in the Legacy code which is... older than my Roll20 account :) I've pointed it out a few times, but no one seemed overly interested until now... anyway, here's a beautified HTML grab of all the templates missing from the Wiki. Wiki editing isn't something I've done before, but maybe I'll get around to it... seems like loads of effort :)