-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathREADME
More file actions
236 lines (192 loc) · 6.72 KB
/
README
File metadata and controls
236 lines (192 loc) · 6.72 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
This repository contains extensions and patches used for the Dwarf
Fortress Wiki.
DFRawFunctions
==============
DFRawFunctions is a MediaWiki extension designed for parsing Dwarf
Fortress raws.
df_raw
------
Searches through a raw file and returns raws for a specific object. If
only "data" is specified, the entire contents of the raw file are
returned.
Usage: {{#df_raw:data|object|id|notfound}}
Parameters:
* data
- Either a filename (of the format "namespace:raw_file.txt") or its
contents.
* object
- The object type to search for.
* id
- The ID of the object you are searching for. Objects begin with
"[object:id]" (e.g. [INORGANIC:SANDSTONE] or [CREATURE:DWARF])
* notfound
- The string to be returned if the specified entity could not be located.
Example: {{#df_raw:DF2014:creature_standard.txt|CREATURE|DWARF|Not found!}}
df_tag
------
Checks if a particular tag exists, optionally with a specific token at
a specific offset. Returns 1 if found, otherwise returns nothing.
Usage: {{#df_tag:data|type|offset|entry}}
Parameters:
* data
- The raws for a single object.
* type
- The tag type you are searching for.
* offset
- Optional, specifies an offset to check for a specific value.
* entry
- Optional, specifies the actual value to look for at the above offset.
Example: {{#df_tag:[dwarf raws]|PERSONALITY|1|IMMODERATION}}
df_tagentry
-----------
Finds the Nth tag of the specified type, with any number of specific
tokens at specific offsets, and returns the token at the specified
offset.
Usage: {{#df_tagentry:data|type|num|offset|notfound|matches...}}
Parameters:
* data
- The raws for a single object.
* type
- The tag type you are searching for.
* num
- The instance of the tag you want to fetch. Specify a negative number
to count from the end.
* offset
- The offset of the token to be returned. Specify a pair of numbers
separated by colons in order to return a range of tokens (also
separated by colons).
* notfound
- The string to be returned if the specified entity could not be
located.
* matches
- Zero or more match conditions. Match conditions are of the format
"offset:value". Only the Nth tag which satisfies all match conditions
will be returned.
Example: {{#df_tagentry:[dwarf raws]|PERSONALITY|0|2:4|Unknown!|1:IMMODERATION}}
df_tagvalue
-----------
Finds the Nth tag of the specified type and returns all of its values,
separated by colons.
Usage: {{#df_tagvalue:data|type|num|notfound}}
Parameters:
* data
- The raws for a single object.
* type
- The tag type you are searching for.
* num
- The instance of the tag you want to fetch. Specify a negative number
to count from the end.
* notfound
- The string to be returned if the specified entity could not be
located.
Example: {{#df_tagentry:[dwarf raws]|BODY_SIZE|0|Unknown!}}
df_foreachtag
-------------
Iterates across all tags of the specified type and outputs a formatted
string for each one.
Usage: {{#df_foreachtag:data|type|string}}
Parameters:
* data
- The raws for a single object.
* type
- The tag type you are searching for.
* string
- A format string into which token values can be substituted using \1,
\2, ..., \9. The first parameter is the tag name itself. Currently
does not support more than 9 parameters.
Example: {{#df_foreachtag:[stone raws]|ENVIRONMENT_SPEC|"\2"}}
df_foreachtoken
---------------
Iterates across a set of tokens in specific groups and outputs a
formatted string for each one.
Usage: {{#df_foreachtoken:data|offset|group|string}}
Parameters:
* data
- A colon-separated list of values, usually the output from
df_tagvalue.
* offset
- How many tokens to ignore from the beginning of the list.
* group
- How many tokens should be parsed at once.
* string
- A format string into which token values can be substituted using \1,
\2, ..., \9. Currently does not support more than 9 parameters.
Example: {{#df_foreachtoken:
{{#df_tagvalue:[dwarf raws]|TL_COLOR_MODIFIER|0}}
|0|2|"\1"}}
df_makelist
-----------
Iterates across all objects in a single raw file and outputs a string
for each one.
Usage: {{#df_makelist:data|object|string|extracts...}}
Parameters:
* data
- Either a filename (of the format "namespace:raw_file.txt") or its
contents.
* object
- The object type to iterate across.
* string
- A format string into which values can be substituted using \1, \2,
..., \9. Currently does not support more than 9 parameters.
* extracts
- Zero or more token extraction parameters. Extraction parameters are
of the format "type:offset:checkoffset:checkvalue", where the first
matching tag of "type" will return the token at "offset" if the token
at "checkoffset" has the value "checkvalue". If "checkoffset" is set
to -1, the checkvalue is ignored.
- For material definitions, the format "STATE:type:state" can also be
used, where "type" and "state" are fed into df_statedesc below.
- The order in which the extraction parameters are defined will
determine the substitution values used - the first will use \1, the
second will use \2, etc.
Example: {{#df_makelist:[all stone raws]|INORGANIC|"\2 \1"|
ENVIRONMENT_SPEC:2:1:MAGNETITE|STATE:NAME:SOLID}}
df_statedesc
------------
Parses a material definition and returns its name for a particular
state.
Usage: {{#df_statedesc:data|type|state}}
Parameters:
* data
- The raws for a single material.
* type
- Either NAME or ADJ, to specify whether the noun or adjective form
should be returned.
* state
- The state type whose name should be returned. Valid values are SOLID,
POWDER, PASTE, PRESSED, LIQUID, and GAS.
Example: {{#df_statedesc:[stone raw]|NAME|SOLID}}
df_cvariation
-------------
Parses a creature entry and decodes variation information.
Usage: {{#df_cvariation:data|base|variation...}}
Parameters:
* data
- The raws for a single creature.
* base
- The raw file which contains the "base" creature - either a filename
(of the format "namespace:raw_file.txt") or its contents.
* variation...
- One or more raw files which contain creature variation data - either
filenames (of the format "namespace:raw_file.txt") or their contents.
Example: {{#df_cvariation:
{{#df_raw:DF2014:creature_large_temperate.txt|
CREATURE|BADGER, GIANT}}|
DF2014:creature_large_temperate.txt|
DF2014:cvariation_default.txt}}
mreplace
--------
Performs multiple simple string replacements on the data specified.
Usage: {{#mreplace:data|from|to|from|to|...}}
delay
-----
Returns "{{parm1|parm2|parm3|...}}", intended for delayed evaluation of
templates and parser functions when used with df_foreachtag,
df_foreachtoken, and df_makelist.
Usage: {{#delay:parm1|parm2|parm3|...}}
eval
----
Evaluates all parser functions and template calls in the specified
data. Intended for usage with df_foreachtag, df_foreachtoken, and
df_makelist.
Usage: {{#eval:data}}