Hi everyone, there’s a new version of nanDECK (and since the first version is from April 2006, this is the twentieth anniversary edition), with bug fixes and the following changes:
Rules parameter in POLYGON/STAR directives
Each side of the polygon or star can be drawn using a rule, defined as a sequence of distances from the side (with positive or negative percentages). Example (the rule used is identified by the character “2”, since “0” = empty space, “1” = standard line):
cardsize=10,10
polygon=1,10%,10%,80%,80%,6,30,#000000,empty,2%,,,,,,,,2,2=0|25|-25|0
polygon=,10%,10%,80%,80%,6,30,#FF0000,empty,1%
Result (I added a normal red hex):
Add a * in the rule, and a curve is drawn (the intermediate points become the handles of a bezier):
cardsize=10,10
polygon=1,10%,10%,80%,80%,6,30,#000000,empty,2%,,,,,,,,2,2=*0|75|-75|0
polygon=,10%,10%,80%,80%,6,30,#FF0000,empty,1%
cardsize=10,10
polygon=1,10%,10%,80%,80%,6,30,#000000,empty,2%,,,,,,,,23,2=0|25|-25|0&3=*0|75|-75|0
polygon=,10%,10%,80%,80%,6,30,#FF0000,empty,1%

Finally, normally the intermediate points are spaced equally, but after the % you can add a second sequence that indicates where the points should be positioned (percentages of the segment, if you do not indicate 0 and 100 as the first and last, there will be empty spaces):
cardsize=10,10
polygon=1,10%,10%,80%,80%,6,30,#000000,empty,2%,,,,,,,,2,2=0|25|-25|0%0|10|20|100
polygon=,10%,10%,80%,80%,6,30,#FF0000,empty,1%

Added direct export to a Tabletop Simulator JSON save file
In addition to the old method (exporting a sheet of cards with DISPLAY and manually importing them into TTS), it’s now possible to directly modify a TTS save from nanDECK to automatically display the card decks in the table. Simply add lines with DECK to the script indicating how the decks should be composed (possibly with a backing) and where they should be placed on the table, then build the deck, press the Export -> TTS -> Export decks button, specify which TTS save you want to edit, and nanDECK does the rest. Example script:
font=arial,96,,#000000
text=1-100,{§},0,0,100%,100%
font=arial,64,G,#000000
text=101,"Back A",0,0,100%,100%
text=102,"Back B",0,0,100%,100%
text=103,"Back C",0,0,100%,100%
text=104-123,"Back {§-103}",0,0,100%,100%
deck=1-20,"One",#FF0000,20,N,101,-10,-10
deck=21-50,"Two",#FF0000,20,N,102,10,-10
deck=51-100,"Three",#FF0000,20,R,103,-10,10
deck=1-20,"Four",#FF0000,20,N,104-123,10,10
And after the procedure the result is the four decks on the table:

In the window you can choose the scale for the size of the decks (you can also indicate it in the DECK line), the file format, the scale for the placements on the table, whether to arrange them on a line or in a grid (alternatively the coordinates can be indicated in the DECK line) and the folder in which to save the files:

