Just to be explicit and clear
Correct
Correct, each with it’s own image (cut out from the image above or make your own)
Depends on what you mean by “that … code”. If you mean
\documentclass[tikz]{standalone}
\usepackage{wargame}
...
\end{document}
then no. That code is LATEX code that simply produces the image above. In case you don’t know, LATEX is a typesetting system for producing high-quality, publication-ready manuscripts - particularly suitable and used for articles in journals of Natural Science. As such, LATEX has nothing to do with VASSAL or BeanShell.
Aside
My LATEX package wargame
can take a LATEX document and make a (draft) VASSAL module via an intermittent Python script (pywargame
).
What you need is
- A
Symbolic Dice Button
- check show result in window
-
- with a single
Symbolic Dice
- with 32
Symbolic Dice Face
- Each face has a single image (one of the 32 rectangles from above) that illustrates the result, and
Numerical value
value set to the value of the roll
If you know LATEX, you can easily customise the dice colours above. In
\def\bg{white}\def\fg{black}
\ifnum\n=\m\def\bg{red}\def\fg{white}\fi
\ifnum\s=7\def\bg{blue}\def\fg{white}\fi
\ifnum\s=12\def\bg{green}\def\fg{white}\fi
- The first line sets the default background to white (
\def\bg{white}
) and foreground to black (\def\fg{black}
)
- The second line sets the background to
red
and foreground to white
when the two die are equal
- The third line sets the background to
blue
and foreground to white
when the sum of the dice is 7
- The fourth line sets the background to
green
and foreground to white
when the sum is 12.
You can change these colours however you like - for example, to make a darker red, mix 50% red with 50% black by red!50!black
. Suppose you save the above code in a file called dice.tex
, then you can run LATEX on it with
$ pdflatex dice.tex
to produce dice.pdf
. This in turn can be made into PNG(s) with
$ pdftocairo -singlefile -png dice.pdf -o dice
or f.ex. Gimp. If you modify the above LATEX code like
\documentclass[tikz]{standalone}
\usepackage{wargame}
\tikzset{
die/.style={
shape=d6,
scale line widths,
line width=1pt,
transform shape,
scale=.7
},
fg die/.style args={#1,#2}{
die,
fill=#1,
text=#2,
font=\sffamily\bfseries\Large,
draw=gray!25!white},
die shadow/.style={
die,
fill=black,
draw=none,
opacity=.5}
}
\newcommand\DiceExample[4]{%
%\begin{tikzpicture}[
\node[die shadow,rotate=10] (s1) at (.40,.07){};
\node[die shadow,rotate=-10] (s2) at (-.25,-.11){};
\node[fg die={#1,#2}, rotate=10] at ($(s1)+(-.05,.03)$) {#3};
\node[fg die={#1,#2}, rotate=-10] at ($(s2)+(-.05,.04)$) {#4};
}
\begin{document}
\nopagecolor
\foreach \n in {1,2,...,6}{
\foreach \m in {1,2,...,6}{
\pgfmathparse{int(\n+\m)}\edef\s{\pgfmathresult}
\def\bg{white}\def\fg{black}
\ifnum\n=\m\def\bg{red}\def\fg{white}\fi
\ifnum\s=7\def\bg{blue}\def\fg{white}\fi
\ifnum\s=12\def\bg{green}\def\fg{white}\fi
\begin{tikzpicture}
\DiceExample{\bg}{\fg} {\n}{\m}
\end{tikzpicture}
}
}
\end{document}
you will get a PDF with 36 “pages” - each correspond to a die combination, which you can then turn into individual PNGs (named dice-00.png
, dice-01.png
, …, dice-35.png
) with
$ pdftocairo -png dice.pdf -o dice
which you can directly import into your VASSAL module.
Yours,
Christian