Example - Gardening (Story Stylesheet and JavaScript)
\<<set $plants to []>>
\
\<<for _i to 0; _i < 12; _i++>>
\ <<set $plants[_i] to random(0,4)>>
\<</for>>
[[Garden]]
<div id="garden"></div>
<<include "Plot Timer">><<silently>>
<<repeat 1s>>
<<for _i to 0; _i < 12; _i++>>
<<set _state to $plants[_i] - either(0, 0, 0, 0, 0, 1)>>
<<if _state <= 1>>
<<set _state to 1>>
<</if>>
<<set $plants[_i] to _state>>
<</for>>
<<include "Plots">>
<<run setup.bindButtons() >>
<</repeat>>
<</silently>><<nobr>>
<<replace "#garden">>
<table>
<tr>
<<for _i to 0; _i < 4; _i++>>
<<if $plants[_i] is 1>>
<td class="plot dying">
<<button _i>><</button>>
</td>
<<elseif $plants[_i] is 2>>
<td class="plot ground">
<<button _i>><</button>>
</td>
<<else>>
<td class="plot plant">
<<button _i>><</button>>
</td>
<</if>>
<</for>>
</tr>
<tr>
<<for _i to 4; _i < 8; _i++>>
<<if $plants[_i] is 1>>
<td class="plot dying">
<<button _i>><</button>>
</td>
<<elseif $plants[_i] is 2>>
<td class="plot ground">
<<button _i>><</button>>
</td>
<<else>>
<td class="plot plant">
<<button _i>><</button>>
</td>
<</if>>
<</for>>
</tr>
<tr>
<<for _i to 8; _i < 12; _i++>>
<<if $plants[_i] is 1>>
<td class="plot dying">
<<button _i>><</button>>
</td>
<<elseif $plants[_i] is 2>>
<td class="plot ground">
<<button _i>><</button>>
</td>
<<else>>
<td class="plot plant">
<<button _i>><</button>>
</td>
<</if>>
<</for>>
</tr>
</table>
<</replace>>
<</nobr>>