Added /EXPORTTTS to command-line parameters
Automatic export to TTS can also be done from the command line, with the /EXPORTTTS parameter.
New RANGEREV function
This function reverses the order of cards in a range (useful in special cases, such as the DECK directive). This is the syntax:
[range] = RANGEREV("range")
New GAMEICONS function
This function creates a PNG bitmap corresponding to an icon from the game-icons.net website (CC BY 3.0), and returns its path (usable with directives like IMAGE or ICON). The syntax is:
[label] = GAMEICONS(code, color, size)
The code parameter can be a numeric value or a string (all strings can be viewed by pressing CTRL+F5), if the color is not specified, black is used, if the size is not specified, 512 (pixels) is used.
New FONTNAME function
This function returns the name of the font based on its position in the list of available fonts; the total number of fonts can be obtained with INFO(T). The syntax is:
[name] = FONTNAME(number)
Added O, Q, E flags and parameters to ICONS to randomize icons
If you set the O flag in ICONS and leave the second parameter (the icon sequence) empty, the icons are drawn randomly (all those defined in the ICON lines are used). Example (I used two-color path combinations on square tiles):
cardsize=12,8
icon=,01,tiles\tile1.png
icon=,02,tiles\tile2.png
icon=,03,tiles\tile3.png
icon=,04,tiles\tile4.png
icon=,05,tiles\tile5.png
icon=,06,tiles\tile6.png
icon=,07,tiles\tile7.png
icon=,08,tiles\tile8.png
icon=,09,tiles\tile9.png
icon=,10,tiles\tile10.png
icon=,11,tiles\tile11.png
icon=,12,tiles\tile12.png
icon=,13,tiles\tile13.png
icon=,14,tiles\tile14.png
icon=,15,tiles\tile15.png
icon=,16,tiles\tile16.png
icon=,17,tiles\tile17.png
icon=,18,tiles\tile18.png
icon=,19,tiles\tile19.png
icon=,20,tiles\tile20.png
icon=,21,tiles\tile21.png
icon=,22,tiles\tile22.png
icon=,23,tiles\tile23.png
icon=,24,tiles\tile24.png
icons=1,,0,0,12,8,2,2,0,O,center,center,100,2
Result:

The tenth parameter of ICON can specify a four-character border string (which indicates the type of border on the four sides: top, right, bottom, left), creating consistent matches between icons. Additionally, the Q flag in ICONS repeats the process until all tiles are used (without this, gaps are left if there are no valid tiles). Example:
cardsize=12,8
icon=,01,tiles\tile1.png,100,100,0,0,100,0,0000
icon=,02,tiles\tile2.png,100,100,0,0,100,0,0001
icon=,03,tiles\tile3.png,100,100,0,0,100,0,0002
icon=,04,tiles\tile4.png,100,100,0,0,100,0,0011
icon=,05,tiles\tile5.png,100,100,0,0,100,0,0012
icon=,06,tiles\tile6.png,100,100,0,0,100,0,0021
icon=,07,tiles\tile7.png,100,100,0,0,100,0,0022
icon=,08,tiles\tile8.png,100,100,0,0,100,0,0101
icon=,09,tiles\tile9.png,100,100,0,0,100,0,0102
icon=,10,tiles\tile10.png,100,100,0,0,100,0,0111
icon=,11,tiles\tile11.png,100,100,0,0,100,0,0112
icon=,12,tiles\tile12.png,100,100,0,0,100,0,0121
icon=,13,tiles\tile13.png,100,100,0,0,100,0,0122
icon=,14,tiles\tile14.png,100,100,0,0,100,0,0202
icon=,15,tiles\tile15.png,100,100,0,0,100,0,0211
icon=,16,tiles\tile16.png,100,100,0,0,100,0,0212
icon=,17,tiles\tile17.png,100,100,0,0,100,0,0221
icon=,18,tiles\tile18.png,100,100,0,0,100,0,0222
icon=,19,tiles\tile19.png,100,100,0,0,100,0,1111
icon=,20,tiles\tile20.png,100,100,0,0,100,0,1112
icon=,21,tiles\tile21.png,100,100,0,0,100,0,1122
icon=,22,tiles\tile22.png,100,100,0,0,100,0,1212
icon=,23,tiles\tile23.png,100,100,0,0,100,0,1222
icon=,24,tiles\tile24.png,100,100,0,0,100,0,2222
icons=1,,0,0,12,8,2,2,0,OQ,center,center,100,2
Result:

