Tablesmith Tuesday Introduction (Part 2 – Displaying a Stat Table)

Posted on Updated on

Welcome back to Tablesmith Tuesday.  Last week we talked about that Header that looms at the top of our tables, and some stylistic suggestions on what should go into the header.  This week we start talking about best practices when it comes to displaying tables.  Much like a programmer using an object-oriented approach to programming, we the table developers, want to keep certain design issues at the forefront of our thought process: expandability, readability, understandability, and most importantly reusability.

Tables can be categorized into three different types of tables.  Stat Block tables, Story Tables, and Graphic Tables.  Each style of table requires a different thought process when it comes to developing the display system.  But the systems you use to make a table: expandable, readable, understandable, and reusable are used in any category of tables.  In this episode of Tablemsith Tuesday we will take an existing table (one of mine again) and break re-write it to follow our new and improved stylistic guides.  Today we will break down a Stat Block Table and rebuild it.

Stat Block

We’ll start with an example from the  The goal of this table is to generate a random poison and output the results in a format that is consistent with our game system.  In this case D&D 3.0/.5 and Pathfinder.

1,[Tab]<u>Type</u>: [PoisonDeliveryChoose=%ChooseDelivery%]<br>
_[Tab]Intial Damage: [PoisonDamage][DisplayAff1]

_[Tab]Secondary Damage: {Reset~PoisonDamage}[PoisonDamage][DisplayAff1]

_[Tab]<u>Save</u>: Fortitude (DC[DC])<br>
_[Tab]Cost: |cost={Calc~(%basegp%+%damagetypeGPmod%+%damageamtGPmod%+%dcGPmod%+%permGPmod%)}|[AddComma.Start(%cost%)] gp

#_Cost: |cost={Calc~(%basegp%+%damagetypeGPmod%+%damageamtGPmod%+%damdieGPmod%+%dcGPmod%+%permGPmod%)}|%cost% gp

_[Tab]<u>CR</u>: {If~%CR%>10?|CR=10|}{If~%CR%<1?|CR=1|}%CR%

At first glance this looks scary, there is a lot of ‘stuff’ going on.  It is not a very elegant solution for expandability, readability, understanability, and most importantly reusability.  Though when Tablesmith displays our results it looks great.  Here ‘s that output:

Type: Inhaled
Intial Damage: 1d4 Str
: 1d6 round(s) Stun
Save: Fortitude
Cost: 1,050 gp
CR: 2

Let’s go over some of the Elements in our Tablesmith code and explain what it does. [Tab] is an often used method to do formatting.  and simply include three &nbsp’s to indent the output. [AddComma.Start(%cost%)] is a handy little table that will take your input and output an integer in easier to read format.  {Reset~ and {Calc~, are Tablesmith functions that do some really fancy behind the scenes stuff and can be found in the help section of your Tablesmith install.  The {If~ statements are being used to bound the output of the CR between 1 and 10.  When we eliminate these it makes our output table a little more readable:

1,<u>Type</u>: [PoisonDeliveryChoose=%ChooseDelivery%]<br>
_Intial Damage: [PoisonDamage][DisplayAff1]

_Secondary Damage:[PoisonDamage][DisplayAff1]

_<u>Save</u>: Fortitude (DC[DC])<br>
_<u>Cost</u>: %cost% gp<br>

So much better.  But where did all that extra code go?  No where yet.  Because we aren’t done with that Display Table.  Let’s make it uniform:

1,<u>Type</u>: %delivery_method%<br>
_Intial Damage: %primary_damage%

_<u>Secondary Damage</u>:%secondary_damage%<br>
_<u>Save</u>: Fortitude (DC%dc%)<br>
_<u>Cost</u>: %cost% gp<br>

Now it’s perfect.  So where did all that extra functionality go?  We put it in our [Generate] Table. And spread some of the code around.   Let’s look at the changes that we have made:

_|primary_damage = [PoisonDamage][DisplayAff1]|
_|secondary_damage = [PoisonDamage][DisplayAff1]|
_|dc= [DC]|
_|cost = [CalculateCost]|
_|cr = [CalculateCR]|



So an observant reader will note that all we did was add extra steps and just moved the code around from the display table to other tables.  But that’s the point!  We made our display table easier to read but at the same time we’ve accomplished two more of our items on the ‘elegant solutions’ and now we have one of a table that is pretty elegant:

expandability, readability, understandability, and most importantly reusability

If our Table has an order of operations:


Now we can accomplish anything we want! One of the most common things that we have to do with a .tab file is add a section so that we can expose the tables to other tables. The most common one is Equipment. You’ll note a lot of tables are noted by Valminder:

# -------------------------------------------------------------------
# To Comply with the Equipment.Tab Table, so that it can be seemlessly
# inserted into tables which call Equipment.Tab
# Valminder Feb 2006: "" will call the "GetPoison" subtable.

Here’s the code that Valminder had to write:


_|PoisonName=[PoisonName] (Random)||Type=[PoisonDeliveryChoose=%ChooseDelivery%]|
_|Damage=[PoisonDamage] / {Reset~PoisonDamage}[PoisonDamage] (DC[DC])|

If the table hadn’t been written so handily, Valminder would have had to do a lot more work. Even then if I had done things right in the first place he would’ve only need to do:



One thought on “Tablesmith Tuesday Introduction (Part 2 – Displaying a Stat Table)

    […] scripting elements.  It lets you do more than Fill-in-the blanks Mad-Libs, or create straight Stat Tables.  It lets you make tables that contain an internal consistency, it let’s you correct […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s