Number input macros with support for pools.
Overview
SugarCube is a free (gratis and libre) story format for Twine/Twee.
This documentation is a reference for the <<numberpool>>
macro set for SugarCube, it assumes at least a passing knowledge of SugarCube macros.
Requirements
This package requires SugarCube v2.5.0 or greater.
Files
The files included in this package are:
README.html
: This document.
numberpool-macro-set.min.js
: The, minified, macros.
numberpool-macro-set.css
: The styles required by the macros.
Installation
JavaScript
- Open the
numberpool-macro-set.min.js
file in a text editor (not a word processor) and copy its contents.
- Paste them into your project's script section:
- Twine 2: Story JavaScript.
- Twine 1/Twee:
script
-tagged passage.
Stylesheet
- Open the
numberpool-macro-set.css
file in a text editor (not a word processor) and copy its contents.
- Paste them into your project's stylesheet section:
- Twine 2: Story Stylesheet.
- Twine 1/Twee:
stylesheet
-tagged passage.
Macros
<<numberpool>>
<<onchange>>
<<numberslider>>
Live demo
Demo Twee code:
:: Start
<<set $points to 5>>\
<<set $str to 5>>\
<<set $int to 5>>\
<<set $dex to 5>>\
<<numberpool "$points">>
<table>
<tr><td>STR</td><td><<numberinput "$str" $str 1 10>></td></tr>
<tr><td>DEX</td><td><<numberinput "$dex" $dex 1 10>></td></tr>
<tr><td>INT</td><td><<numberinput "$int" $str 1 10>></td></tr>
</table>\
<<onchange>>
<<replace "#stat-pool">>$points<</replace>>
<</numberpool>>\
You have <span id="stat-pool">$points</span> points remaining to allocate.