Lingua italiana

nanDECK - Tutorial D

This tutorial was written for nanDECK 1.9b (or later versions). First, we start from a file (data01.txt), not a script, but a simple data file for a counter's list (this is an example, for a fictional WWII wargame):

nation,type,combat,movement,command,id
ger,inf,3,3,0,XXX
ger,inf,3,3,0,XXX
ger,inf,4,3,0,XXXX
ger,inf,4,3,0,XXXX
ger,arm,5,4,0,XXX
ger,arm,5,4,0,XXX
ger,arm,6,5,0,XXX
ger,arm,6,5,0,XXX
ger,hq,1,5,3,Rommel
fre,inf,3,3,0,XXX
fre,inf,3,3,0,XXX
fre,cav,2,5,0,XX
fre,cav,2,5,0,XX
fre,arm,4,4,0,XXX
fre,arm,4,4,0,XXX
fre,arm,5,4,0,XXX
fre,arm,5,4,0,XXX
fre,hq,1,4,3,"De Gaulle"

The first row will be used as titles for the data. If we want include this list in a nanDECK' script, we can create a new script, set the counter' size (2x2 cm) and use a LINK directive (during the script's execution, the values from data file are converted to labels):

cardsize=2,2
link=data01.txt

Next, we'll define some labels:

[all]=1-{(combat)}

The [all] label will be translated to 1-18 at runtime (we have 18 counters).

[val_lft]=0.25,1.25,0.5,0.75
[val_cnt]=0.75,1.25,0.5,0.75
[val_rgt]=1.25,1.25,0.5,0.75
[val_id]=0.25,0,1.5,0.25

Some positioning for values, three below the symbol, one on the top.

[back_ger]=#C0C0C0
[back_fre]=#8ADDF4
[front_ger]=#FFFFFF
[front_fre]=#000000

IMPORTANT: The ger and fre are equal to [nation] column values in data file.

[middle]="center","center"
[black]=#000000

We draw a background rectangle:

rectangle=[all],0,0,2,2,[back_[nation]]

IMPORTANT: The [back_[nation]] label will be translated to [back_ger] or [back_fre], depending on values from [nation] column, and then translated again to a color.

rectangle=[all],0.5,0.25,1,1,[black],"empty"

We draw an empty rectangle in the center of the counter.

font="arial",16,"",[front_[nation]],[back_[nation]]
text=[all],[combat],[val_lft],[middle]
text=[all],[movement],[val_rgt],[middle]

We draw combat and movement values, taken from data file.

if=[command]<>0
text=[all],[command],[val_cnt],[middle]
endif

With the new IF construct, we draw the command value of the counter only if it is different from zero.

font="arial",7,"",[front_[nation]],[back_[nation]]
text=[all],[id],[val_id],[middle]

We draw the counter's id on top (with a smaller font).

if=[type]=inf
line=[all],0.5,0.25,1.5,1.25,[black]
line=[all],0.5,1.25,1.5,0.25,[black]
endif

if=[type]=cav
line=[all],0.5,0.25,1.5,1.25,[black]
endif

if=[type]=arm
ellipse=[all],0.5,0.5,0.5,0.5,[black]
ellipse=[all],1,0.5,0.5,0.5,[black]
rectangle=[all],0.75,0.5,0.5,0.5,[black]
endif

if=[type]=hq
font="arial",16,"T",[front_[nation]],[back_[nation]]
text=[all],"HQ",0.5,0.25,1,1,[middle]
endif

We can have four different kind of unit (infantry, cavalry, armour and HQ), and with the IF construct we use only the corresponding command for drawing a NATO symbol.

This is the result (only six counters):

tutorial image 01 tutorial image 02 tutorial image 03 tutorial image 04 tutorial image 05 tutorial image 06

You can resize the counters with a ZOOM directive, withouth changing other commands.

You can download the script from here, the data file here and the PDF from here.

Bye,
/\/and


Back to home page