In the nineteenth parameter of ICONS you can indicate a sequence that indicates the external borders (on the four sides: top, right, bottom, left). You can leave it blank if any border is suitable for that side. Example:
cardsize=12,8
icon=,01,tiles\tile1.png,100,100,0,0,100,0,0000
icon=,02,tiles\tile2.png,100,100,0,0,100,0,0001
icon=,03,tiles\tile3.png,100,100,0,0,100,0,0002
icon=,04,tiles\tile4.png,100,100,0,0,100,0,0011
icon=,05,tiles\tile5.png,100,100,0,0,100,0,0012
icon=,06,tiles\tile6.png,100,100,0,0,100,0,0021
icon=,07,tiles\tile7.png,100,100,0,0,100,0,0022
icon=,08,tiles\tile8.png,100,100,0,0,100,0,0101
icon=,09,tiles\tile9.png,100,100,0,0,100,0,0102
icon=,10,tiles\tile10.png,100,100,0,0,100,0,0111
icon=,11,tiles\tile11.png,100,100,0,0,100,0,0112
icon=,12,tiles\tile12.png,100,100,0,0,100,0,0121
icon=,13,tiles\tile13.png,100,100,0,0,100,0,0122
icon=,14,tiles\tile14.png,100,100,0,0,100,0,0202
icon=,15,tiles\tile15.png,100,100,0,0,100,0,0211
icon=,16,tiles\tile16.png,100,100,0,0,100,0,0212
icon=,17,tiles\tile17.png,100,100,0,0,100,0,0221
icon=,18,tiles\tile18.png,100,100,0,0,100,0,0222
icon=,19,tiles\tile19.png,100,100,0,0,100,0,1111
icon=,20,tiles\tile20.png,100,100,0,0,100,0,1112
icon=,21,tiles\tile21.png,100,100,0,0,100,0,1122
icon=,22,tiles\tile22.png,100,100,0,0,100,0,1212
icon=,23,tiles\tile23.png,100,100,0,0,100,0,1222
icon=,24,tiles\tile24.png,100,100,0,0,100,0,2222
icons=1,,0,0,12,8,2,2,0,OQ,center,center,100,2,100,100,,,0|1|2|1
Result (0=empty top, 1=green right and left, 2=red bottom):

Finally, the E flag in ICONS is used to use icons with six sides instead of four (it works with a flat-top hexagonal grid); and to ensure that the correct number of columns is used, it can be set as the twentieth parameter of ICONS.
Added G flag to ICONS to not resize rotated icons
Normally, the rotation of an icon is done by reducing it to show it completely, with the G flag the rotation is done while maintaining the dimensions unchanged (it is the equivalent of the R flag for IMAGE).
Added F flag to HTMLIMAGE to resize the image according to the font
With this flag, the image’s percentage dimensions (width and height parameters) are relative to the font used (and not the card). Example:
[text]=”Test (a).”
htmlimage=1,(a),warlord-helmet.png,100%,100%,FPM
htmlfont=font1,arial,8,,#000000
htmlfont=font2,arial,12,,#000000
htmlfont=font3,arial,24,,#000000
htmlfont=font4,arial,32,,#000000
htmltext=1-{(text)},[text],0,0,100%,25%,#FFFFFF,0,BE,100,font1
htmltext=1-{(text)},[text],0,25%,100%,25%,#FFFFFF,0,BE,100,font2
htmltext=1-{(text)},[text],0,50%,100%,25%,#FFFFFF,0,BE,100,font3
htmltext=1-{(text)},[text],0,75%,100%,25%,#FFFFFF,0,BE,100,font4

