Date: 2015/08/11 03:53:26 UTC-07:00
Type: Denizen Script
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# /doorkey tier reset
# /doorkey tier list
# /doorkey tier create hideflags
# /doorkey tier edit display|material|lore|recipe value
# /doorkey tier edit lore [#] value
# /doorkey tier give player
# /doorkey tier remove
# lore: 1|2|3|4
# Enter as many values as you want. However they must be separated by |
# Optionally specify a lore line and then the value.
# recipe: 1|2|3|4|5|6|7|8|9
# Items are set up as below; make sure to use the correct name. For example: diamond_sword
# Separation works as with lores.
# - i@1|i@2|i@3
# - i@4|i@5|i@6
# - i@7|i@8|i@9
# When creating an item use hideflags to remove the data shown on the item such as damage, splash effect or other. For example:
# /doorkey mykey create hideflags
DoorKeys:
type: world
events:
on player clicks block:
- if <context.location.material> !contains "door" {
- queue clear
}
- foreach <server.list_flags> {
- if <fl@%value%.as_list.contains[<context.location.block>]> {
- goto is_locked
}
- if <def[loop_index]> == <server.list_flags.size> {
- queue clear
}
}
- mark is_locked
- foreach <server.list_flags> {
- if <fl@%value%.as_list.contains[<context.location.block>]> {
- define tier <def[value].after[T]>
}
}
- if !<context.item.display.contains[<def[tier]>]> {
- narrate "<red>You need to use the tier <def[tier]> key to open this!"
- determine cancelled
} else {
- narrate "<green>You have used the tier <def[tier]> key!"
}
on doorkey command:
- determine fulfilled passively
- if <player.is_op> || <context.server> {
- goto pass
} else {
- narrate "<red>Must be Operator to use this command!"
- queue clear
}
- mark pass
- define tier <context.args.get[1]>
- choose <context.args.get[2]>:
- case "remove":
- narrate "<red>Removed <def[tier]> key!"
- yaml load:/scripts/doorkeys.dscript id:doorkeys
- yaml set <def[tier]>:! id:doorkeys
- queue clear
- case "give":
- narrate "<green>Giving <def[tier]> key!"
- give i@<def[tier]> to:<context.args.get[3]||<player>>
- queue clear
- case "list":
- narrate "<green>Tier <def[tier]> door keys are currently at<&co>"
- narrate "<green><server.flag[doorkeys_t<def[tier]>]>"
- queue clear
- case "reset":
- flag server doorkeys_t<def[tier]>:none
- narrate "<green>Tier <def[tier]> door keys reset!"
- queue clear
- case "create":
- if !<server.has_file[/scripts/doorkeys.dscript]> {
- yaml create id:doorkeys
- yaml savefile:/scripts/doorkeys.dscript id:doorkeys
}
- yaml load:/scripts/doorkeys.dscript id:doorkeys
- yaml set <def[tier]>.type:item id:doorkeys
- if <context.args.get[3]> == hideflags {
- yaml set "<def[tier]>.material:stone<proc[flags]>" id:doorkeys
- yaml set "<def[tier]>.useflags:true" id:doorkeys
} else {
- yaml set "<def[tier]>.material:stone" id:doorkeys
}
- yaml set "<def[tier]>.display name:<def[tier]>" id:doorkeys
- yaml set "<def[tier]>.lore:|:li@" id:doorkeys
- yaml set "<def[tier]>.recipe:->:recipe1" id:doorkeys
- yaml set "<def[tier]>.recipe:->:recipe2" id:doorkeys
- yaml set "<def[tier]>.recipe:->:recipe3" id:doorkeys
- narrate "<green><def[tier]> key created!"
- yaml savefile:/scripts/doorkeys.dscript id:doorkeys
- execute as_server "denizen reload scripts"
- queue clear
- case "edit":
- if !<yaml[doorkeys].contains[<def[tier]>]> {
- narrate "<red>Key not found!"
- queue clear
}
- if <context.args.get[4]> == null {
- narrate "<red>Please enter a value!"
- queue clear
}
- yaml load:/scripts/doorkeys.dscript id:doorkeys
- define value <context.args.get[4]>
- choose <context.args.get[3]>:
- case "display":
- yaml set "<def[tier]>.display name:<def[value]>" id:doorkeys
- yaml savefile:/scripts/doorkeys.dscript id:doorkeys
- narrate "<green>Display of Key <def[tier]> set to<&co> <def[value]>!"
- execute as_server "denizen reload scripts"
- case "material":
- if <def[tier].as_script.yaml_key[useflags]> == true {
- yaml set <def[tier]>.material:<def[value]><proc[flags]> id:doorkeys
} else {
- yaml set <def[tier]>.material:<def[value]> id:doorKeys
}
- yaml savefile:/scripts/doorkeys.dscript id:doorkeys
- narrate "<green>Material of Key <def[tier]> set to<&co> <def[value]>!"
- execute as_server "denizen reload scripts"
- case "lore":
- if <context.args.get[5]> !== null {
- define lore <context.args.get[5]>
- define line <def[value]>
- if <yaml[doorkeys].read[<def[tier]>.lore].as_list.size> < <def[line]> {
- repeat <def[value].sub[<yaml[doorkeys].read[<def[tier]>.lore].as_list.size>]> {
- yaml set "<def[tier]>.lore:->:<&sp>" id:doorkeys
}
}
- yaml set <def[tier]>.lore[<def[line]>]:<def[lore]> id:doorkeys
- yaml savefile:/scripts/doorkeys.dscript id:doorkeys
- execute as_server "denizen reload scripts"
- narrate "<green>Lore of Key <def[tier].lore> set to<&co> <def[value]>!"
- queue clear
}
- yaml set <def[tier]>.lore:|:li@<def[value]> id:doorkeys
- yaml savefile:/scripts/doorkeys.dscript id:doorkeys
- execute as_server "denizen reload scripts"
- narrate "<green>Lore of Key <def[tier].lore> set to<&co> <def[value]>!"
- case "recipe":
- if <def[value].as_list.size> > 9 {
- narrate "<red>Entered too many items!"
} else if <def[value].as_list.size> < 9 {
- narrate "<red>Not enough items entered!"
} else {
- define value <def[value].as_list>
- yaml set <def[tier]>.recipe[1]:i@<def[value].get[1]><&pipe>i@<def[value].get[2]><&pipe>i@<def[value].get[3]> id:doorkeys
- yaml set <def[tier]>.recipe[2]:i@<def[value].get[4]><&pipe>i@<def[value].get[5]><&pipe>i@<def[value].get[6]> id:doorkeys
- yaml set <def[tier]>.recipe[3]:i@<def[value].get[7]><&pipe>i@<def[value].get[8]><&pipe>i@<def[value].get[9]> id:doorkeys
- yaml savefile:/scripts/doorkeys.dscript id:doorkeys
- inventory open origin in@workbench[contents=li@i@stone]
- narrate "<green>Current crafting recipe<&co>"
- execute as_server "denizen reload scripts"
}
- queue clear
- if <player.location.cursor_on[10].above.material> contains "door" {
- define otherblock <player.location.cursor_on[10].above>
- define text "& <player.location.cursor_on[10].above>"
} else if <player.location.cursor_on[10].below.material> contains "door" {
- define otherblock <player.location.cursor_on[10].below>
- define text "& <player.location.cursor_on[10].below>"
} else {
- define otherblock none
}
- if <server.flag[doorkeys_t<def[tier]>].as_list> contains <player.location.cursor_on[10]> {
- flag server doorkeys_t<def[tier]>:<-:<player.location.cursor_on[10]>
- if <def[otherblock]> !== "none" {
- flag server doorkeys_t<def[tier]>:<-:<def[otherblock]>
}
- narrate "<red><player.location.cursor_on[10].simple> <def[otherblock].simple> removed from the Tier <def[tier]> Door list!"
} else {
- flag server doorkeys_t<def[tier]>:->:<player.location.cursor_on[10]>
- if <def[otherblock]> !== "none" {
- flag server doorkeys_t<def[tier]>:->:<def[otherblock]>
}
- narrate "<green><player.location.cursor_on[10].simple> & <def[otherblock].simple> added to the Tier <def[tier]> Door list!"
}
flags:
type: procedure
script:
- determine "[flags=li@HIDE_ATTRIBUTES|HIDE_DESTROYS|HIDE_ENCHANTS|HIDE_PLACED_ON|HIDE_POTION_EFFECTS|HIDE_UNBREAKABLE]"
# TeleportBack:
# type: world
# events:
# on player jumps:
# - run s@JumpCheck def:<context.location>
# - if <player.location.direction.contains[north]> {
# - define z 1
# } else if <player.location.direction.contains[south]> {
# - define z -1
# } else {
# - define z 0
# }
# - if <player.location.direction.contains[west]> {
# - define x 1
# } else if <player.location.direction.contains[east]> {
# - define x -1
# } else {
# - define x 0
# }
# - teleport <player> <player.location.add[<def[x]>,-0.5,<def[z]>]>
JumpCheck:
type: task
definitions: origin
script:
- wait 0.3s
- if <player.location.x.abs.sub[<%origin%.x.abs.as_money>].as_money> < 0.2 || <player.location.z.abs.sub[<%origin%.z.abs.as_money>].as_money> < 0.2 {
- teleport <player> %origin%
}
#######################
### USAGE
####################
### - run s@Spiral_Particles def:Location|Effect|Length|Radius|Rotation
### Location: origin (for example, <player.eye_location>)
### Effect: the particle effect in the format "effect,data,qty,offset" (if not specified, flame,0,1,0)
### Length: the distance in blocks to go before stopping (if not specified, 20)
### Radius: radius of the spiral (if not specified, 1)
### Rotation: the angle to start the spiral from (if not specified, a decimal between 0 and tau)
#################
Spiral_Particles:
type: task
definitions: location|effect|maxLength|radius|rotation
script:
- if !<def[effect].exists> || <def[effect]> == "" {
- define effect flame,0,1,0
}
- if !<def[maxLength].exists> || <def[maxLength]> == "" {
- define maxLength 20
}
- if !<def[radius].exists> || <def[radius]> == "" {
- define radius 1
}
- if !<def[rotation].exists> || <def[rotation]> == "" {
- define rotation <util.random.decimal[0].to[<util.tau>]>
}
- define effect <def[effect].split[,]>
- define length 0
- define angularVelocity <util.pi.div[16]>
- define pitchAngle <def[location].pitch.add[90].to_radians>
- define yawAngle <def[location].yaw.mul[-1].to_radians>
- while <def[length].is[LESS].than[<def[maxLength]>]> {
- define vector l@<def[rotation].cos.mul[<def[radius]>]>,<def[length]>,<def[rotation].sin.mul[<def[radius]>]>
- playeffect <def[location].add[<def[vector].rotate_around_x[<def[pitchAngle]>].rotate_around_y[<def[yawAngle]>]>]> "effect:<def[effect].get[1]||flame>" "data:<def[effect].get[2]||0>" "qty:<def[effect].get[3]||1>" "offset:<def[effect].get[4]||0>"
- define rotation <def[rotation].add[<def[angularVelocity]>]>
- define length <def[length].add[0.05]>
- if <def[loop_index].mod[15]> == 0 {
- wait 1t
}
}
######################################################################################################
######################################################################################################
## _ _____ __ ___ _____ ___ ##
## __| | \_ \ /__\ / __\ /__ \ __ _ __ _ / _ \ __ _ _ __ ___ ___ _ __ ##
## / _` | / /\/ / \// / / / /\/ / _` | / _` | / /_)/ / _` || '__|/ __| / _ \| '__| ##
## | (_| |/\/ /_ / _ \ / /___ / / | (_| || (_| | / ___/ | (_| || | \__ \| __/| | ##
## \__,_|\____/ \/ \_/ \____/ \/ \__,_| \__, | \/ \__,_||_| |___/ \___||_| ##
## |___/ ##
## Made by Fortifier42 ##
######################################################################################################
######################################################################################################
IRC_Chat:
debug: false
type: format
format: "<&sp><&7>[<&a>IRC<&7>] <&3><text>"
IRC_Config:
type: yaml data
# Change this to change the name your bot will display with in the IRC Channel!
#Probably a good idea to change this so you don't get conflicts between other bots/users.
botname: "Tag-Parser"
# Change the following line to change the join command argument(s)!
# At this stage, it does not change the /help irc output. :(
joincmds: join|connect|start
# Change the following line to change the quit command argument(s)!
# At this stage, it does not change the /help irc output. :(
quitcmds: quit|leave|exit|disconnect|stop
# Change the following line to change the msg command argument(s)!
# At this stage, it does not change the /help irc output. :(
msgcmds: send|say|tell|msg|message
# Change the following line to change the irc server to join!
server: "irc.esper.net"
# Change the following line to change the channel the bot will join!
channel: "#Denizen-Dev"
# Change the following line to determine what the prefix should be.
# It is good to have a space after the trigger to ensure readability and compatability!
trigger: ">tag "
# Set this to "" to stop logging all together, or change the file which IRC actions will be logged to.
# Currently only /irc send <message> and tag parsing are logged.
logfile: plugins/Denizen/logs/ircbot.log
IRC_Command:
debug: false
type: command
name: irc
usage: /irc <<>(join/quit/msg <<>message<>>)<>>
permission: irc.admin
description: Used to connect, leave and send messages to IRC.
script:
- if <context.args.size> == 0 {
- narrate format:IRC_Chat "<&c><script.yaml_key[usage]>"
- queue clear
}
- define cmd <context.args.get[1]>
- if <context.args.size> == 1 {
- if <s@IRC_Config.yaml_key[joincmds].as_list.contains_any[%cmd%]> {
- ~irc connect ircserver@<s@IRC_Config.yaml_key[server]>
- irc raw ircserver@<s@IRC_Config.yaml_key[server]> "USER <s@IRC_Config.yaml_key[botname]> <s@IRC_Config.yaml_key[botname]>_ <s@IRC_Config.yaml_key[botname]>__ <s@IRC_Config.yaml_key[botname]>"
- irc raw ircserver@<s@IRC_Config.yaml_key[server]> "NICK <s@IRC_Config.yaml_key[botname]>"
- irc join ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]>
- narrate format:IRC_Chat "Joined the IRC."
- queue clear
}
else if <s@IRC_Config.yaml_key[quitcmds].as_list.contains_any[%cmd%]> {
- ~irc leave ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]>
- ~irc quit ircserver@<s@IRC_Config.yaml_key[server]>
- narrate format:IRC_Chat "Left the IRC."
- queue clear
}
else {
- narrate format:IRC_Chat "<&c>Invalid command!"
- queue clear
}
}
else {
- if <s@IRC_Config.yaml_key[msgcmds].contains_any[%cmd%]> {
- define msg "<context.args.get[2].to[<context.args.size>].space_separated||null>"
- if %msg% == null {
- narrate format:IRC_Chat "<&c>No message has been specified."
- queue clear
}
- irc message ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]> <def[msg]>
- narrate format:IRC_Chat "Sent message: <&f><&sq>%msg%<&sq>"
- if <s@IRC_Config.yaml_key[logfile]> == "" queue clear
- log "<player.name||Console> sent <&sq>%msg%<&sq>" file:<s@IRC_Config.yaml_key[logfile]>
}
}
IRC_Parsing:
debug: false
type: world
events:
on irc message:
- if <context.channel> != "ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]>" || <context.message.substring[1,<s@IRC_Config.yaml_key[trigger].length>]> != <s@IRC_Config.yaml_key[trigger]> {
- queue clear
}
- define tags "<context.message.after[<s@IRC_Config.yaml_key[trigger]>]>"
- define parsed <parse.substring[1,300]:<def[tags]>>
- irc message ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]> "<context.speaker><&r><&co> the tag <&sq><&b><def[tags]><&r><&sq> fills with <&sq><&b><def[parsed]><&r><&sq>"
- if <s@IRC_Config.yaml_key[logfile]> == "" queue clear
- log "<context.speaker> parsed <def[tags]>" file:<s@IRC_Config.yaml_key[logfile]>