Tag passages with:
card
or sticky-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
- $name
or _name
has 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 is eq |
neq |
lt |
gt |
lte |
gte ; use _ for decimal point. eq and neq also work with name-op-string . |
before
or during
or after
, startingAt
or endingAt
for 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 tag blah_blah
?Checking variables:
<<range "$var" n1 name n2 name2 ...>>
- set _name_var
to true for the name of the range (if any) that $var
falls 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:
<<progress "$var" value ...>>
, giving as many values as you like.<<advance "$var" n>>
to advance n
steps (optional, default is 1, negative numbers work too).<<advance "$var" "value">
to advance to a given value (only goes forward, never back).req-var-before-value
(or during
, after
, startingAt
, endingAt
).<<card>>...cover...<<contents>>...contents...<</card>>
<<choices var>><<when>>tags...<<offer>>contents...<</choices>>
- store a list of choices in var
.<<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). If condition
is 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 $hand
to its limit
with random selections from cards
.QBN.visible(card)
- should this card be visible (are its req-
requirements met)?QBN.available(card)
- should this card’s contents be available? Both its req-
and its also-
requirements must be met.<<includecard card>>
- set QBN.current
to card
and 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.).