Quick Start

If you've entered Table Runner for the first time you'll have some sample scripts and tables loaded (if not you can reload them by clicking Clear local Storage and clicking Start with fresh database samples).

What next?

How do I save my custom scripts/tables?

Save Local - Every time you click the "Save Script" button or save table contents, your changes are written to your browser's local storage (temp space on your computer). Each time you return to Table Runner (from the same browser), your current scripts and tables are loaded from your browser's local storage. You can close your browser, take a nap, come back the next day... and your scripts/tables will still be there. You should use your local storage as sort of a "sandbox" area... eventually you'll want to save your data to something more permanent. One computer can't see another computer's local storage (but you can downlaod your saved work to any computer).

Save to Cloud - allows you to save from local storage to "the cloud" (just a fancy name for a web database). The cloud has the benefit of being a permanent storage area and your generator scripts and tables can be loaded from the cloud to any browser's local storage for tweaking (you just have to log in to get your data). You can save stuff to the cloud as "projects". Projects are a great way to keep your various generator projects nice an tidy. And if your computer ever crashes, you're scripts are saved in the cloud.

Export - Allows you to export all of your browser's local storage to a text format that you can copy and save to a text file on your computer or mobile device, email to a friend or edit by hand if you wish and then re-load into any browser.

How do I get scripts/tables back into Table Runner?

The import tools allow you to import Table Runner exports.

