Documentation version 1.0 , 2009-12-19
Dataset of varying patronage: $Fill{}
Usually, a dataset describes a certain table with a certain
number of characters sitting there, and this number is reflected in the
race flags of the dataset. Based on this flag, the description selection
algorithm can choose descriptions which fit to the size of the
table in the map and to the race-settings made by the user. So far, so good.
However, sometimes one wants to create a rather generic
description without defining the actual number of characters seated here. Such
descriptions could be selected for any table size,
but still the description text should match the size of the table in the map.
To achieve this, the $Fill{} command can be used as a
variable which will be replaced by the number of empty seats of the
selected table. Complicated? It is best explained with an example:
Example 1:
SCRIPT |
PREVIEW-RESULT |
A this table sit $Fill{} dwarves happily together and drink. |
when used for a table
description of 4 seats: |
Such a versatile command has some implications which lead to some additional rules and restrictions:
How calculates TavernMaker the race-percentage to properly
reflect the setting, if the number of characters is unknown?
To solve this, the “filled” seats are attributed to the race which is set in
the race-flags as “fill”. This is done by adding a race as usual,
selecting it, and pressing the Fill button right of the list. The
selected race-flag will then have an additional * sign next to is number,
e.g.: (R) gnomes {0*}
Additionally, the field “count” which defines the minimum size of a
table for which this dataset is suitable will read “X + fill”.
Note, that only one race-flag can be assigned to “fill” and that all “filled” seats are attributed to this race.
The next complication is with respect to grammar: Should one used singular or plural verb forms together with $Fill{}?
Here, we have simply decided to always use
plural forms. To achieve this, $Fill{}is always replaced by a number 2 or higher.
Implicitly, this also means that a table using the $Fill{}command has to have at least two seats, and one-seat
tables will never
select such a dataset. Again a simple example:
Example 2:
SCRIPT |
PREVIEW-RESULT |
A this table sit $Fill{} dwarves happily together and drink. |
when used for a table
description of 4 seats: |
Can I used $Fill{} at tables of mixed races? Can I define a minimum of characters?
Yes & yes. Simply write descriptions and set race flags
as usual. Then add the “fill” tag to one of those races. Think of this flag
as an “plus at least 2 characters of that race” flag. See the following
example:
Example 3:
SCRIPT |
PREVIEW-RESULT |
A this table
sit $Fill{} male dwarves happily together with one female dwarf and 2
gnomes. |
when used for a table
description of 5 seats: |
What happens if I preview my
dataset using F4?
Obviously, when previewing a dataset without actually populating a map, the
algorithm does not have a “size” of the table. Thus,
in this preview $Fill{}is
simple replaced by a random number 2 or higher. This number is randomly
chosen and each appearance
of $Fill{}gets a
different random number. During real evaluation, however, all appearance
of $Fill{}will
be replaced by the same
(calculated) value. Don’t let yourself be fooled by the sometimes incorrect
logical content of a previewed dataset containing $Fill{}.
You can avoid this problem by using variables, and assigning the $Fill{}value to this
variable in the beginning. This, however, will
only make a difference for the preview, not during the actual population of a
tavern. For an example, see at the end of this tutorial.
Are there other things I
have to pay attention to?
Yes, using the $Fill{}command makes it hard to estimate a proper amount of items/coins
in the pick-pocket list, as the same
absolute amount can be too much or not enough depending on the final number of
seats of the table. Look at the following examples
of properly and incorrectly designed descriptions:
Example 4:
SCRIPT |
PREVIEW-RESULT |
At this table sit $Fill{} rich dwarves
and drink. |
when used for a table
description of 2 seats: |
Example 5:
SCRIPT |
PREVIEW-RESULT |
At this table sit $Fill{} rich dwarves
and drink. |
when used for a table
description of 2 seats: |
Note, that in the example above, I correctly replaced each $Fill{} by the same
number, as would happen during table population.
During F4-preview, however, the number will not match.
Another elegant way of dealing with this problem is the $ForEach{} command,
which loops a certain script line depending on a
variable. The command is described in more detail later (see tutorial).
This example also makes use of a variable “fillVar”. However, this is purely to ensure that the F4-preview results correctly.
Example 6:
SCRIPT |
PREVIEW-RESULT |
$NewVar{fillVar,integer,1,$Fill} $NewVar{count,integer} At this table sit $Var{fillVar} rich dwarves and drink. $ForEach{count,[1..fillVar], <Dwarf #$Var{count} carries $Random{20} gold coins >} |
when used for a table
description of 2 seats: Dwarf #1 carries 20 gold coins Dwarf #2 carries 22 gold coins Dwarf #1 carries 19 gold coins Dwarf #2 carries 21 gold coins Dwarf #3 carries 21 gold coins Dwarf #4 carries 22 gold coins Dwarf #5 carries 19 gold coins Dwarf #6 carries 21 gold coins Dwarf #7 carries 19 gold coins |
Finally, I would like to show one more complicated example
of using $Fill{}
together with logical commands (see tutorial 3).
Example 7:
SCRIPT |
PREVIEW-RESULT |
$NewVar{test,integer,1,$Fill{}} At this table sit $Var{test} dwarves and discuss. $If{$=={$Var{test},2},<They are shouting at each other.>,<$If{$>={$Var{test},6},<They have split into three groups of different opinion.>,<They form two opposing groups.>}>} |
when used for a table
description of 2 (or 3) seats: when used for a table
description of 6 (or more) seats: |