Added L flag to FONT to reduce contrast when using the T flag
The T flag replaces the background color of TEXT with the one present on the card, the L flag reduces the contrast on the edge (due to intermediate colors between the background color and the text color).
Added K flag to BACKGROUND/VORONOI for Minkowsky distance
In these directives, distances between points can be calculated with a “Euclidean” formula (square root and powers, flag E), a “Manhattan” formula (absolute differences, flag M), and now with a “Minkowski” formula (intermediate between Euclidean and Manhattan, flag K).
Added C/L flags and gap parameter in CONTOUR directive for curved corners
The C flag in CONTOUR draws curves instead of lines. The thirteenth parameter specifies how much empty space is left at the end of the line (and therefore how wide the curve is), and the fourteenth parameter specifies how many curves are drawn (the default is one). The syntax is:
CONTOUR = "range", pos x, pos y, width, height, html color, thickness, pattern, distance, random, offset, flag, gap, curves
Added HOR/VER line switch in GAP directive
Added number and thickness parameters in GAP directive
In the third parameter of GAP it is now possible to indicate to place the line in the center of the space only horizontally or only vertically (HOR/VER) in addition to ON (which draws both). Furthermore, with the eighth and ninth parameters it is possible to indicate respectively the number of lines to draw and their thickness (with the same syntax as the BORDER guidelines). The syntax is:
GAP=horizontal gap, vertical gap, line, fill, guidelines, html color, MARK/CROSS/LINE size, num. of guides, thickness
Added rules parameters in COLORS directive
Now in the COLORS parameters, from the seventh to the eleventh you can indicate a rule (or more than one) that changes the color every time the variable is used. The syntax is:
COLORS = "range", html color1, html color2 , html color3 , html color4, html color5, rules color1, rules color2, rules color3, rules color4, rules color5
The syntax for a rule is:
+ or –
R/G/B/H/S/L
value
& for wrap (255 + 1 -> 0 or 0 – 1 -> 255), optional
$ for bounce (255 + 1 -> 254 or 0 – 1 -> 1), optional
>minimum value, optional
<maximum value, optional
Added the ability to specify different default characters in SCHEMA function
The second parameter in the SCHEMA function can contain a sequence, where the first value is the number of sub-elements (if left blank it is calculated automatically), the second is the separator (default is “_”), the third is the initial sequence of characters for the parameters (default is “((“) and the fourth is the final sequence of characters for the parameters (default is “))”).
Added parameters for side adjustments in BUTTON directive
BUTTON I/O flags change the brightness of the four sides with standard values, in this version it is possible to set arbitrary brightness values on the four sides (top, left, right, bottom) with the eighth to eleventh parameters. The syntax is:
BUTTON="range", pos x, pos y, width, height, depth, flag IOG, mod top, mod left, mod right, mod bottom
F and J flags can be used simultaneously In the HTMLTEXT directive
This way, if the font used is too large, the F flag is applied, if the font used is too small, the J flag is applied.
Sequences can be specified in the parameters of the FRAMETRANS function
The FRAMETRANS function applies position and/or size changes to groups of frames. Now, if you specify a sequence of values in the parameters, a value from this sequence will be applied to each frame, allowing you to apply different values.
Added options to SAVELABEL function for field names (*) and tab delimiters (?)
When exporting to a text file, you can add sequence names and set tabs as delimiters (instead of commas) by placing the * and/or ? characters in the file name, respectively.
BGG guild:
https://boardgamegeek.com/guild/454
Discord server:



:strip_icc()/pic9001896.png)
:strip_icc()/pic8975197.png)
:strip_icc()/pic8933095.png)
:strip_icc()/pic8975416.png)
:strip_icc()/pic8975442.png)
:strip_icc()/pic8768894.png)
:strip_icc()/pic8768896.png)
:strip_icc()/pic8812324.png)
:strip_icc()/pic8812325.png)
:strip_icc()/pic8786340.png)
:strip_icc()/pic8770426.png)
:strip_icc()/pic8770427.png)
:strip_icc()/pic8367160.png)
:strip_icc()/pic8367165.png)
:strip_icc()/pic8367154.png)
:strip_icc()/pic8368612.png)
:strip_icc()/pic8373567.png)
:strip_icc()/pic8373572.png)
:strip_icc()/pic8373583.png)
:strip_icc()/pic8375150.png)
:strip_icc()/pic7800520.png)
:strip_icc()/pic7816172.png)
:strip_icc()/pic7810135.png)
:strip_icc()/pic7810193.png)
:strip_icc()/pic7408868.png)
:strip_icc()/pic7441027.png)
:strip_icc()/pic7441028.png)
:strip_icc()/pic7447278.png)
:strip_icc()/pic7447290.png)
:strip_icc()/pic7175595.png)
:strip_icc()/pic7208741.png)
:strip_icc()/pic7112834.png)
/pic6980391.png)
/pic6923455.png)
/pic6923120.png)