Date: 2015/08/10 13:52:57 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
argcheck:
type: world
events:
on myarg command:
- narrate "Arg size:<context.args.size>"
- if !<context.args.get[1].contains_any[create|select|save|reset|show|write|dellast|wait|look|narrate|midi|teleport|walk|showblocks]> {
- narrate "<&e>-----------------------------------------
- narrate "<&e>Please type a valid argument. Valid arguments are:"
- narrate "<&e> ------TODO-------"
- narrate "<&e>-----------------------------------------"
- determine fulfilled
}
#Main Else , if argument selection is okay.
else {
- narrate "<&e>Your Argument is:<&4><context.args.get[1]>"
- narrate "<&e>Your argument size is:<context.args.size>"
- inject locally <context.args.get[1]>
}
#It's checking the arg size. If not 2 the queue will get cleared. If 2 the player is getting flagged for using other command later more easy and creating a new script.yml data.
create:
- narrate "<&e>You just typed the create option for making a new .yml file."
- if <context.args.size> != 2 {
- narrate "<&e>You need to type a sub-argument."
- narrate "<&e>i.e. /myarg create NAME"
- queue clear
}
- if <context.args.size> == 2 {
- narrate "<&e> Checking whether a file with this name already exists."
- if <server.has_file[<context.args.get[2]>.yml]> {
- narrate "<&4> Error : Script with this name <context.args.get[2]> already exists on the server."
- narrate "<&4> Stopping the queue."
- queue clear
}
- flag player argmeta:<context.args.get[2]>
- narrate "<&e>You are flagged now with : <player.flag[argmeta]> for easier using following commands."
- narrate "<&e>Trying to create a world-path script with the name: <context.args.get[2]>."
- yaml create id:<context.args.get[2]>
- yaml id:<context.args.get[2]> set <context.args.get[2]>.type:task
- yaml id:<context.args.get[2]> set <context.args.get[2]>.script
- yaml id:<context.args.get[2]> "savefile:/scripts/<context.args.get[2]>.yml"
- if !<server.has_file[<context.args.get[2]>.yml]> {
- narrate "<&4>Unknown error while creating this script!"
}
}