Date: 2014/01/31 19:26:00 UTC-08: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
# A Script to create yaml files.
"Yaml Assign":
type: assignment
interact scripts:
- 0 Writing Test
constants:
full path: "G:/Vessel Craft Minecraft Server/Player Files/<player.name>.yml"
path: "scripts/User Scripts/<player.name>/<player.name>_script.yml"
ext path: "Vessel Craft Minecraft Server/Player Files/<player.name>.yml"
id: "<player.name>script"
actions:
on assignment:
- trigger name:click state:true
- trigger name:chat state:true
"Writing Test":
type: interact
requirements:
mode: none
steps:
'default':
click Trigger:
script:
- narrate format:ScriptOptions "NEW SCRIPT, LOAD, KEY (your key), VALUE (your value), WRITE , SAVE, "
- narrate format:ScriptOptions "VALUE TYPE (Toggle<&co> list, single), SPLIT LIST (Toggle<&co> true, false)"
chat Trigger:
"New Yaml":
trigger: "Lets create a /new script/."
script:
- define id "<s@Yaml Assign.constant[constants.id]>"
- ^yaml create "id:<%id%>"
- ^narrate "Script Created. Ready to write to it."
"Load Yaml":
trigger: "Lets create /load/ a premade script."
script:
#Need to define and use the definition like this because of the args in the constant that need to be parsed first.
- define path "<s@Yaml Assign.constant[constants.path]>"
- define id "<s@Yaml Assign.constant[constants.id]>"
- ^yaml "load:<%path%>" "id:<%id%>"
- ^narrate "Script Loaded. Ready to write to it."
"The Key Is":
trigger: "The key is /REGEX:key.+/."
script:
- ^define key "<context.message.after[key ]>"
- ^narrate "KEY<&co> <def[key]>"
- ^flag player SK:<def[key]>
"The Value Is":
trigger: "I want to add /REGEX:value.+/ to the list."
script:
- ^define value "<context.message.after[value ]>"
#- narrate "definition<&co> <def[value]>"
#- narrate "raw value<&co> %value% "
#- narrate "context<&co> <context.message>"
- if <player.flag[SVT]> = single {
- ^flag player "SV:<%value%>"
- ^narrate "VALUE<&co> %value%"
} else {
- ^flag player "SV:->:<%value%>"
- ^narrate "VALUE<&co>-><&co> %value%"
}
"Script Options Split List":
trigger: "Lets change how I write the data to the yaml. <blue>/Split List/."
script:
- if <player.flag[SLT]> != true {
- flag player SLT:true
} else {
- flag player SLT:false
}
- ^chat "I changed the split list type to<&co> <red><player.flag[SLT]>"
"Script Options Value Type":
trigger: "I want to change the <blue>/Value Type/."
script:
- if <player.flag[SVT]> != single {
- flag player SVT:single
} else {
- flag player SVT:list
}
- ^chat "I changed the value type to<&co> <red><player.flag[SVT]>"
"Write to File":
trigger: "/write/ to temp yml and clear my key value settings."
script:
- define id "<s@Yaml Assign.constant[constants.id]>"
# Determine if the intended value is a single or list. Determines how its written to file.
- if <player.flag[SLT]> = true {
- yaml "write:<player.flag[SK]>" "value:<player.flag[SV].as_list>" split_list "id:<%id%>"
- narrate "splitting list up"
} else {
- yaml "write:<player.flag[SK]>" "value:<player.flag[SV]>" "<id:%id%>"
- ^narrate "Wrote<&co> KEY<&co> <player.flag[SK]> VALUE<&co> <player.flag[SV]>"
- ^flag player SV:!
- ^flag player SK:!
"Save to Disk":
trigger: "/save/ to file."
script:
#Need to define and use the definition like this because of the args in the constant that need to be parsed first.
- define path "<s@Yaml Assign.constant[constants.path]>"
- define id "<s@Yaml Assign.constant[constants.id]>"
- yaml "savefile:<%path%>" "id:<%id%>"
- narrate "Wrote file to<&co><&nl> <%path%>"