dfpyre 0.7.11__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dfpyre might be problematic. Click here for more details.
- {dfpyre-0.7.11 → dfpyre-0.8.0}/PKG-INFO +150 -158
- {dfpyre-0.7.11 → dfpyre-0.8.0}/README.md +149 -157
- {dfpyre-0.7.11 → dfpyre-0.8.0}/dfpyre/items.py +70 -47
- dfpyre-0.8.0/dfpyre/pyre.py +454 -0
- {dfpyre-0.7.11 → dfpyre-0.8.0}/dfpyre/scriptgen.py +61 -39
- {dfpyre-0.7.11 → dfpyre-0.8.0}/dfpyre/util.py +11 -0
- {dfpyre-0.7.11 → dfpyre-0.8.0}/pyproject.toml +1 -1
- dfpyre-0.7.11/dfpyre/pyre.py +0 -458
- {dfpyre-0.7.11 → dfpyre-0.8.0}/LICENSE +0 -0
- {dfpyre-0.7.11 → dfpyre-0.8.0}/dfpyre/__init__.py +0 -0
- {dfpyre-0.7.11 → dfpyre-0.8.0}/dfpyre/actiondump.py +0 -0
- {dfpyre-0.7.11 → dfpyre-0.8.0}/dfpyre/data/actiondump_min.json +0 -0
- {dfpyre-0.7.11 → dfpyre-0.8.0}/dfpyre/style.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dfpyre
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: A package for creating and modifying code templates for the DiamondFire Minecraft server.
|
|
5
5
|
Home-page: https://github.com/Amp63/pyre
|
|
6
6
|
License: MIT
|
|
@@ -18,7 +18,7 @@ Description-Content-Type: text/markdown
|
|
|
18
18
|
|
|
19
19
|
# pyre
|
|
20
20
|
|
|
21
|
-
A package for external creation of code templates for the DiamondFire Minecraft server (
|
|
21
|
+
A package for external creation of code templates for the DiamondFire Minecraft server (mcDiamondFire.com).
|
|
22
22
|
|
|
23
23
|
PyPi Link: https://pypi.org/project/dfpyre/
|
|
24
24
|
|
|
@@ -34,8 +34,8 @@ pip install dfpyre
|
|
|
34
34
|
- All code item types
|
|
35
35
|
- Direct sending to DF via recode or codeclient
|
|
36
36
|
- Automatic type conversion (int to num, str to text)
|
|
37
|
-
-
|
|
38
|
-
-
|
|
37
|
+
- Warnings for unrecognized actions and tags
|
|
38
|
+
- Full tag support
|
|
39
39
|
|
|
40
40
|
## Documentation
|
|
41
41
|
## Basics
|
|
@@ -73,92 +73,64 @@ pip install dfpyre
|
|
|
73
73
|
- [Editing Tags](#editing-tags)
|
|
74
74
|
- [Importing from Code](#importing-from-code)
|
|
75
75
|
- [Script Generation](#script-generation)
|
|
76
|
-
- [
|
|
76
|
+
- [Function List](#function-list)
|
|
77
77
|
|
|
78
78
|
___
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
## Setup
|
|
81
81
|
|
|
82
|
-
To start creating in pyre,
|
|
82
|
+
To start creating in pyre, use the `player_event`, `entity_event`, `function`, or `process` functions to start a template.
|
|
83
83
|
|
|
84
84
|
```py
|
|
85
85
|
from dfpyre import *
|
|
86
|
-
t = DFTemplate()
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Basically everything stems from this template object.
|
|
90
86
|
|
|
91
|
-
|
|
87
|
+
template = player_event('Join', [
|
|
92
88
|
|
|
93
|
-
|
|
94
|
-
from dfpyre import *
|
|
95
|
-
t = DFTemplate()
|
|
96
|
-
# [Event, Function, or Process]
|
|
97
|
-
# [Your code here]
|
|
98
|
-
t.build()
|
|
89
|
+
])
|
|
99
90
|
```
|
|
100
91
|
|
|
101
|
-
|
|
92
|
+
You can then insert additional codeblocks inside of that first function call.
|
|
102
93
|
|
|
103
94
|
Here's a complete program that prints a message to every player when a player joins:
|
|
104
95
|
|
|
105
96
|
```py
|
|
106
97
|
from dfpyre import *
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
|
|
99
|
+
player_event('Join', [
|
|
100
|
+
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
101
|
+
]).build_and_send('codeclient')
|
|
111
102
|
```
|
|
112
103
|
|
|
113
|
-
|
|
104
|
+
## Events and Actions
|
|
114
105
|
|
|
115
106
|
You can find a list of events and actions [here](#method-list)
|
|
116
107
|
|
|
117
|
-
As shown in [setup](#setup), every code line must start with an event, function, or process. After that, you're free to put anything you want.
|
|
118
|
-
|
|
119
108
|
The following program sends a message to all players and gives a player 10 apples upon joining:
|
|
120
109
|
|
|
121
110
|
```py
|
|
122
111
|
from dfpyre import *
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
112
|
+
|
|
113
|
+
player_event('Join', [
|
|
114
|
+
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
115
|
+
player_action('GiveItems', Item('apple', 10))
|
|
116
|
+
]).build_and_send('codeclient')
|
|
127
117
|
```
|
|
128
118
|
|
|
129
|
-
|
|
119
|
+
## Building
|
|
130
120
|
|
|
131
121
|
You have 2 different options for building your code line.
|
|
132
122
|
You can either:
|
|
133
123
|
|
|
134
124
|
1. Save the compressed template code to a variable and send it to minecraft later
|
|
125
|
+
- Use the `build` method on a template object
|
|
135
126
|
2. Build and send directly to your minecraft client (recommended)
|
|
127
|
+
- Use the `build_and_send` method on a template object
|
|
136
128
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
```py
|
|
140
|
-
from dfpyre import *
|
|
141
|
-
t = DFTemplate()
|
|
142
|
-
t.player_event('Join')
|
|
143
|
-
t.player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
144
|
-
template_code = t.build() # do whatever you want with this
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
If you choose the second option, you can do this:
|
|
148
|
-
|
|
149
|
-
```py
|
|
150
|
-
from dfpyre import *
|
|
151
|
-
t = DFTemplate()
|
|
152
|
-
t.player_event('Join')
|
|
153
|
-
t.player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
154
|
-
t.build_and_send('codeclient') # builds and sends automatically to minecraft
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Variable Items
|
|
129
|
+
## Variable Items
|
|
158
130
|
|
|
159
131
|
### Text
|
|
160
132
|
|
|
161
|
-
Represents a
|
|
133
|
+
Represents a DiamondFire text item:
|
|
162
134
|
|
|
163
135
|
```py
|
|
164
136
|
text('hello %default.')
|
|
@@ -168,63 +140,67 @@ If a regular string is passed to a method as a chest parameter, it will automati
|
|
|
168
140
|
|
|
169
141
|
```py
|
|
170
142
|
# These do the same thing:
|
|
171
|
-
|
|
172
|
-
|
|
143
|
+
player_action('SendMessage', Text('%default joined.'))
|
|
144
|
+
player_action('SendMessage', '%default joined.')
|
|
173
145
|
```
|
|
174
146
|
|
|
175
147
|
### Number
|
|
176
148
|
|
|
177
|
-
|
|
149
|
+
Alias: `Num`
|
|
150
|
+
|
|
151
|
+
Represents a DiamondFire number item:
|
|
178
152
|
|
|
179
153
|
```py
|
|
180
|
-
|
|
181
|
-
|
|
154
|
+
Number(5)
|
|
155
|
+
Number(3.14)
|
|
182
156
|
```
|
|
183
157
|
|
|
184
158
|
If a regular integer or float is passed to a method as a chest parameter, it will automatically be converted to a num object:
|
|
185
159
|
|
|
186
160
|
```py
|
|
187
161
|
# These do the same thing:
|
|
188
|
-
|
|
189
|
-
|
|
162
|
+
set_variable('=', Variable('number'), num(10))
|
|
163
|
+
set_variable('=', Variable('number'), 10)
|
|
190
164
|
```
|
|
191
165
|
|
|
192
166
|
### Variable
|
|
193
167
|
|
|
194
|
-
|
|
168
|
+
Alias: `Var`
|
|
169
|
+
|
|
170
|
+
Represents a DiamondFire variable item:
|
|
195
171
|
|
|
196
172
|
```py
|
|
197
|
-
|
|
198
|
-
|
|
173
|
+
Variable('num')
|
|
174
|
+
Variable('text1')
|
|
199
175
|
```
|
|
200
176
|
|
|
201
177
|
You can set variable values by using the `set_variable` method:
|
|
202
178
|
|
|
203
179
|
```py
|
|
204
|
-
|
|
205
|
-
|
|
180
|
+
set_variable('=', Variable('num'), 12) # sets 'num' to 12
|
|
181
|
+
set_variable('x', Variable('doubled'), Variable('num'), 2) # sets 'doubled' to 24
|
|
206
182
|
```
|
|
207
183
|
|
|
208
|
-
You can set the scope of the variable
|
|
184
|
+
You can set the scope of the variable using the `scope` argument:
|
|
209
185
|
|
|
210
186
|
```py
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
187
|
+
set_variable('=', Variable('num1', scope='unsaved'), 12) # `unsaved` is the same as a game variable.
|
|
188
|
+
set_variable('=', Variable('num2', scope='saved'), 12)
|
|
189
|
+
set_variable('=', Variable('num3', scope='local'), 12)
|
|
214
190
|
```
|
|
215
191
|
|
|
216
192
|
#### Shorthand Variables
|
|
217
193
|
|
|
218
|
-
You can also use the variable shorthand format
|
|
194
|
+
You can also use the variable shorthand format to express variables more tersely:
|
|
219
195
|
```py
|
|
220
196
|
# These do the same thing:
|
|
221
|
-
|
|
222
|
-
|
|
197
|
+
set_variable('=', Variable('lineVar', scope='line'), 5)
|
|
198
|
+
set_variable('=', '$i lineVar', 5)
|
|
223
199
|
```
|
|
224
200
|
|
|
225
|
-
Shorthand vars should be formatted like this: `$[scope id][var name]`
|
|
201
|
+
Shorthand vars should be formatted like this: `$[scope id] [var name]`
|
|
226
202
|
|
|
227
|
-
Here's
|
|
203
|
+
Here's the list of scope IDs:
|
|
228
204
|
- `g` = Game (unsaved)
|
|
229
205
|
- `s` = Saved
|
|
230
206
|
- `l` = Local
|
|
@@ -232,20 +208,23 @@ Here's a list of the scope IDs:
|
|
|
232
208
|
|
|
233
209
|
### Location
|
|
234
210
|
|
|
235
|
-
|
|
211
|
+
Alias: `Loc`
|
|
212
|
+
|
|
213
|
+
Represents a DiamondFire location item:
|
|
236
214
|
|
|
237
215
|
```py
|
|
238
|
-
|
|
216
|
+
Location(x=25.5, y=50, z=25.5, pitch=0, yaw=-90)
|
|
239
217
|
```
|
|
240
218
|
|
|
241
219
|
Example:
|
|
242
220
|
|
|
243
221
|
```py
|
|
244
|
-
#
|
|
222
|
+
# Teleport player on join
|
|
245
223
|
from dfpyre import *
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
224
|
+
|
|
225
|
+
player_event('Join', [
|
|
226
|
+
player_action('Teleport', Location(10, 50, 10))
|
|
227
|
+
])
|
|
249
228
|
```
|
|
250
229
|
|
|
251
230
|
### Item
|
|
@@ -253,58 +232,64 @@ t.player_action('Teleport', loc(10, 50, 10))
|
|
|
253
232
|
Represents a minecraft item:
|
|
254
233
|
|
|
255
234
|
```py
|
|
256
|
-
|
|
257
|
-
|
|
235
|
+
Item('stick', count=5)
|
|
236
|
+
Item('stone', 64)
|
|
258
237
|
```
|
|
259
238
|
|
|
260
239
|
To add extra data to an item, you can use any methods from the [mcitemlib](https://github.com/Amp63/mcitemlib) library
|
|
261
240
|
|
|
262
241
|
### Sound
|
|
263
242
|
|
|
264
|
-
|
|
243
|
+
Alias: `Snd`
|
|
244
|
+
|
|
245
|
+
Represents a DiamondFire sound item:
|
|
265
246
|
|
|
266
247
|
```py
|
|
267
|
-
|
|
248
|
+
Sound('Wood Break', pitch=1.5, vol=2.0)
|
|
268
249
|
```
|
|
269
250
|
|
|
270
251
|
Example:
|
|
271
252
|
|
|
272
253
|
```py
|
|
273
|
-
#
|
|
254
|
+
# Plays 'Grass Place' sound on join
|
|
274
255
|
from dfpyre import *
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
256
|
+
|
|
257
|
+
player_event('Join', [
|
|
258
|
+
player_action('PlaySound', Sound('Grass Place'))
|
|
259
|
+
])
|
|
278
260
|
```
|
|
279
261
|
|
|
280
262
|
### Particle
|
|
281
263
|
|
|
282
|
-
Represents a
|
|
264
|
+
Represents a DiamondFire particle item:
|
|
283
265
|
|
|
284
266
|
```py
|
|
285
|
-
|
|
267
|
+
Particle({'particle':'Cloud','cluster':{'amount':1,'horizontal':0.0,'vertical':0.0},'data':{'x':1.0,'y':0.0,'z':0.0,'motionVariation':100}})
|
|
286
268
|
```
|
|
287
269
|
|
|
288
270
|
Example:
|
|
289
271
|
|
|
290
272
|
```py
|
|
291
|
-
#
|
|
273
|
+
# Plays a white cloud particle effect at 5, 50, 5
|
|
292
274
|
from dfpyre import *
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
275
|
+
|
|
276
|
+
part = Particle({'particle':'Cloud','cluster':{'amount':1,'horizontal':0.0,'vertical':0.0},'data':{'x':1.0,'y':0.0,'z':0.0,'motionVariation':100}})
|
|
277
|
+
player_event('Join', [
|
|
278
|
+
player_action('Particle', part, loc(5, 50, 5))
|
|
279
|
+
])
|
|
297
280
|
```
|
|
298
281
|
|
|
299
282
|
Currently, the particle object does not support colors.
|
|
300
283
|
|
|
301
284
|
### Potion
|
|
302
285
|
|
|
303
|
-
|
|
286
|
+
Alias: `Pot`
|
|
287
|
+
|
|
288
|
+
Represents a DiamondFire potion item:
|
|
304
289
|
|
|
305
290
|
```py
|
|
306
291
|
# gives speed 1 for 1 minute
|
|
307
|
-
|
|
292
|
+
Potion('Speed', dur=1200, amp=0)
|
|
308
293
|
```
|
|
309
294
|
|
|
310
295
|
Example:
|
|
@@ -312,18 +297,19 @@ Example:
|
|
|
312
297
|
```py
|
|
313
298
|
# gives the player infinite saturation 255
|
|
314
299
|
from dfpyre import *
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
300
|
+
|
|
301
|
+
player_event('Join', [
|
|
302
|
+
player_action('GivePotion', Potion('Saturation', amp=10))
|
|
303
|
+
])
|
|
318
304
|
```
|
|
319
305
|
|
|
320
306
|
### Game Value
|
|
321
307
|
|
|
322
|
-
Represents a
|
|
308
|
+
Represents a DiamondFire game value item:
|
|
323
309
|
|
|
324
310
|
```py
|
|
325
|
-
|
|
326
|
-
|
|
311
|
+
GameValue('Player Count')
|
|
312
|
+
GameValue('Location' target='Selection')
|
|
327
313
|
```
|
|
328
314
|
|
|
329
315
|
Example:
|
|
@@ -331,17 +317,20 @@ Example:
|
|
|
331
317
|
```py
|
|
332
318
|
# function that prints player count and cpu
|
|
333
319
|
from dfpyre import *
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
320
|
+
|
|
321
|
+
function('printData', [
|
|
322
|
+
player_action('SendMessage', GameValue('Player Count'), GameValue('CPU Usage'))
|
|
323
|
+
])
|
|
337
324
|
```
|
|
338
325
|
|
|
339
326
|
### Vector
|
|
340
327
|
|
|
341
|
-
|
|
328
|
+
Alias: `Vec`
|
|
329
|
+
|
|
330
|
+
Represents a DiamondFire vector item:
|
|
342
331
|
|
|
343
332
|
```py
|
|
344
|
-
|
|
333
|
+
Vector(x=1.1, y=0.0, z=0.5)
|
|
345
334
|
```
|
|
346
335
|
|
|
347
336
|
Example:
|
|
@@ -349,17 +338,18 @@ Example:
|
|
|
349
338
|
```py
|
|
350
339
|
# sets the player's x velocity to 1.0 on join
|
|
351
340
|
from dfpyre import *
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
341
|
+
|
|
342
|
+
player_event('Join', [
|
|
343
|
+
player_action('SetVelocity', Vector(x=1.0, y=0.0, z=0.0))
|
|
344
|
+
])
|
|
355
345
|
```
|
|
356
346
|
|
|
357
347
|
### Parameter
|
|
358
348
|
|
|
359
|
-
Represents a
|
|
349
|
+
Represents a DiamondFire parameter item:
|
|
360
350
|
|
|
361
351
|
```py
|
|
362
|
-
|
|
352
|
+
Parameter('text', ParameterType.STRING)
|
|
363
353
|
```
|
|
364
354
|
|
|
365
355
|
Example:
|
|
@@ -367,44 +357,44 @@ Example:
|
|
|
367
357
|
```py
|
|
368
358
|
# builds a function that says "Hello, [name]" where `name` is the inputted parameter.
|
|
369
359
|
from dfpyre import *
|
|
370
|
-
|
|
360
|
+
|
|
371
361
|
name_parameter = parameter('name', ParameterType.TEXT)
|
|
372
|
-
|
|
373
|
-
|
|
362
|
+
function('SayHi', name_parameter codeblocks=[
|
|
363
|
+
player_action('SendMessage', 'Hello, ', Variable('name', 'line'))
|
|
364
|
+
])
|
|
374
365
|
```
|
|
375
366
|
|
|
376
367
|
### Conditionals and Brackets
|
|
377
368
|
|
|
378
369
|
A list of conditionals and loops can be found [here](#method-list).
|
|
379
370
|
|
|
380
|
-
A specific syntax must be followed when creating conditionals and loops.
|
|
371
|
+
A specific syntax must be followed when creating conditionals and loops. Here's an example:
|
|
381
372
|
|
|
382
373
|
```py
|
|
383
|
-
#
|
|
374
|
+
# Prints 'clicked' when a player right clicks with a stick in their hand
|
|
384
375
|
from dfpyre import *
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
)
|
|
376
|
+
|
|
377
|
+
player_event('RightClick', [
|
|
378
|
+
if_player('IsHolding', Item('stick'), codeblocks=[
|
|
379
|
+
player_action('SendMessage', 'clicked')
|
|
380
|
+
])
|
|
381
|
+
])
|
|
391
382
|
```
|
|
392
383
|
|
|
393
384
|
To create an `else` statement, use the `else_` method:
|
|
394
385
|
|
|
395
386
|
```py
|
|
396
|
-
#
|
|
387
|
+
# Says the player is 'on the ground' when grounded and 'in the air' otherwise.
|
|
397
388
|
from dfpyre import *
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
)
|
|
389
|
+
|
|
390
|
+
function('grounded' [
|
|
391
|
+
if_player('IsGrounded', codeblocks=[
|
|
392
|
+
player_action('ActionBar', 'on the ground')
|
|
393
|
+
])
|
|
394
|
+
else_([
|
|
395
|
+
player_action('ActionBar', 'in the air')
|
|
396
|
+
])
|
|
397
|
+
])
|
|
408
398
|
```
|
|
409
399
|
|
|
410
400
|
### Loops
|
|
@@ -412,26 +402,27 @@ t.bracket(
|
|
|
412
402
|
As for loops, the bracket syntax is the same and will automatically change to "repeat-type" brackets:
|
|
413
403
|
|
|
414
404
|
```py
|
|
415
|
-
#
|
|
405
|
+
# Prints numbers 1-5
|
|
416
406
|
from dfpyre import *
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
)
|
|
407
|
+
|
|
408
|
+
player_event('Join', [
|
|
409
|
+
repeat('Multiple', Variable('i'), 5, codeblocks=[
|
|
410
|
+
player_action('SendMessage', Variable('i'))
|
|
411
|
+
])
|
|
412
|
+
])
|
|
423
413
|
```
|
|
424
414
|
|
|
425
415
|
### Creating Functions and Processes
|
|
426
416
|
|
|
427
|
-
To create a function or process, just start the template with
|
|
417
|
+
To create a function or process, just start the template with `function` or `process`:
|
|
428
418
|
|
|
429
419
|
```py
|
|
430
|
-
#
|
|
420
|
+
# Function that gives a player 64 golden apples
|
|
431
421
|
from dfpyre import *
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
422
|
+
|
|
423
|
+
function('doStuff', codeblocks=[
|
|
424
|
+
player_action('GiveItems', Item('golden_apple', 64))
|
|
425
|
+
])
|
|
435
426
|
```
|
|
436
427
|
|
|
437
428
|
### Calling Functions and Processes
|
|
@@ -440,9 +431,10 @@ Calling Functions and processes is also simple:
|
|
|
440
431
|
|
|
441
432
|
```py
|
|
442
433
|
from dfpyre import *
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
434
|
+
|
|
435
|
+
player_event('Join', [
|
|
436
|
+
call_function('doStuff')
|
|
437
|
+
])
|
|
446
438
|
```
|
|
447
439
|
|
|
448
440
|
### Editing Tags
|
|
@@ -450,9 +442,10 @@ You can edit an action's tags by passing the `tags` argument to a template metho
|
|
|
450
442
|
|
|
451
443
|
```py
|
|
452
444
|
from dfpyre import *
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
445
|
+
|
|
446
|
+
player_event('Join', [
|
|
447
|
+
player_action('SendMessage', 'hello', tags={'Alignment Mode': 'Centered'})
|
|
448
|
+
])
|
|
456
449
|
```
|
|
457
450
|
|
|
458
451
|
If you choose not to modify a specific tag, its default value will be used.
|
|
@@ -464,10 +457,10 @@ You can import existing templates from their built code using the `from_code` me
|
|
|
464
457
|
|
|
465
458
|
```py
|
|
466
459
|
from dfpyre import *
|
|
467
|
-
template_code = 'H4sIAGVyIGYC/3WOMQ7CMAxFz4LnDsw5AhITI6qQSaw2IrGrxkJCVe5eh3boAJP9n/Kfs8AziX8VcPcFYgC3Zej26YDexGoZvUZhAxeJ3PI8WMtKSrnV+1q7P4op4Yfmx244qG7E4Uql4EA/jNv2Jc3qJU/2KqBiY4yZjI6UkpzAjkNJouDO1X7S1xUDaGUl2QAAAA=='
|
|
468
460
|
|
|
461
|
+
template_code = 'H4sIAGVyIGYC/3WOMQ7CMAxFz4LnDsw5AhITI6qQSaw2IrGrxkJCVe5eh3boAJP9n/Kfs8AziX8VcPcFYgC3Zej26YDexGoZvUZhAxeJ3PI8WMtKSrnV+1q7P4op4Yfmx244qG7E4Uql4EA/jNv2Jc3qJU/2KqBiY4yZjI6UkpzAjkNJouDO1X7S1xUDaGUl2QAAAA=='
|
|
469
462
|
t = DFTemplate.from_code(template_code)
|
|
470
|
-
#
|
|
463
|
+
# Do stuff with the template here
|
|
471
464
|
```
|
|
472
465
|
|
|
473
466
|
|
|
@@ -477,13 +470,13 @@ You can also generate an equivalent python script for a template from a template
|
|
|
477
470
|
|
|
478
471
|
```py
|
|
479
472
|
from dfpyre import *
|
|
480
|
-
template_code = 'H4sIAGVyIGYC/3WOMQ7CMAxFz4LnDsw5AhITI6qQSaw2IrGrxkJCVe5eh3boAJP9n/Kfs8AziX8VcPcFYgC3Zej26YDexGoZvUZhAxeJ3PI8WMtKSrnV+1q7P4op4Yfmx244qG7E4Uql4EA/jNv2Jc3qJU/2KqBiY4yZjI6UkpzAjkNJouDO1X7S1xUDaGUl2QAAAA=='
|
|
481
473
|
|
|
474
|
+
template_code = 'H4sIAGVyIGYC/3WOMQ7CMAxFz4LnDsw5AhITI6qQSaw2IrGrxkJCVe5eh3boAJP9n/Kfs8AziX8VcPcFYgC3Zej26YDexGoZvUZhAxeJ3PI8WMtKSrnV+1q7P4op4Yfmx244qG7E4Uql4EA/jNv2Jc3qJU/2KqBiY4yZjI6UkpzAjkNJouDO1X7S1xUDaGUl2QAAAA=='
|
|
482
475
|
t = DFTemplate.from_code(template_code)
|
|
483
476
|
t.generate_script('my_template.py') # generated python script will be written to my_template.py
|
|
484
477
|
```
|
|
485
478
|
|
|
486
|
-
###
|
|
479
|
+
### Function List
|
|
487
480
|
|
|
488
481
|
- Events / Function / Process
|
|
489
482
|
- player_event
|
|
@@ -505,7 +498,6 @@ t.generate_script('my_template.py') # generated python script will be written
|
|
|
505
498
|
- if_entity
|
|
506
499
|
- else_
|
|
507
500
|
- repeat
|
|
508
|
-
- bracket
|
|
509
501
|
|
|
510
502
|
- Other
|
|
511
503
|
- control
|