Tag passages with:
cardorsticky-card- use once vs. use many times.req-expression- must be matched to see cover.also-expression- must also be matched to see contents.important- should be given priority over normal cards.urgent- if available, makes all important and normal cards unavailable.
You can also put TinyQBN "tags" in comments in the passage itself:
/* QBN card req-beetles-gt-3 req-snakes-eq-1 */
You must use the /* ... */ style comments, and QBN must be
the first thing in the comment.
Expressions:
name-$nameor_namehas a non-empty value.not-expression- expression has an empty value.random-xx- available xx percent of the time (integer percent).name-op-number- op iseq|neq|lt|gt|lte|gte; use_for decimal point.eqandneqalso work withname-op-string.- Op can also be
beforeorduringorafter,startingAtorendingAtfor use with progress variables. name-op-name-eqvar|neqvar|ltvar|gtvar|ltevar|gtevar- compare two variables instead of a variable and a constant value.passage-title- Are we at the passage with the given title?visited-title- Have we visited the passage with the given title?tagged-blah_blah- Does the current passage have a tagblah_blah?
Checking variables:
<<range "$var" n1 name n2 name2 ...>>- set_name_varto true for the name of the range (if any) that$varfalls into. Think of this as a labeled number-line, where numbers make tick-marks on the line, and strings name the spaces between.
Manually manipulating the event deck:
<<addcard title sticky>><<removecard title even_if_sticky=true>>
Progress variables:
- Create with
<<progress "$var" value ...>>, giving as many values as you like. - Use
<<advance "$var" n>>to advancensteps (optional, default is 1, negative numbers work too). - Use
<<advance "$var" "value">to advance to a given value (only goes forward, never back). - Check with
req-var-before-value(orduring,after,startingAt,endingAt).
<<card>>...cover...<<contents>>...contents...<</card>><<choices var>><<when>>tags...<<offer>>contents...<</choices>>- store a list of choices invar.<<requirements card=QBN.current wrap=none separate="comma">>- show requirements for a card or choice.<<linkif condition title [linktext]>>- display title (or linktext if given). Ifconditionis truthy, make it a link to the given passage.
QBN.cards(limit=none)- select available cards from the deck, up to limit.QBN.filter(cards, limit=none)- select from given passage list.<<fillhand $hand limit cards>>- attempt to fill$handto itslimitwith random selections fromcards.QBN.visible(card)- should this card be visible (are itsreq-requirements met)?QBN.available(card)- should this card's contents be available? Both itsreq-and itsalso-requirements must be met.
<<includecard card>>- setQBN.currenttocardand then include it. SugarCube doesn't track the names of included passages, so this lets us do that. It nests properly in case you want to include cards inside cards.<<includeall cards wrap="content" separate=none>>
Then we have several helper macros which build on the above two:
<<cardlist cards wrap="content">>- comma separated list.<<cardrow cards wrap="contentbox">><<cardcolumn cards wrap="contentbox">>
<<comma last>>
<<cover>>and<<coverbox>><<content>>and<<contentbox>><<linkto>>and<<linkbox>>
These are called as <<wrap card>>, where card may be a passage title or a passage-like object (choice, etc.).