If you clear your local storage (make sure you've backed everything up) you'll have an option to load from cloud. You can use this tool to download your scripts and tables into the Table Runner editor.

What is the workflow?

It depends on what you want to accomplish. I'll explain below based on the task at hand.

Create a generator to add to the dxContent Library

  1. Clear browser's local storage
  2. Start with a script (give it a good clear name like 'Magic Scroll Generator v1.0'
  3. Design, Build and Test your script using Table Runner.
    1. Save often and save to the cloud after each work session (giving a meaningful project name the first time you do so).
  4. Once your script and tables are saved to the cloud - use "Distribute" (Easiest mode) to COPY your generator to the dxContent Library.
    1. Its important to realize the dxContent Generator Library is a copy of your script... any fixes you make are not cascaded to the library until you re-distribute it (and thus overwrite the old version).
  5. Fix/enhance your script as you desire using Distribute to update.

Create a generator to embed in a web-page

  1. Follow steps 1-3 above
  2. Once your script is saved to the cloud, use "Distribute" (Easier mode) to generate HTML (iFrame) that you drop into the target web site.
    1. (You can still put your cool script into the dxContent Library later if you wish).
  3. Fix and enhance your script each time you save to the cloud, the web site(s) using your generator will automatically use the latest update of your generator.

Create a generator but skip the cloud

  1. Follow steps 1-2 from above (as if building for the dxContent library)
  2. Its a good idea to save to the cloud but you don't have to. You can instead export to text files and just save them locally.
  3. Once you're generator is working as you like, use can use Distribute (Easy mode) to generate HTML (iFrame) and javascript to drop into the target web site.
  4. Fixes and enhancements will have to be re-distributed and then you'll have to re-copy and paste your HTML/javascript to the target web site.

Problems with the Cloud?

After working without an issue for weeks, IE suddenly stopped allowing a certain type of request from dxContent while Firefox and Safari remained quite happy. I had to add http://www.dxContent to IE's trusted sites and set trusted sites to the lowest level of restrictions to get it to work again. If you are having issues, you may want to temporarily try that. Tools>Internet Options>Security>Trusted Sites>Sites button and See the "Security level for this zone" area.

Help formatting

Throughout the help documentation are samples of Table Runner "script" and the output of those scripts. Script items have a white background (and Courier New font) while output has a yellow background (and Helvetica font). Some output may be in italics indicating the results are random.

Scripts

Scripts define how the random generator works. Scripts can contain references to tables (responsible for generating random content like names, places, inventory, etc.), functions (functions are useful utilities for manipulating output or generating additional content) and variables (variables are useful for storing values while a script runs).

Scripts "run" to generate content. For example the following is a script for generating a descriptive desk item.

On my desk are {Dice~1d12} [Color] [OfficeItems] in [Condition] condition.

Which might generate the following:

On my desk are 3 red pens in new condition.

A script can be set to repeat a specified number of times.

So if you ran the above script 3 times the random output might be:

On my desk are 3 red pens in new condition.

On my desk are 2 black staplers in poor condition.

On my desk are 5 silver paperclips in bad condition.


You should note all the tables a script depends on. Such notations give you the following benefits:

Dependent table notation looks like this:

#USES TABLES:Actions^Sizes^Colors#

Tables

Tables are a collection of contents. Tables are responsible for randomly serving their contents.

Tables have names. Tables with a "-" symbol for the last character have special meaning (see below).

Here is a sample "FireColor" table with its contents:

FireColor
1,Red
1,Orange

Tables can be "Normal" or "Non-repeating"

Normal tables are like the example above. Their contents do not normally change so that every time you call it, the same items are available for random generation.

Non-repeating tables (ending with a"-" sign) "lose" content as it is called (Like drawing cards from a deck). There is also a function to turn any table into a non-repeating type table (or back again).

Pre Text & Post Text

You can include text that always gets displayed before (Pre Text) and after (Post Text) content is generated from a table. In the following table, generated content would appear as "a Nickel falls out of the device." Note the spaces (in gray) after the word "a" and before the word "falls". The spaces are not required, but prevent the words from getting all jammed together. The Pre Text and Post Text are not treated as content and will never be content randomly selected from the table.

Coins
<a 
1,Penny
1,Penny
1,Nickel
1,Dime
1,Quarter
> falls out of the device.

Content

Content is found in tables. Content can be as simple as plain text, but can also include calls to other tables, call functions and utilize variables.

The number before the comma represents the number of "slots" the content takes up in a table.

In the table FireColor, there is an equal chance (probability) of getting one of two possible items because each has one "slot".

FireColor
1,Red
1,Orange

The following table represents an inventory of three dimes, two pennies, three dollar bills and a nickel. Because some identical items occupy multiple slots, there is a greater chance of those items being randomly generated.

PocketChange
3,Dime
2,Penny
3,Dollar Bill
1,Nickel

Alternately, you can write the table as follows and they will function identically (as this is how the table is represented in memory when a script is running).

PocketChange-
1,Dime
1,Dime
1,Dime
1,Penny
1,Penny
1,Dollar Bill
1,Dollar Bill
1,Dollar Bill
1,Nickel

Breaking long content into multiple lines

For content readability you may wish to break long content lines into multiple lines. You can do this with the _ character like so:

FancyColors
1,[BasicColor] [MetalType] flake
1,[BasicColor]-[BasicColor] [MixType] _
with [ApplicationType] [PatternType]

The underscore does not affect the random output. So the second item in FancyColors might result as:

Blue-Green blend with splotchy lines

Output

To display certain characters you have to precede them (called escaping) with a two forward slashes: //

For example to display a '[' you should put //[ in your script or table content.

The following characters must be escaped if you wish to display them: % | [ ] { } @ /

Table Runner Functions

Functions noted as TS compatible are "TableSmith compatible functions". They should perform similarly to their identically named TableSmith counterparts.

Functions noted as TR enhanced are function also found in TableSmith, but we've improved them for Table Runner. So they may not act the same.

{Abs~} Get the absolute value of a numberTS compatible

{Abs~1} = 1

{Abs~-1} = 1

If you want to perform this function on a mathematical expression use the Calc~ function first like so:

{Abs~{Calc~(1-5)*2}}

{And~} A Logical And test - both must be trueTS compatible

{And~1=1,2=2} = 1

{And~1>2,2=2} = 0

{And~1<1,2=2} = 0

{And~'%Class%'!='Ranger','%Class%'!='Rogue'} = 0 (Assuming variable Class contains 'Wizard')

{AorAn~} Display the A or An article based on the wordTS compatible

{AorAn~apple} = an apple

{AorAn~car} = a car

{ArrayPos~} return the item at index position

The ArrayPos function looks at the X post ion in a comma separated variable and returns that value.

%CSVBits%,a,b,c,d,e creates a variable called 'CSVBits'

{ArrayPos~CSVBits,1} = a (item in the first position)

{ArrayPos~CSVBits,3} = c (item in the third position)

{ArrayPos~CSVBits,5} = e (item in the fifth position)

{Between~} Return 4th parameter if a value is between the high and low numbers, 5th parameter if not

Format: {Between~LowValue,HighValue,CheckValue,IsBetweenReturn,NotBetweenReturn}

Check to see if the 3rd parameter (CheckValue) is > the 1st (LowValue) and < 3rd (HighValue).

If it is, the 4th parameter (IsBetweenReturn) is returned.

If not, the 5th parameter (NotBetweenReturn) is returned.

So, to display a "x" if a random value (from 1 to 100) is between 23 and 37 (has a value of 24-36), and blank if not, you'd do this:

{Between~23,37,{Dice~d100},x,}

Here are some other examples

{Between~1,10,5,Y,N} returns Y because 5 is > 1 and < 10

{Between~1,10,9,-,x} returns - because 9 is > 1 and < 10

{Between~1,10,10,,N} returns N because 10 is not > 1 and < 10

{Between~1.0,10.0,-3,Y,N} returns N because -3 is not > 1.0 and < 10.0

{Between~1,a,3,Y,N} returns N

{BetweenOrEqual~} Return 4th parameter if a value is between the high and low numbers (or equal to either), 5th parameter if not

Format: {BetweenOrEqual~LowValue,HighValue,CheckValue,IsBetweenReturn,NotBetweenReturn}

Check to see if the 3rd parameter (CheckValue) is >= the 1st (LowValue) and <= 3rd (HighValue).

If it is, the 4th parameter (IsBetweenReturn) is returned.

If not, the 5th parameter (NotBetweenReturn) is returned.

So, to display a "x" if a random value (from 1 to 100) is equal to or between 23 and 37 (has a value of 23-37), and blank if not, you'd do this:

{BetweenOrEqual~23,37,{Dice~d100},x,}

Here are some other examples

{BetweenOrEqual~1,10,5,Y,N} returns Y because 5 is >= 1 and <=10

{BetweenOrEqual~1,10,9,-,x} returns - because 9 is >= 1 and <= 10

{BetweenOrEqual~1,10,10,,N} returns a blank because 10 is >=1 and <=10

{BetweenOrEqual~1.0,10.0,-3,Y,N} returns N because -3 is not >= 1.0 and <= 10.0

{BetweenOrEqual~1,a,3,Y,N} returns N because a is not numeric

{Bold~} Boldface contentTS compatible

{Bold~new} car = new car

{Calc~} Calculate an equationTS compatible

{Calc~1+1+1} = 3

{Calc~(1+1+1)*2} = 6

{Calc~((1+1+1)*2)/2} = 3

{Calc~(((1+1+1)*2)/2)-10} = -7

{Cap~} Capitalize first letter of contentTS compatible

{Cap~apple of my eye} = Apple of my eye

{CapEachWord~} Capitalize each word in contentTS compatible

{CapEachWord~apple of my eye} = Apple Of My Eye

{CarRet~} Display a carriage returnTS compatible

line 1{CarRet~}line 2
=
line 1
line 2

{CR~} Display a carriage return - shortcutTS compatible

line 1{CR~}line 2
=
line 1
line 2

{Ceil~} round up - ceiling integerTS compatible

{Ceil~4.6} = 5

{Ceil~4.1} = 5

{Ceil~4.0} = 4

{Ceil~-2.2} = -2

If you want to perform this function on a mathematical expression use the Calc~ function first like so:

{Ceil~{Calc~(1.2+5.1)*2.3}}

{Char~} Retrieve a single character from contentTS compatible

{Char~1,abcdefg} = a (the character in the first postion)

{Char~3,abcdefg} = c (the character in the third postion)

{Char~20,abcdefg} = abcdefg (yields an error message that Xth position is beyond length of text

{Char~-20,abcdefg} = a (yields a warning assuming Xth is 1)

{ChooseRandom~} select a random item from a list of items

When you pass in a comma separated list of items, a random item will be returned.

{ChooseRandom~Wizard,Cleric,Warrior,Rogue} = a random item will be returned.

ChooseRandom is intended for simple textual choices only. Be careful with this function unlike the If~, IIf~, Loop~, While~, and others similar branching/looping functions, Chose Random does delay resolution of its contents. For example this script:

SET %Count% EQUAL TO:0;
#EXAMPLE OF HOW NOT TO USE CHOOSERANDOM#
{ChooseRandom~|Count+1|,|Count+6|}

Will result in: putting the value 7 in variable Count (because both variable operations are done) and leaving ChooseRandom with two blank choices resulting in no output.

For the above example it would be better to put the random options in a table an then call the table, like so:

SET %Count% EQUAL TO:0:
[RandomCountValue]

Table RandomCountValue could then look something like this:

1,|Count+1|
1,|Count+6|

Ensuring that Count would the only contain 1 or 6.

{Color~} Color contentTS compatible

{Color~red,my text} = my text

{Color~green,my text} = my text

{Color~#888888,my text} = my text

{CommaReplace~} Replace or insert commas into contentTS compatible

{CommaReplace~0,-,a,b,c,d,e} = a-b-c-d-e

{CommaReplace~1,-,a-b-c-d-e} = a,b,c,d,e

{Count~} Count the number table contentsTS compatible

{Count~BasicColors} = 7*

*Where BasicColors is a table containing Red, Orange, Yellow, Green, Blue, Indigo, and Violet

{Debug~} Display useful script debugging informationTR enhanced

{Debug~} Debug will display in the debug messages area detailed information about markers that it has found and processed so far along with the contents/status of tables.

{Dice~} Generate random values using a dice-like systemTR Enhanced

Use the Dice function to generate random values. You can use combinations of dice and include math operations. In addition you can specify how many low dice to drop, high dice to keep or re roll results at or bellow a certain value. Lastly you can designate dice to "explode" in value (each time the die maxs out, an additional roll is added to it.)

{Dice~1d1} = 1

{Dice~1d13} = results in a value between 1 and 13

{Dice~3d6/3} = results in a value between 1 and 6

{Dice~1d100} = results in a value between 1 and 100

{Dice~1d100+1d4} = results in a value between 2 and 104

{Dice~5d6v2} = roll 5d6, drop the two lowest rolls

{Dice~4d6^3} = roll 4d6, keep the highest three rolls

{Dice~4d6r5} = 24 (roll 4d6, re-roll any die result of 5 or less)

{Dice~2d6e} = e stands for 'exploding' so maximum dice rolls yield an additional die.

Re-rolls: if your re-roll threshold is the same value as the number of sides on the dice, re-roll will not occur (example: 1d6r6)

{D20PFSRDCreatureLink~} convert Pathfinder creature names into hyperlinks directly to corresponding d20pfsrd.com

{D20PFSRDCreatureLink~White Dragon, Young} = White Dragon, Young

The actual HTML href value looks like this: http://3pp.d20pfsrd.com/white-dragon-young

You may have two play with the name when the creature name is composed of multiple words so that it matches the pfd20srd naming conventions. Please note that this function uses their alias linking service.

{D20PFSRDSpellLink~} convert Pathfinder spell names into hyperlinks directly to corresponding d20pfsrd.com

{D20PFSRDSpellLink~Cure Moderate Wounds, Mass} = Cure Moderate Wounds, Mass

The actual HTML href value looks like this :http://www.d20pfsrd.com/magic/all-spells/c/cure-moderate-wounds

{DS~}*** TS compatible

The DSxxx (Add, Calc, etc) TableSmith data set style functions are not compatible.

{Extern~} External callTS compatible

The TableSmith Extern function is not supported.

{Find~} Return the location of text found within other textTS compatible

{Find~1,a,aabb-aabb} = 1

{Find~1,-,aabb-aabb} = 5

{Find~5,a,aabb-aabb} = 6

{Floor~} Round down - floor integerTS compatible

{Floor~1.9} = 1

{Floor~1.3} = 1

{Floor~1.0} = 1

{Floor~-2.9} = -3

If you want to perform this function on a mathematical expression use the Calc~ function first like so:

{Floor~{Calc~1.6+2.1}}

{FormatNum~} Format numeric values with appropriately placed commas

{FormatNum~1237845 = 1,237,845

{Generate~} Create a link that will delay content generation until clickedTR Enhanced

The Generate function is not resolved in a "run". It is only resolved when clicked on. This allows for content that is fleshed out later.

Mode 1

{Generate~0,Click for content,Colors} = Click for content*

*when clicked, this will yield a result from the "Colors" table.

Mode 2

{Generate~0,Generate Mission,Your Mission Is} = Generate Mission*

*when clicked, this will yield a result from the "Your Mission Is" script.

{If~} A or B path branching based on a comparisonTS compatible

{If~1=1?A/B} = A

{If~1=2?A/B} = B

{If~1=1?A} = A

{If~1=1?/B} = (nothing returned)

{If~1=2?/B} = B

NOTE: if you do not have an option for the false (B) branch, do not include the slash... otherwise Table Runner will think you wish to display a "}"

You can check for compound conditions using the functions: {And~} {Or~} like so:

{If~{Or~'%Race%'='Elf','%Race%'='Half-Elf'}=1?[ElfWeapon],[NormalWeapon]}

{IIf~} A or B path branching based on a comparison - alternateTS compatible

{IIf~1=1:A/B} = A

{IIf~1=2:A/B} = B

{IIf~1=1:A} = A

{IIf~1=1:/B} = (nothing returned)

{IIf~1=2:/B} = B

NOTE: if you do not have an option for the false (B) branch, do not include the slash... otherwise Table Runner will think you wish to display a "}"

{InputButtons~} Act on a button press from a user

With this function you can present the user with a selection of buttons, each with their own name and value when clicked.

{InputButtons~Click your class,Wizard,1,Fighter,2,Rogue,3,Cleric,4} =

See also InputList and InputText

{InputList~} Get a list selection from the userTS compatible

{InputList~,Select a name,Jeff,Tom,Frank} = * (no default selection)

{InputList~1,Select a name,Jeff,Tom,Frank} = * (Jeff is default selection)

{InputList~3,Select a name,Jeff,Tom,Frank} = * (Frank is default selection)

{InputList~9,Select a name,Jeff,Tom,Frank} = * (no default selection, yields a warning message)

* The item selected will be inserted into the results.

{InputText~} Get input from the userTS compatible

{InputText~,Enter a name} = *

* The item selected will be inserted into the results.

{Italic~} Italicize textTS compatible

{Italic~new} car = new car

{Iteration~} Get the current repeat the script is onTS compatible

Repeat #{Iteration~} = Repeat #1 (when repeat is on the first repeat)

Repeat #{Iteration~} = Repeat #2 (when repeat field >1 and on the second repeat)

{LCase~} Convert text to lower case~}TS compatible

{LCase~MEAT} = meat

{LCase~Car} = car

{LCase~apple} = apple

{Left~} Retrieve x number of characters from the left sideTS compatible

{Left~1,ABCDEF} = A

{Left~3,ABCDEF} = ABC

{Left~90,ABCDEF} = ABCDEF

{Length~} Get the length of a string of charactersTS compatible

{Length~ABCDEF} = 6

{Length~0123456789} = 10

{Length~} = 0

{Line~} Insert a HTML horizontal rule/line into the outputTS compatible

aaa{Line~}bbb
=
aaa
bbb
aaa{Line~left,10px}bbb
=
aaa
bbb
aaa{Line~left,75/%}bbb
=
aaa
bbb
aaa{Line~,50/%}bbb
=
aaa
bbb
*In order to utilized the % symbol, you must escape it with a / (forward slash) character.

{Lockout~} Prevent specific content in a tableTS compatible

You can use the Lockout function to temporarily prevent specific table content from being randomly selected. Consider the following table:

Condition
6,New
1,Bent
1,Dented
2,Scratched
1,Rusty

{Lockout~Conditions,2} prevents the Bent (row 2) content from being randomly selected.

{Lockout~Conditions,1,4} prevents the New (row 1) and Scratched (row 4) content from being randomly selected.

{Lockout~Conditions,3-5} prevents the rows 3-5 from being randomly selected (Dented, Scratched and Rusty).

To unlock rows (enable content for random selection) use the Unlock function.

{Log~} Append to a log areaTS compatible

The Log function will append comments to the specified text area (if the area doesn't exist, it will create it).

{Log~Notes,Character Name:[RandomName]} will append the results of the RandomName table to the 'Notes' log.

{LogNew~} Write to a new log areaTS compatible

The LogNew function will clear the specified text area (if it exists) and write comments to it.

{LogNew~Notes,Character Name:[RandomName]} will clear 'Notes' log and write the results of the RandomName table it.

{Loop~} Repeat a section of script X timesTS compatible

{Loop~3,--[Colors]--} = --Red----Blue----Yellow--

{MakeForm~} Creates fancy import forms

With MakeForm~ you can add multiple text inputs, pick lists and radio-style buttons to a single "screen". Each input item can have a label to the left and optional help text to the right. You can also add instructions, a custom title and change the column widths. For example lets say we want a form that looks like this:

Equipment Options
Configure your equipment options.
Quality:
describe the over equipment quality.
Belt size (in mm):
don't enter mm
Belt Types:
Metal options:
Metal Type:
Enter metal type
Vendors from the Northern Reaches have higher quality good, but cost more to the player.
Vendor:
Northern
Other
Select an equipment vendor.

MakeForm is can be a complicated function. For assistance, use the Form Builder tool to assist in complex form construction.

The following script will create variables for the input fields, display the form. When the user clicks OK the input is placed in the appropriate variables. The last part of the script display the users input from the form. Here is the script:

1 2 3 4 5 6 7 8 9 10 11    12 13 14 15 16 17 18 19 20 21
SET %EQual% EQUAL TO:;
SET %BLTSize% EQUAL TO:;
SET %BLTType% EQUAL TO:;
SET %BLTMetalType% EQUAL TO:;
SET %EVend% EQUAL TO:;

{MakeForm~150*200*150*Equipment Options
*I;IMain;Configure your equipment options.;S
*T;EQual;Quality;Average;P;describe the over equipment quality.
*T;BLTSize;Belt size (in mm);8;N,POS;don't enter mm
*PL;BLTType;Belt Types;0;cloth,metal,leather;2,1,3;;
DS(BLTMetalType,1)-DH(BLTMetalType,2,3)-DS(IMetal,1)-DH(IMetal,2,3);S
*I;IMetal;Metal options;H
*T;BLTMetalType;Metal Type;;P;Enter metal type;H
*I;IVend;Vendors from the Northern Reaches have higher quality good, but cost more to the player.;S
*R;EVend;Vendor;0;Northern,Other;N,O;Select an equipment vendor.}

EQual: %EQual%
BLTSize: %BLTSize%
BLTType: %BLTType%
BLTMetalType: %BLTMetalType%
EVend: %EVend%

Lines 1-5: First, we have five pieces of data (variables) that we want to capture from the user with a single form. The the data we capture will be placed in the variables EQual, BLTSize, BLTType, BLTMetalType and BLTCond - they are declared using the SET <varname> EQUAL TO:; syntax.

Lines 7-15: Next, we start the MakeForm function with {MakeForm~ and end it with } Within MakeForm~ each option or input definition is separated with an asterisk (*).

Lines 17-21: To confirm that each variable gets loaded, they are printed out at the end of the script.

Now lets look at some specific items.

Line 7: The first three numbers are the column widths for the form. The first column is 100 pixels wide, the next is 200 and the last is 150. The next value (separated by *) of Equipment Options becomes the title of the form.

Lines 8-15 define the input fields. In this example we define an I or Instruction section, two text fields (T), a pick list (PL), another instruction section (I), another (T) section, another (I) sections and finally radio checklists (R).

The format to render an I (Instruction) is I;rowname;Instructions;hide/show

I;IMain;Configure your equipment options.;S

This will display the instruction text in the middle column (same column as data entry fields)

The format to render a T (Text) row is: T;varname;label;default text;validation codes;helptext;hide/show

T;BLTSize;Belt size (in mm);8;N,POS;don't enter mm;S

So for our example's second text input:

The format to render a PL (Pick list) row is: PL;varname;label;default index;csv item list;csv value list;helptext;displayrules;hide/show;

PL;BLTType;Belt Types;1;cloth,metal,leather;2,1,3;;DS(BLTMetalType,1)-DH(BLTMetalType,2,3)-DS(IMetal,1)-DH(IMetal,2,3);S

The format to render an R (Radio checkbox group) row is R;varname;label;default index;csv item list;csv value list;helptext;displayrules;hide/show

This syntax is identical to Pick lists, so refer to the above section for assistance.

{Max~} Return the maximum value from a group of valuesTS compatible

{Max~1,-7,-5,2,9,3} = 9

{MaxVal~} Maximum value of a specific table contentTS compatible

Condition
6,New
1,Bent
1,Dented
2,Scratched
1,Rusty

{MaxVal~Conditions,1} = 6 (the last place you'll see the 'New' condition is in slot 6

{MaxVal~Conditions,3} = 8 (the last place you'll see the 'Dented' condition is in slot 8

{MaxVal~Conditions,4} = 10 (the last place you'll see the 'Scratched' condition is in slot 10

{Mid~} Retrieve characters from the middle of textTS compatible

{Mid~3,4,aaabbbccc} = bbb

{Mid~3,7,aaabbbccc} = ccc

{Mid~3,9,aaabbbccc} = c

{Mid~3,22,aaabbbccc} = (nothing exists at position 22 so nothing is returned)

{Min~} Return the minimum value from a group of valuesTS compatible

{Min~1,-9,3,8,0} = -9

{MinVal~} Minimum value of a specific table contentTS compatible

Conditions
6,New
1,Bent
1,Dented
2,Scratched
1,Rusty

{MinVal~Conditions,1} = 1 (the first place you'll see the 'New' condition is in slot 1

{MinVal~Conditions,3} = 8 (the first place you'll see the 'Dented' condition is in slot 8

{MinVal~Conditions,3} = 9 (the first place you'll see the 'Scratched' condition is in slot 9

{Mod~} Return the remainder by dividingTS compatible

{Mod~3,6} = 3

{Mod~6,3} = 0

{Mod~13,6} = 1

If you want to perform this function on a mathematical expression use the Calc~ function first like so:

{Mod~{Calc~1+5},3}

{Msg~} Display a pop-up messageTS compatible

{Msg~Your name is Lucky} = (a pop box with text saying "Your name is Lucky")

{NonRepeating~} Force a table to loose content ensuring no duplicates

{NonRepeating~Colors} Ensures that no Color from the color table will appear twice.

Non-repeating tables can run out of content which results in a warning message. Use the {Reset~} function to restore a table to full content (you may wish to make it non-repeating again).

{Note~} Display text that can be editedTS compatible

Your name is {Note~Lucky} = Your name is Lucky (Note: Lucky is editable)

{NumOrderAsc~} Sort comma separated numbers in ascending order

{NumOrderAsc~",",6,2,12} = 2,6,12

NOTE: To sort text values see the OrderAsc or OrderDesc functions

{NumOrderDesc~} Sort comma separated numbers in descending order

{NumOrderDesc~",",6,2,12} = 12,6,2

NOTE: To sort text values see the OrderAsc or OrderDesc functions

{Or~} A logical OR check - if either is trueTS compatible

{Or~1=1,2=2} = 1

{Or~1=1,2=3} = 1

{Or~1=2,2=3} = 0

{Or~1=a,2=3} = 0

{Or~'%Race%'='Elf','%Race%'='Half-Elf'} = 1 (Assuming variable Race contains 'Elf')

{OrderAsc~} Sort comma separated text in ascending orderTS compatible

{OrderAsc~",",John,Brian,Denny} = Brian,Denny,John

NOTE: To sort numerical values see the NumOrderAsc or NumOrderDesc functions

{OrderDesc~} Sort comma separated text in descending orderTS compatible

{OrderDesc~",",John,Brian,Denny} = John,Denny,Brian

NOTE: To sort numerical values see the NumOrderAsc or NumOrderDesc functions

{Ordinal~} Convert a number into its ordinalTS compatible

{Ordinal~1} = 1st

{Ordinal~2} = 2nd

{Ordinal~33} = 33rd

{Ordinal~12} = 12th

{Param~} Return a value at index positionTS compatible

The Param function looks at the X position in a comma separated variable (similar to an array) and returns the found value. You may also use the Table Runner function called ArrayPos that does the same thing.

SET %CSVBits% EQUAL TO:a,b,c,d,e; creates a variable called 'CSVBits' with the value 'a,b,c,d,e'

{Param~CSVBits,1} = a (item in the first position)

{Param~CSVBits,3} = c (item in the third position)

{Param~CSVBits,5} = e (item in the fifth position)

{Pause~} Pause the execution of a script

{Pause~} will cause the currently resolving script to halt its execution. The run button will be replaced with a resume button.

{Picture~} Display URL imageTR Enhanced

The picture function allows you to utilize images in your results.

{Picture~http://www.mywebsite.com/images/tile1.gif} displays the 'tile1.gif' graphic.

{Plural~} Pluralized a stringTS compatible

The Plural function will attempt to pluralize a piece of text. It follows a basic set of pluralization rules and is aware of a few exceptions (however is it is not perfect).

{Plural~wolf} = wolves

{Plural~arch} = arches

{Plural~piano} = pianos

{Plural~crash} = crashes

{Plural~sissy} = sissies

{Plural~kiss} = kisses

{Plural~boy} = boys

{Plural~deer} = deer

{PluralIf~} Conditional pluralize a stringTS compatible

{PluralIf~1,car} = car

{PluralIf~0,car} = cars

{Power~} Raise a number by a powerTS compatible

{Power~2^4} = 16

If you want to perform this function on a mathematical expression use the Calc~ function first like so:

{Power~{Calc~(1+3)}^2}

{Repeating~} Allows tables to repeat options

{Repeating~Colors} Ensures that all entries remaining in the Color table will remain available for random content no matter how many times the table is called.

Repeating tables do not run out of content, but converting a partially empty repeating table to non-repeating may mean some content will not appear. Use the {Reset~} function to restore a table to full content.

{Replace~} Search and replace textTR Enhanced

When calling this function, the first para mater you must specify is the character you are using to delimiter (separate) the various parameters.

The second parameter is the text you are looking for

The third parameter is the replacement text

The last parameter is the text you want to perform the search and replace on.

In this first example, we are using the comma as the delimiter, searching for xxx, replacing it with aaa in the text xxxbbbccc.

{Replace~",",xxx,aaa,xxxbbbccc} = aaabbbccc

The above format will work well anytime you are certain there are no commas in your search, replacement and target text. If there could be commas in your text components, you can specify a different delimiter as per the following examples:

{Replace~":":day:night:It was a dark, stormy, sultry and boring day.} = It was a dark, stormy, sultry and boring night.

{Replace~"$"$,$-$gold,silver,platinum,copper} = gold-silver-platinum-copper

{Replace~"7"7dogs, cats7dogs and cats7dogs, cats living together} = dogs and cats living together

You should not use # or the @ as a delimiter... Table Runner will think text between # is a comment and ignore it.

Re-roll link - allows content to be regenerated

This is not actually a function, but it is a special kind of markup that is treated similarly.

+++[Colors]+++ - displays a random result from the table Colors, but the result will be a click able link that will generate a new color when clicked.

There are some limits to what Re-roll can do. For example a blank result will be difficult to click on as would nested re-rolls.

{Reset~} Reset a table to full contentTR Enhanced

{Reset~Colors} - restores Colors to its original content, removing locks and returning it to repeating status (if it was otherwise).

{Reset~Cards-} - restores Cards to its original content, removing locks and returning it to non-repeating status*

*Because the table Cards- has the "-" symbol its default state is a non-repeating table.

{Right~} Retrieve x number of characters from the right side of textTS compatible

{Right~3,tuvwxyz} = xyz

{Round~} Round a value to the nearest whole numberTS compatible

Format:{Round~nearest decimal,value to round}

{Round~1,1.1} = 1

{Round~1,1.4} = 1

{Round~1,1.5} = 2

{Round~1,1.9} = 2

If you want to perform this function on a mathematical expression use the Calc~ function first like so:

{Round~1,{Calc~(1.5+3.1)}}

{Select~} Find the matching key and return its associated valueTS compatible

Format: {Select~SearchKey,Key1,Value1,Key2,Value2,...,KeyN,ValueN,NoMatchValue}

Select inspects Key1 - KeyN for a match to SearchKey, if it finds a match it returns the coresponding Value otherwise it returns the NoMatchValue.

{Select~1,1,Red,2,Orange,3,Blue,Colorless} = Red

{Select~2,1,Red,2,Orange,3,Blue,Colorless} = Orange

{Select~3,1,Red,2,Orange,3,Blue,Colorless} = Blue

{Select~9,1,Red,2,Orange,3,Blue,Colorless} = Colorless

{Select~9,1,Red,2,Orange,3,Blue,} = blank

{Select~Apple,Bananna,1,Orange,2,Apple,3,-1} = 3

{Select~Kiwi,Bananna,1,Orange,2,Apple,3,-1} = -1

{Space~} or {Spc~} Insert spaces into the outputTS compatible

x{Space~5}y = x     y

x{Space~1}y = x y

{Split~} Splits a value separated by commas into individual variablesTS compatible

If a variable was defined as SET %CSVBits% EQUAL TO:a,b,c,d; then the variable CSVBits is "a,b,c,d"

{Split~CSVBits,",",var1,var2,var3,var4} loads var1 with "1", var2 with "2", etc..

%var1% = a

%var2% = b

%var3% = c

%var4% = d

{Sqrt~} Returns the square root of a valueTS compatible

{Sqrt~4} = 2

{Sqrt~16} = 4

If you want to perform this function on a mathematical expression use the Calc~ function first like so:

{Sqrt~{Calc~(6+10)}}

{Status~} Display statusTS compatible

Check out the Msg, Log or Debug functions for alternatives.

{Stop~} Stop a script from continuingTS compatible

{Stop~} Halts content generation.

{TableExists~} Checks to see if a table exists or notTS compatible

{TableExists~Colors} = 1

{TableExists~Metals} = 0

{Trim~} Trim extra spaces from inputTS compatible

>{Trim~   test data   }< = >test data<

{TrimChar~} Removes the character you specify from the front and back of text

You can use this function to easily trim extra characters from the front or back of text.

{TrimChar~x,xcan we goxxx} - can we go

{TrimChar~,,this, that, theother,} - this, that, theother

{Trunc~} Drops the decimal component of a numberTS compatible

{Trunc~4.789} = 4

{Trunc~4} = 4

{Trunc~.53454} = 0

{UCase~} Converts text to all uppercaseTS compatible

{UCase~abcd} = ABCD

{UCase~aBCd} = ABCD

{Unlock~} Unlock table contentTS compatible

You can use the Unlock function to make specific locked content available for random selection. Consider the following table and assume everything was locked.:

Conditions
6,New
1,Bent
1,Dented
2,Scratched
1,Rusty

{Unlock~Conditions,2} enables the Bent (row 2) content for random selection.

{Unlock~Conditions,1,4} enables the New (row 1) and Scratched (row 4) content for random selection.

{Unlock~Conditions,3-5} enables the rows 3-5 for random selection (Dented, Scratched and Rusty).

To lock rows (disable content from random selection) use the Lockout function.

{Used~} Check to see if table content is "used" alreadyTS compatible

{Used~aaa,1} = -1 (since the table 'aaa' is not found a -1 is returned.

Assume this function happened previously: {Lockout~Conditions,1} which locks out only 1 row out of 5.

{Used~Conditions,1} = 1 (since row 1 is locked it is "used" and so a 1 is returned)

{Used~Conditions,2} = 0 (since row 2 is not locked it is "unused" and so a 0 is returned)

{Used~Conditions,999} = -1 (assuming table 'Conditions' only has 5 rows, 999 is outside the last row so a -1 is returned.

Assume this function runs: {Lockout~Conditions,1-5} rows 1-5 are locked. (assuming the table only has five rows, a Used check on any row returns 1).

{Used~Conditions,0} = 1 checks the entire table to see if anything is left and since all are used a 1 is returned.

{Version~} Returns the current versionTS compatible

{Version~} returns the current version of Table Runner.

{VowelStart~} Checks text to see if it starts with a vowelTS compatible

{VowelStart~Apple} = 1

{VowelStart~Banana} = 0

{While~} Do something while a condition is trueTS compatible

Take special care when using the while function. You'll need a variable to increment/decrement inside the while, otherwise you could find your generator in an infinite loop. Here is an example of a safe way to use the while function:

{While~%Count%<{Dice~1d6},[RandomDungeonDebris]{CR~}|Count+1|}
=
mold
broken pole arm
rubble

{Xor~} Logical exclusive ORTS compatible

{Xor~1=1,2=2} = 0

{Xor~1=1,2=3} = 1

Variables

A variable according to merriam-Webster's second definition is "A quantity that during a calculation is assumed to be capable of varying in value." Variables are not limited to simply math purposes. Variables are typically used for:

Variables Declaration

Variables should be declared first thing in a script. If you don' t declare your variables your generator may or may not work correctly. You declare variables like so:

SET %AreaType% EQUAL TO:urban;

Once the script has started the variable 'AreaType' will have the value 'urban' in it.

NOTE: Table Runner variable declaration differs from that of TableSmith.

Variables Operations

You can modify the contents of variables using the following syntax (which should be compatible with TableSmith syntax):

|<varname><operation><value>|

where:

<value> is a constant, function result, variable or table content you want to modify the variable with.

<varname> is the variable name to interact with.

<operation> can be any of the following:

You can interact with variables using the following syntax examples:

|Age+3| (if Age was 2 it is now 5)
|Age-3| (if Age was 20 it is now 17)
|Amt*1.1| (if amount was 100 it is now 110)
|Cost/2| (if cost was 12 it is now 6)
|GroupSize\3| (if group size was 8 it is now 3)
|MaxDistance>5| (assigns 5 to MaxDistance if 5 > MaxDistance)
|MinDistance<2| (assigns 2 to MinDistance if 2 < MinDistance)
|StreetName& South| (if StreetName was "Main" it is now "Main South")
|Name=Bob| (Name is now "Bob")

You can set a variable equal to another variable like so |Name=%InputName%| For example, this script

SET %NAME% EQUAL TO:Odin;
SET %NEWNAME% EQUAL TO:Bunky;

Old name: %NAME%<BR>
|NAME=%NEWNAME%|
New name: %NAME%

will output:

Old name: Odin
New name: Bunky

Table Runner is pretty forgiving when concatenating digits and then doing math on them. For example this is acceptable:

SET %A% EQUAL TO:1;
SET %B% EQUAL TO:1;

|A+3|
%A%<BR>
|A&%B%|
%A%<BR>
|A+11|
%A%

will output:

4
41
52

dxContent.com &Table Runner copyright Brian Dunn, 2011
TableSmith is copyright Bruce Gulke.