mirror of
https://github.com/Oreolek/gamebookformat.git
synced 2024-05-17 16:38:20 +03:00
Initial value for counters (something it is not reset to when revisiting).
Also fixed DOT output that was quite broken.
This commit is contained in:
parent
4d1e513752
commit
6fa4245e02
|
@ -9,6 +9,7 @@ We have counters for [count life]Life Points[/count] and for
|
|||
You can never have less than [min gold]0[/min] Gold. FIXME need to
|
||||
figure out best syntax for death when life points go below 1.
|
||||
Go to [[getgold]] to get more Gold or [[dangerous]] to lose some Life Points.
|
||||
Go to [[inittest]] for testing the init value markup.
|
||||
|
||||
* getgold
|
||||
Congratulations, you found [inc gold]2[/gold] Gold.
|
||||
|
@ -36,3 +37,19 @@ You have at least 16 gold. Go back to get some more at [[getgold]].
|
|||
|
||||
* death
|
||||
Less than 1 Life Point means the adventure ends now.
|
||||
|
||||
* inittest
|
||||
The [count something]Something Counter[/count]
|
||||
starts at [init something]5[/init], but when
|
||||
you come back here it will not reset to that, unlike the
|
||||
[count other]Other Counter[/count]
|
||||
that will reset to [set other]5[/set] every time you get
|
||||
here. If we try to init gold to [init gold]999[/init] nothing
|
||||
will happen because it was already set to something before you
|
||||
came yere. Go on to [[inittest2]].
|
||||
|
||||
* inittest2
|
||||
OK, we increase that something counter by [inc something]1[/inc]
|
||||
here, and also increase the other counter by [inc other]1[/inc].
|
||||
You can go back to see the difference between set and init
|
||||
[[inittest][here]], stuck in an infinite loop.
|
|
@ -1,7 +1,7 @@
|
|||
digraph gamebook {
|
||||
|
||||
Codewords1->2
|
||||
warrior2->9
|
||||
2->9
|
||||
warrior4->3
|
||||
4->2
|
||||
fun4->5
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
BEGIN DEBUG OUTPUT
|
||||
Book title: Counters Example
|
||||
Number of sections: 7
|
||||
Number of sections: 9
|
||||
Introduction
|
||||
This example gamebook shows how to use counters.
|
||||
|
||||
|
||||
Turn to 1 to begin.
|
||||
1 (start) - This is where the gamebook starts. We have counters for [COUNT life]Life Points[/COUNT] and for [COUNT gold]Gold[/COUNT]. You start the adventure with [SET life]10[/SET] Life Points and [SET gold]12[/SET] Gold. You can never have less than [MIN gold]0[/MIN] Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to 7 to get more Gold or 6 to lose some Life Points.
|
||||
2 (death) - Less than 1 Life Point means the adventure ends now.
|
||||
3 (hurrah) - You have at least 16 gold. Go back to get some more at 7.
|
||||
4 (rich) - You have more than 16 Gold. How nice. Go back to get some more at 7.
|
||||
5 (losegold) - You drop [DEC gold]5[/DEC] Gold. It should not be possible to go below 0. Then go on to get gold at 7 or lose life at 6.
|
||||
6 (dangerous) - You lose [DEC life]1[/DEC] Life Points. You can go to 7 to get some Gold.
|
||||
7 (getgold) - Congratulations, you found [INC gold]2[/INC] Gold. If you have less than 1 Life Points, turn to ((automatic))2. You can go to 6 to lose some life or to 5 to drop some gold. If you have at least 16 Gold you can turn to 3. If you have even more than 16 Gold you can turn to 4.
|
||||
1 (start) - This is where the gamebook starts. We have counters for [COUNT life]Life Points[/COUNT] and for [COUNT gold]Gold[/COUNT]. You start the adventure with [SET life]10[/SET] Life Points and [SET gold]12[/SET] Gold. You can never have less than [MIN gold]0[/MIN] Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to 9 to get more Gold or 8 to lose some Life Points. Go to 3 for testing the init value markup.
|
||||
2 (inittest2) - OK, we increase that something counter by [INC something]1[/INC] here, and also increase the other counter by [INC other]1[/INC]. You can go back to see the difference between set and init here (3), stuck in an infinite loop.
|
||||
3 (inittest) - The [COUNT something]Something Counter[/COUNT] starts at [INIT something]5[/SET], but when you come back here it will not reset to that, unlike the [COUNT other]Other Counter[/COUNT] that will reset to [SET other]5[/SET] every time you get here. If we try to init gold to [INIT gold]999[/SET] nothing will happen because it was already set to something before you came yere. Go on to 2.
|
||||
4 (death) - Less than 1 Life Point means the adventure ends now.
|
||||
5 (hurrah) - You have at least 16 gold. Go back to get some more at 9.
|
||||
6 (rich) - You have more than 16 Gold. How nice. Go back to get some more at 9.
|
||||
7 (losegold) - You drop [DEC gold]5[/DEC] Gold. It should not be possible to go below 0. Then go on to get gold at 9 or lose life at 8.
|
||||
8 (dangerous) - You lose [DEC life]1[/DEC] Life Points. You can go to 9 to get some Gold.
|
||||
9 (getgold) - Congratulations, you found [INC gold]2[/INC] Gold. If you have less than 1 Life Points, turn to ((automatic))4. You can go to 8 to lose some life or to 7 to drop some gold. If you have at least 16 Gold you can turn to 5. If you have even more than 16 Gold you can turn to 6.
|
||||
END DEBUG OUTPUT
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
digraph gamebook {
|
||||
|
||||
Life PointsGold101201->7
|
||||
1->6
|
||||
3->7
|
||||
4->7
|
||||
55->7
|
||||
5->6
|
||||
16->7
|
||||
217->2
|
||||
7->6
|
||||
7->5
|
||||
167->3
|
||||
167->4
|
||||
1->9
|
||||
1->8
|
||||
1->3
|
||||
2->3
|
||||
3->2
|
||||
5->9
|
||||
6->9
|
||||
7->9
|
||||
7->8
|
||||
8->9
|
||||
9->4
|
||||
9->8
|
||||
9->7
|
||||
9->5
|
||||
9->6
|
||||
}
|
||||
|
|
|
@ -47,9 +47,10 @@
|
|||
data-amount="10">10</span> Life Points and <span class="set counterChange" data-type="gold"
|
||||
data-amount="12">12</span> Gold. You can never have less than <span class="min counterChange" data-type="gold"
|
||||
data-limit="0">0</span>
|
||||
Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to <a class="sectionref enabledlink" data-ref="7"
|
||||
href="#section7">7</a> to get more Gold or <a class="sectionref enabledlink" data-ref="6"
|
||||
href="#section6">6</a> to lose some Life Points.
|
||||
Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to <a class="sectionref enabledlink" data-ref="9"
|
||||
href="#section9">9</a> to get more Gold or <a class="sectionref enabledlink" data-ref="8"
|
||||
href="#section8">8</a> to lose some Life Points. Go to <a class="sectionref enabledlink" data-ref="3"
|
||||
href="#section3">3</a> for testing the init value markup.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -59,7 +60,10 @@ if (typeof gamebook !== 'undefined') {
|
|||
</script><div class="section" id="section2">
|
||||
<div class="sectionnumber" id="para2">2</div>
|
||||
<div class="sectiontext">
|
||||
Less than 1 Life Point means the adventure ends now.
|
||||
OK, we increase that something counter by <span class="inc counterChange" data-type="something"
|
||||
data-amount="1">1</span> here, and also increase the other counter by <span class="inc counterChange" data-type="other"
|
||||
data-amount="1">1</span>. You can go back to see the difference between set and init <a class="sectionref enabledlink" data-ref="3"
|
||||
href="#section3">here</a>, stuck in an infinite loop.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -69,8 +73,13 @@ if (typeof gamebook !== 'undefined') {
|
|||
</script><div class="section" id="section3">
|
||||
<div class="sectionnumber" id="para3">3</div>
|
||||
<div class="sectiontext">
|
||||
You have at least 16 gold. Go back to get some more at <a class="sectionref enabledlink" data-ref="7"
|
||||
href="#section7">7</a>.
|
||||
The <span class="count counterChange" data-type="something"
|
||||
data-name="Something Counter">Something Counter</span> starts at <span class="init counterChange" data-type="something"
|
||||
data-amount="5">5</span>, but when you come back here it will not reset to that, unlike the <span class="count counterChange" data-type="other"
|
||||
data-name="Other Counter">Other Counter</span> that will reset to <span class="set counterChange" data-type="other"
|
||||
data-amount="5">5</span> every time you get here. If we try to init gold to <span class="init counterChange" data-type="gold"
|
||||
data-amount="999">999</span> nothing will happen because it was already set to something before you came yere. Go on to <a class="sectionref enabledlink" data-ref="2"
|
||||
href="#section2">2</a>.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -80,8 +89,7 @@ if (typeof gamebook !== 'undefined') {
|
|||
</script><div class="section" id="section4">
|
||||
<div class="sectionnumber" id="para4">4</div>
|
||||
<div class="sectiontext">
|
||||
You have more than 16 Gold. How nice. Go back to get some more at <a class="sectionref enabledlink" data-ref="7"
|
||||
href="#section7">7</a>.
|
||||
Less than 1 Life Point means the adventure ends now.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -91,10 +99,8 @@ if (typeof gamebook !== 'undefined') {
|
|||
</script><div class="section" id="section5">
|
||||
<div class="sectionnumber" id="para5">5</div>
|
||||
<div class="sectiontext">
|
||||
You drop <span class="dec counterChange" data-type="gold"
|
||||
data-amount="5">5</span> Gold. It should not be possible to go below 0. Then go on to get gold at <a class="sectionref enabledlink" data-ref="7"
|
||||
href="#section7">7</a> or lose life at <a class="sectionref enabledlink" data-ref="6"
|
||||
href="#section6">6</a>.
|
||||
You have at least 16 gold. Go back to get some more at <a class="sectionref enabledlink" data-ref="9"
|
||||
href="#section9">9</a>.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -104,9 +110,8 @@ if (typeof gamebook !== 'undefined') {
|
|||
</script><div class="section" id="section6">
|
||||
<div class="sectionnumber" id="para6">6</div>
|
||||
<div class="sectiontext">
|
||||
You lose <span class="dec counterChange" data-type="life"
|
||||
data-amount="1">1</span> Life Points. You can go to <a class="sectionref enabledlink" data-ref="7"
|
||||
href="#section7">7</a> to get some Gold.
|
||||
You have more than 16 Gold. How nice. Go back to get some more at <a class="sectionref enabledlink" data-ref="9"
|
||||
href="#section9">9</a>.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -116,22 +121,47 @@ if (typeof gamebook !== 'undefined') {
|
|||
</script><div class="section" id="section7">
|
||||
<div class="sectionnumber" id="para7">7</div>
|
||||
<div class="sectiontext">
|
||||
Congratulations, you found <span class="inc counterChange" data-type="gold"
|
||||
data-amount="2">2</span> Gold. If you have less than <span class="lessthan" data-type="life" data-amount="1"
|
||||
>1</span> Life Points, turn to <span class="auto"></span><a class="sectionref enabledlink" data-ref="2"
|
||||
href="#section2">2</a>. You can go to <a class="sectionref enabledlink" data-ref="6"
|
||||
href="#section6">6</a> to lose some life or to <a class="sectionref enabledlink" data-ref="5"
|
||||
href="#section5">5</a> to drop some gold. If you have at least <span class="atleast" data-type="gold" data-amount="16"
|
||||
>16</span> Gold you can turn to <a class="sectionref enabledlink" data-ref="3"
|
||||
href="#section3">3</a>. If you have even more than <span class="morethan" data-type="gold" data-amount="16"
|
||||
>16</span> Gold you can turn to <a class="sectionref enabledlink" data-ref="4"
|
||||
href="#section4">4</a>.
|
||||
You drop <span class="dec counterChange" data-type="gold"
|
||||
data-amount="5">5</span> Gold. It should not be possible to go below 0. Then go on to get gold at <a class="sectionref enabledlink" data-ref="9"
|
||||
href="#section9">9</a> or lose life at <a class="sectionref enabledlink" data-ref="8"
|
||||
href="#section8">8</a>.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (typeof gamebook !== 'undefined') {
|
||||
gamebook.addSection(7, document.getElementById('section7'));
|
||||
}
|
||||
</script><div class="section" id="section8">
|
||||
<div class="sectionnumber" id="para8">8</div>
|
||||
<div class="sectiontext">
|
||||
You lose <span class="dec counterChange" data-type="life"
|
||||
data-amount="1">1</span> Life Points. You can go to <a class="sectionref enabledlink" data-ref="9"
|
||||
href="#section9">9</a> to get some Gold.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (typeof gamebook !== 'undefined') {
|
||||
gamebook.addSection(8, document.getElementById('section8'));
|
||||
}
|
||||
</script><div class="section" id="section9">
|
||||
<div class="sectionnumber" id="para9">9</div>
|
||||
<div class="sectiontext">
|
||||
Congratulations, you found <span class="inc counterChange" data-type="gold"
|
||||
data-amount="2">2</span> Gold. If you have less than <span class="lessthan" data-type="life" data-amount="1"
|
||||
>1</span> Life Points, turn to <span class="auto"></span><a class="sectionref enabledlink" data-ref="4"
|
||||
href="#section4">4</a>. You can go to <a class="sectionref enabledlink" data-ref="8"
|
||||
href="#section8">8</a> to lose some life or to <a class="sectionref enabledlink" data-ref="7"
|
||||
href="#section7">7</a> to drop some gold. If you have at least <span class="atleast" data-type="gold" data-amount="16"
|
||||
>16</span> Gold you can turn to <a class="sectionref enabledlink" data-ref="5"
|
||||
href="#section5">5</a>. If you have even more than <span class="morethan" data-type="gold" data-amount="16"
|
||||
>16</span> Gold you can turn to <a class="sectionref enabledlink" data-ref="6"
|
||||
href="#section6">6</a>.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (typeof gamebook !== 'undefined') {
|
||||
gamebook.addSection(9, document.getElementById('section9'));
|
||||
}
|
||||
</script> <div id="counters" class="counters">
|
||||
</div>
|
||||
<div id="counterTemplate" class="counterTemplate">
|
||||
|
|
|
@ -22,59 +22,77 @@
|
|||
\
|
||||
\b \qc 1
|
||||
\b0\
|
||||
\ql This is where the gamebook starts. We have counters for Life Points and for Gold. You start the adventure with 10 Life Points and 12 Gold. You can never have less than 0 Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to \b 7
|
||||
\ql This is where the gamebook starts. We have counters for Life Points and for Gold. You start the adventure with 10 Life Points and 12 Gold. You can never have less than 0 Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to \b 9
|
||||
\b0
|
||||
to get more Gold or \b 6
|
||||
to get more Gold or \b 8
|
||||
\b0
|
||||
to lose some Life Points. \
|
||||
to lose some Life Points. Go to \b 3
|
||||
\b0
|
||||
for testing the init value markup. \
|
||||
\
|
||||
|
||||
\b \qc 2
|
||||
\b0\
|
||||
\ql Less than 1 Life Point means the adventure ends now. \
|
||||
\ql OK, we increase that something counter by 1 here, and also increase the other counter by 1. You can go back to see the difference between set and init here (
|
||||
\b 3
|
||||
\b0
|
||||
)
|
||||
, stuck in an infinite loop. \
|
||||
\
|
||||
|
||||
\b \qc 3
|
||||
\b0\
|
||||
\ql You have at least 16 gold. Go back to get some more at \b 7
|
||||
\ql The Something Counter starts at 5, but when you come back here it will not reset to that, unlike the Other Counter that will reset to 5 every time you get here. If we try to init gold to 999 nothing will happen because it was already set to something before you came yere. Go on to \b 2
|
||||
\b0
|
||||
. \
|
||||
\
|
||||
|
||||
\b \qc 4
|
||||
\b0\
|
||||
\ql You have more than 16 Gold. How nice. Go back to get some more at \b 7
|
||||
\b0
|
||||
. \
|
||||
\ql Less than 1 Life Point means the adventure ends now. \
|
||||
\
|
||||
|
||||
\b \qc 5
|
||||
\b0\
|
||||
\ql You drop 5 Gold. It should not be possible to go below 0. Then go on to get gold at \b 7
|
||||
\b0
|
||||
or lose life at \b 6
|
||||
\ql You have at least 16 gold. Go back to get some more at \b 9
|
||||
\b0
|
||||
. \
|
||||
\
|
||||
|
||||
\b \qc 6
|
||||
\b0\
|
||||
\ql You lose 1 Life Points. You can go to \b 7
|
||||
\ql You have more than 16 Gold. How nice. Go back to get some more at \b 9
|
||||
\b0
|
||||
to get some Gold. \
|
||||
. \
|
||||
\
|
||||
|
||||
\b \qc 7
|
||||
\b0\
|
||||
\ql Congratulations, you found 2 Gold. If you have less than 1 Life Points, turn to \b 2
|
||||
\ql You drop 5 Gold. It should not be possible to go below 0. Then go on to get gold at \b 9
|
||||
\b0
|
||||
. You can go to \b 6
|
||||
or lose life at \b 8
|
||||
\b0
|
||||
to lose some life or to \b 5
|
||||
. \
|
||||
\
|
||||
|
||||
\b \qc 8
|
||||
\b0\
|
||||
\ql You lose 1 Life Points. You can go to \b 9
|
||||
\b0
|
||||
to drop some gold. If you have at least 16 Gold you can turn to \b 3
|
||||
to get some Gold. \
|
||||
\
|
||||
|
||||
\b \qc 9
|
||||
\b0\
|
||||
\ql Congratulations, you found 2 Gold. If you have less than 1 Life Points, turn to \b 4
|
||||
\b0
|
||||
. If you have even more than 16 Gold you can turn to \b 4
|
||||
. You can go to \b 8
|
||||
\b0
|
||||
to lose some life or to \b 7
|
||||
\b0
|
||||
to drop some gold. If you have at least 16 Gold you can turn to \b 5
|
||||
\b0
|
||||
. If you have even more than 16 Gold you can turn to \b 6
|
||||
\b0
|
||||
. \
|
||||
\
|
||||
|
|
|
@ -48,7 +48,7 @@ Turn to 1 to begin.
|
|||
\subsection*{\begin{center} \textbf{1} \end{center}}
|
||||
|
||||
\noindent
|
||||
This is where the gamebook starts. We have counters for Life Points and for Gold. You start the adventure with 10 Life Points and 12 Gold. You can never have less than 0 Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to \textbf{\autoref{section7}} to get more Gold or \textbf{\autoref{section6}} to lose some Life Points.
|
||||
This is where the gamebook starts. We have counters for Life Points and for Gold. You start the adventure with 10 Life Points and 12 Gold. You can never have less than 0 Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to \textbf{\autoref{section9}} to get more Gold or \textbf{\autoref{section8}} to lose some Life Points. Go to \textbf{\autoref{section3}} for testing the init value markup.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
|
@ -56,7 +56,8 @@ Turn to 1 to begin.
|
|||
\subsection*{\begin{center} \textbf{2} \end{center}}
|
||||
|
||||
\noindent
|
||||
Less than 1 Life Point means the adventure ends now.
|
||||
OK, we increase that something counter by 1 here, and also increase the other counter by 1. You can go back to see the difference between set and init here (\textbf{\autoref{section3}})
|
||||
, stuck in an infinite loop.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
|
@ -64,7 +65,7 @@ Turn to 1 to begin.
|
|||
\subsection*{\begin{center} \textbf{3} \end{center}}
|
||||
|
||||
\noindent
|
||||
You have at least 16 gold. Go back to get some more at \textbf{\autoref{section7}}.
|
||||
The Something Counter starts at 5, but when you come back here it will not reset to that, unlike the Other Counter that will reset to 5 every time you get here. If we try to init gold to 999 nothing will happen because it was already set to something before you came yere. Go on to \textbf{\autoref{section2}}.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
|
@ -72,7 +73,7 @@ Turn to 1 to begin.
|
|||
\subsection*{\begin{center} \textbf{4} \end{center}}
|
||||
|
||||
\noindent
|
||||
You have more than 16 Gold. How nice. Go back to get some more at \textbf{\autoref{section7}}.
|
||||
Less than 1 Life Point means the adventure ends now.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
|
@ -80,7 +81,7 @@ Turn to 1 to begin.
|
|||
\subsection*{\begin{center} \textbf{5} \end{center}}
|
||||
|
||||
\noindent
|
||||
You drop 5 Gold. It should not be possible to go below 0. Then go on to get gold at \textbf{\autoref{section7}} or lose life at \textbf{\autoref{section6}}.
|
||||
You have at least 16 gold. Go back to get some more at \textbf{\autoref{section9}}.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
|
@ -88,7 +89,7 @@ Turn to 1 to begin.
|
|||
\subsection*{\begin{center} \textbf{6} \end{center}}
|
||||
|
||||
\noindent
|
||||
You lose 1 Life Points. You can go to \textbf{\autoref{section7}} to get some Gold.
|
||||
You have more than 16 Gold. How nice. Go back to get some more at \textbf{\autoref{section9}}.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
|
@ -96,6 +97,22 @@ Turn to 1 to begin.
|
|||
\subsection*{\begin{center} \textbf{7} \end{center}}
|
||||
|
||||
\noindent
|
||||
Congratulations, you found 2 Gold. If you have less than 1 Life Points, turn to \textbf{\autoref{section2}}. You can go to \textbf{\autoref{section6}} to lose some life or to \textbf{\autoref{section5}} to drop some gold. If you have at least 16 Gold you can turn to \textbf{\autoref{section3}}. If you have even more than 16 Gold you can turn to \textbf{\autoref{section4}}.
|
||||
You drop 5 Gold. It should not be possible to go below 0. Then go on to get gold at \textbf{\autoref{section9}} or lose life at \textbf{\autoref{section8}}.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
\label{section8}
|
||||
\subsection*{\begin{center} \textbf{8} \end{center}}
|
||||
|
||||
\noindent
|
||||
You lose 1 Life Points. You can go to \textbf{\autoref{section9}} to get some Gold.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
\label{section9}
|
||||
\subsection*{\begin{center} \textbf{9} \end{center}}
|
||||
|
||||
\noindent
|
||||
Congratulations, you found 2 Gold. If you have less than 1 Life Points, turn to \textbf{\autoref{section4}}. You can go to \textbf{\autoref{section8}} to lose some life or to \textbf{\autoref{section7}} to drop some gold. If you have at least 16 Gold you can turn to \textbf{\autoref{section5}}. If you have even more than 16 Gold you can turn to \textbf{\autoref{section6}}.
|
||||
\vspace{1em}
|
||||
\end{document}
|
||||
|
|
|
@ -7,23 +7,29 @@ Introduction
|
|||
|
||||
Turn to 1 to begin.
|
||||
1
|
||||
This is where the gamebook starts. We have counters for Life Points and for Gold. You start the adventure with 10 Life Points and 12 Gold. You can never have less than 0 Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to 7 to get more Gold or 6 to lose some Life Points.
|
||||
This is where the gamebook starts. We have counters for Life Points and for Gold. You start the adventure with 10 Life Points and 12 Gold. You can never have less than 0 Gold. FIXME need to figure out best syntax for death when life points go below 1. Go to 9 to get more Gold or 8 to lose some Life Points. Go to 3 for testing the init value markup.
|
||||
|
||||
2
|
||||
Less than 1 Life Point means the adventure ends now.
|
||||
OK, we increase that something counter by 1 here, and also increase the other counter by 1. You can go back to see the difference between set and init here (3), stuck in an infinite loop.
|
||||
|
||||
3
|
||||
You have at least 16 gold. Go back to get some more at 7.
|
||||
The Something Counter starts at 5, but when you come back here it will not reset to that, unlike the Other Counter that will reset to 5 every time you get here. If we try to init gold to 999 nothing will happen because it was already set to something before you came yere. Go on to 2.
|
||||
|
||||
4
|
||||
You have more than 16 Gold. How nice. Go back to get some more at 7.
|
||||
Less than 1 Life Point means the adventure ends now.
|
||||
|
||||
5
|
||||
You drop 5 Gold. It should not be possible to go below 0. Then go on to get gold at 7 or lose life at 6.
|
||||
You have at least 16 gold. Go back to get some more at 9.
|
||||
|
||||
6
|
||||
You lose 1 Life Points. You can go to 7 to get some Gold.
|
||||
You have more than 16 Gold. How nice. Go back to get some more at 9.
|
||||
|
||||
7
|
||||
Congratulations, you found 2 Gold. If you have less than 1 Life Points, turn to 2. You can go to 6 to lose some life or to 5 to drop some gold. If you have at least 16 Gold you can turn to 3. If you have even more than 16 Gold you can turn to 4.
|
||||
You drop 5 Gold. It should not be possible to go below 0. Then go on to get gold at 9 or lose life at 8.
|
||||
|
||||
8
|
||||
You lose 1 Life Points. You can go to 9 to get some Gold.
|
||||
|
||||
9
|
||||
Congratulations, you found 2 Gold. If you have less than 1 Life Points, turn to 4. You can go to 8 to lose some life or to 7 to drop some gold. If you have at least 16 Gold you can turn to 5. If you have even more than 16 Gold you can turn to 6.
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
digraph gamebook {
|
||||
|
||||
Inventoryswordshield1->12
|
||||
Inventory 1->12
|
||||
1->2
|
||||
stick2->12
|
||||
booksword2->5
|
||||
sword2->5
|
||||
something valuable2->7
|
||||
4->3
|
||||
sword5->4
|
||||
|
|
|
@ -39,22 +39,33 @@ var gamebook = {
|
|||
return;
|
||||
};
|
||||
this.counters[type] = {
|
||||
inited : false,
|
||||
name : name,
|
||||
value : 0,
|
||||
minValue : null, //no minimum set
|
||||
inc : function(amount) {
|
||||
this.value += amount;
|
||||
this.inited = true;
|
||||
},
|
||||
dec : function(amount) {
|
||||
this.value -= amount;
|
||||
this.ensureNotBelowMin();
|
||||
this.inited = true;
|
||||
},
|
||||
set : function(value) {
|
||||
this.value = value;
|
||||
this.ensureNotBelowMin();
|
||||
this.inited = true;
|
||||
},
|
||||
init : function(value) {
|
||||
if (!this.inited) {
|
||||
this.value = value;
|
||||
this.inited = true;
|
||||
}
|
||||
},
|
||||
min : function(limit) {
|
||||
this.minValue = limit;
|
||||
this.ensureNotBelowMin();
|
||||
},
|
||||
ensureNotBelowMin : function() {
|
||||
if (this.minValue !== null && this.value < this.minValue) {
|
||||
|
@ -91,6 +102,7 @@ var gamebook = {
|
|||
|
||||
min : function(type, limit) {
|
||||
this.counters[type].min(limit);
|
||||
gamebook.updateCountersView();
|
||||
},
|
||||
|
||||
set : function(type, amount) {
|
||||
|
@ -98,6 +110,11 @@ var gamebook = {
|
|||
gamebook.updateCountersView();
|
||||
},
|
||||
|
||||
init : function(type, amount) {
|
||||
this.counters[type].init(amount);
|
||||
gamebook.updateCountersView();
|
||||
},
|
||||
|
||||
'hasMoreThan' : function(type, amount) {
|
||||
return this.counters[type].value > amount;
|
||||
},
|
||||
|
@ -288,6 +305,9 @@ var gamebook = {
|
|||
} else if (c.classList.contains('set')) {
|
||||
gamebook.player.set(c.dataset.type,
|
||||
parseInt(c.dataset.amount));
|
||||
} else if (c.classList.contains('init')) {
|
||||
gamebook.player.init(c.dataset.type,
|
||||
parseInt(c.dataset.amount));
|
||||
} else if (c.classList.contains('inc')) {
|
||||
gamebook.player.inc(c.dataset.type,
|
||||
parseInt(c.dataset.amount));
|
||||
|
|
1
templates/debug/init.debug
Normal file
1
templates/debug/init.debug
Normal file
|
@ -0,0 +1 @@
|
|||
[INIT %(arg1)s]%(inner)s[/SET]
|
1
templates/dot/add.dot
Normal file
1
templates/dot/add.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/atleast.dot
Normal file
1
templates/dot/atleast.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/collect.dot
Normal file
1
templates/dot/collect.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/cost.dot
Normal file
1
templates/dot/cost.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/count.dot
Normal file
1
templates/dot/count.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/dec.dot
Normal file
1
templates/dot/dec.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/drop.dot
Normal file
1
templates/dot/drop.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/found.dot
Normal file
1
templates/dot/found.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/has.dot
Normal file
1
templates/dot/has.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/hasnot.dot
Normal file
1
templates/dot/hasnot.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/img.dot
Normal file
1
templates/dot/img.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/inc.dot
Normal file
1
templates/dot/inc.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/init.dot
Normal file
1
templates/dot/init.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/lessthan.dot
Normal file
1
templates/dot/lessthan.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/min.dot
Normal file
1
templates/dot/min.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/morethan.dot
Normal file
1
templates/dot/morethan.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/random.dot
Normal file
1
templates/dot/random.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/set.dot
Normal file
1
templates/dot/set.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/take.dot
Normal file
1
templates/dot/take.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
templates/dot/xor.dot
Normal file
1
templates/dot/xor.dot
Normal file
|
@ -0,0 +1 @@
|
|||
|
2
templates/html/init.html
Normal file
2
templates/html/init.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<span class="init counterChange" data-type="%(arg1)s"
|
||||
data-amount="%(inner)s">%(inner)s</span>
|
Loading…
Reference in a new issue