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 Poison.tab.  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.

;PoisonGameStats
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
Secondary
Damage
: 1d6 round(s) Stun
Save: Fortitude
(DC11)
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:

;PoisonGameStats
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>
_<u>CR</u>:%CR%

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:

;PoisonGameStats
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>
_<u>CR</u>:%CR%

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:

;GeneratePoisonStats
1,|delivery_method=[PoisonDeliveryChoose=%ChooseDelivery%]
_|primary_damage = [PoisonDamage][DisplayAff1]|
_{Reset~PoisonDamage}
_|secondary_damage = [PoisonDamage][DisplayAff1]|
_|dc= [DC]|
_|cost = [CalculateCost]|
_|cr = [CalculateCR]|

;CalculateCost
1,|cost={Calc~(
_%basegp%+
_%damagetypeGPmod%+
_%damageamtGPmod%+
_%dcGPmod%+
_%permGPmod%)}|
_[AddComma.Start(%cost%)]

;CaluclateCR
1,{If~%cr%>10?|cr=10|}
_{If~%cr%<1?|cr=1|}

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:

;Start
1,[GeneratePoisonStats]
_[DisplayPoisonStats]

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: "Equipment.tab" will call the "GetPoison" subtable.

Here’s the code that Valminder had to write:


:GetPoison
1,[PoisonGameStats2]%PoisonName%;%Cost%;1;%Type%;%Damage%;0;%CR%


;PoisonGameStats2
1,|Cost=0||CR=0||basegp=0||damagetypeGPmod=0||damageamtGPmod=0||dcGPmod=0||permGPmod=0|
_|PoisonName=[PoisonName] (Random)||Type=[PoisonDeliveryChoose=%ChooseDelivery%]|
_|Damage=[PoisonDamage] / {Reset~PoisonDamage}[PoisonDamage] (DC[DC])|
_|Cost={Calc~(%basegp%+%damagetypeGPmod%+%damageamtGPmod%+%dcGPmod%+%permGPmod%)}|
#_|Cost={Calc~(%basegp%+%damagetypeGPmod%+%damageamtGPmod%+%damdieGPmod%+%dcGPmod%+%permGPmod%)}|
_{If~%CR%>10?|CR=10|}{If~%CR%<1|CR=1|}

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:

:GetPoison
1,%PoisonName%;%Cost%;1;%Type%;%Damage%;0;%CR%

Advertisements

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:

WordPress.com Logo

You are commenting using your WordPress.com 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