-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwidgets.txt
76 lines (53 loc) · 1.87 KB
/
widgets.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Comma-separated lists: call with "linkto" for links instead
* of contents.
*/
<<widget "cardlist">>\
<<includeall $args[0] `$args[1] or "content"` "comma">>\
<</widget>>
/*
* Rows and columns of card contents in boxes: call with "linkbox"
* for links, or "coverbox" for covers.
*/
<<widget "cardcolumn">>@@.qbn-column;
<<includeall $args[0] `$args[1] or "contentbox"`>>
@@<</widget>>
<<widget "cardrow">>@@.qbn-row;
<<includeall $args[0] `$args[1] or "contentbox"`>>
@@<</widget>>
/* Comma separator (no serial comma). */
<<widget "comma">><<if $args[0]>> and <<else>>, <</if>><</widget>>
/* Wrapper widgets (card contents or links, optionally boxed). */
<<widget "cover">>\
<<set _qbn_cover to true>><<includecard $args[0]>><<unset _qbn_cover>>\
<</widget>>
<<widget "content">><<if `QBN.available($args[0])`>>\
<<unset _qbn_cover>><<includecard $args[0]>><<removecard $args[0] false>>\
<</if>><</widget>>
<<widget "linkto">><<print '[\[' + $args[0] + ']]'>><</widget>>
<<widget "coverbox">>@@.qbn-card;
<<cover $args[0]>>
@@<</widget>>
<<widget "contentbox">>@@.qbn-card;
<<content $args[0]>>
@@<</widget>>
<<widget "linkbox">>@@.qbn-card;
<<linkto $args[0]>>
@@<</widget>>
/* Conditional Links */
<<widget "linkif">>\
<<if $args[0]>><<= '[\['+($args[2] or $args[1])+'->'+$args[1]+']]'>>\
<<else>>@@.qbn-nolink;<<= $args[2] or $args[1]>>@@<</if>>\
<</widget>>
<<widget "linkcontents">><<linkif `QBN.available($args[1] or QBN.current)` `$args[1] or QBN.current` $args[0]>><</widget>>
/* Choice helpers */
<<widget "skillcheck">>\
<<set _qbnsuccess to $args[0].check($args[1])>>\
<</widget>>
<<widget "gotoresult">>\
<<if _qbnsuccess>><<set $args[0] to $args[0] + ' ' + Success>><</if>>\
<<if State.random() < 0.20 and Story.get('Rare ' + $args[0])>>\
<<set $args[0] to 'Rare ' + $args[0]>>\
<</if>>\
<<unset _qbnsuccess>><<removecard _qbncurrent false>><<goto $args[0]>>\
<</widget>>