Date: 2014/10/19 19:38:21 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
#A set of test chat utilities for having chat click-able links that interact with npcs
Red or Blue_:
type: world
events:
on choice_selector_ command:
- foreach <context.args> {
- announce "Argument <def[loop_index]><&co> <def[value]>"
}
- determine fulfilled
Test Chat Links_:
#
# This is an example of using denizen to construct a chat link that executes a
# command that denizen then reads the arguments for...
# Im thinking useful for...
# spells
# chat inputs
# world teleportations
# command lists
#
# custom built commands?
# smite player selection
# arguments command target
# - foreach <server.list_online_players>
type: task
script:
- execute as_server "tellraw <player.name> {text<&co>'hi there',color<&co>'blue'}"
- execute as_server "tellraw <player.name> {text<&co>'Here your Text',color<&co>'Here your color',extra<&co>[{text<&co>'Here your Second Text',color<&co>'Here your Second Color',hoverEvent<&co>{action<&co>'show_text',value<&co>'Here your Hover Text'},clickEvent<&co>{action<&co>'run_command',value<&co>'/choice_selector_ red_pill swallow_it_quickly'}}]}"
#
#todo: introduce a new tag type, that parses code like it was used with a run command...
#It takes a list of denizen commands, parses them and from the determine gets the result of the tag, a mix of a procedure and a injection command
# syntax: "Hey player, your level<&co> <project:<script.yaml_keys[]>>"
New Tag Called Projection Usage:
type: task
determine_level:
- if <def[player]> <proj:<script.yaml_keys[some_other_script_branch]>||>
-
- determine <noob>
script:
- narrate "Hey man your level<&co> <projection:<script.yaml_keys[determine_level]>>"
##################################################################################################################
# The main needs of a json format script, Each node here provides the options needed for minecrafts
# tellraw, title, signs, books clickable links feature for 1.8.x
##################################################################################################################
json example format:
#This type is optional as denizen tries to load every .yml file into memory
#I think if
type: json
definitions: json_text1|players_choice|players_quest
script:
#Json minecraft datatypes
#value: "text"
#list:
#- item1
#- item2
#- item3
#compound:
# sub-element: "sub-value"
# sub-compound:
# sub-sub-compound: value
#
#Default Minecraft Json Tags
text:
- text
selector:
- selector
insertion:
- text
translate:
- language
color:
- color
bold:
- bool
italic:
- bool
underlined:
- bool
strikethrough:
- bool
obfuscated:
- bool
# according the the minecraft forum post listed above it appears that click event / with / extra mappings,
# they can recieve a [list] of objects...
# im not sure how to have that handled other than give the option to return a list in the format of [<proj:%whatever_you_return%>]
clickEvent:
action:
- [action]
value:
- "[value/url]"
hoverEvent:
action: action
value: [value/json/nbt]
score:
name: p@player.name
objective: [server_objective]
#with and extra are lists... even list of lists
#sub list notation in yaml.... not a familiar thing in denizen....
#The empty list notation is needed for this otherwise yaml thinks that its an error and not a list of lists
#too bad you guys didnt use this way to note a list of lists in denizen instead of using '|'
#This will most likely conflict with the - determine command. Thats why the proposed tag is suggested for purposes <json:json_script>
#I might be able to produce our own <proc:json_script> tag that uses existing procedures to construct a set of json compatible data.
with:
-
- [more json info]
- [2 more json info]
- [3 more json info]
extra:
-
-
-
#########################################################
#Personal Examples
#########################################################
Player Choice Command:
type: world
events:
on current_player_quest_selection command:
- run "Start Quest Branch" def:<context.args.get[first]>
JSON Npc Subchoice Selector:
type: json
definitions: choice
text:
- determine <def[choice]>
color:
- determine gold
clickEvent:
action:
- determine run_command
value:
- determine "current_player_quest_selection <def[choice]>"
JSON Npc Choice Selector:
type: json
definitions: json_text1|Choice_list|players_quest
text:
- determine <def[json_text1]||default_text>
translate:
- determine Pirate
color:
- determine red
hoverEvent:
action:
- determine show_text
value:
- define text "<red>~[bheart]~ <gold>Please select your answer. <red>~[bheart]~"
- determine <proc[iconize].context[<def[text]>]>
extra:
- define choice_list li@
- foreach <def[choice_list].as_list> {
- define extra_json "<json:JSON Npc Subchoice Selector>"
- define choice_list <def[choice_list].extend[<def[extra_json]>]>
}
- determine <def[choice_list]>
Json Task Example:
#
# This is an example of using denizen to construct a chat link that executes a
# command that denizen then reads the arguments for...
# Im thinking useful for...
# spells
# chat inputs
# world teleportations
# command lists
#
# custom built commands?
# smite player selection
# arguments command target
# - foreach <server.list_online_players>
type: task
script:
- define choice_text_1 "Your response to <npc.name>'s offer..."
- define choice_list "li@Take the surrender|Fight to the end|Endure economic sanctions|Spend 20 years in prison"
- execute as_server "title <player.name> <json:JSON Npc Choice Selector.context[]>"
################################################
# Now for examples from:
# http://www.minecraftforum.net/forums/minecraft-discussion/redstone-discussion-and/351959-1-8-raw-json-text-examples-for-tellraw-title-books
#
################################################
mcf raw json book example:
type: json
Give Magic Spells Book:
type: book
title: Your spell book
author: <player.name>
text:
- The spells you know<&co>
- define first_line "Your spells are<&co>"
- give
tstbk:
type: task
script:
- adjust <player.item_in_hand> book:you save:book
- give <entry[book].result>