Date: 2014/05/21 20:02:34 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
371
372
373
374
375
376
'AIClickEvent':
#
# This is run from the on click action in the assignment script. Naming the
# subscripts after the Pathfind.Status vaules allows us to run exactly what we
# need without any if blocks... which can be long.
#
# - define status <npc.flag[Pathfind.Status]>
# - inject s@AIClickEvent p:<def[status]>
#
type: task
script:
- chat "I<&sq>ll figure out what to put here later..."
Wandering:
- flag npc Pathfind.Status:Talking
- flag npc WorkingSet:!
- flag npc WorkingSet:|:<player>|talk|<def[status]>
- run s@AvailableClickDialogue
Walking:
- flag npc Pathfind.Status:Talking
- flag npc WorkingSet:!
- flag npc WorkingSet:|:<player>|talk|<def[status]>
- run s@AvailableClickDialogue
Following:
- run s@FollowClickDialogue
Leading:
- run s@LeadDialogue p:Click
Thinking:
- chat "I<&sq>m Thinking about where to walk to..." no_target
Lost:
- chat "I seem to be quite lost..." no_target
Fighting:
- chat "I<&sq>m a little busy right now... trying not to die and all..." no_target
- chat "Maybe someday I<&sq>ll learn how to ask for help..." no_target
Talking:
# Some clean up... If a player logs out while talking to an NPC they might get
# stuck. This will clean up when someone clicks on the NPC.
#
- define workingSet <npc.flag[WorkingSet].as_list>
- define player <def[workingSet].get[1]>
- define task <def[workingSet].get[2]>
- define previousStatus <def[workingSet].get[3]>
- if <def[player].is[==].to[<player>]> queue clear
- if <def[player].is[==].to[null]> {
- run s@ToggleChatListener p:off
- chat "Wow... I spaced out there for a minute." no_target
- chat "Thanks for snapping me out of it <player.name>." no_target
- inject s@PathfindResumeActivity
- flag npc WorkingSet:!
}
else if <def[player].is[!=].to[<player>]> {
- look <npc> <player.eye_location> duration:2s
- if <def[player].is_online> {
- random {
- chat "Can<&sq>t you see I<&sq>m talking to <def[player].name>." no_target
- chat "I<&sq>m busy right now <player.name>." no_target
- chat "Oh hi there <player.name>." no_target
}
}
else {
- run s@ToggleChatListener p:off
- chat "Where in the fuzz did <def[player].name> go!?!" no_target
- chat "He was just here a minute ago..." no_target
- chat "Whatev<&sq>s back to what I was doing." no_target
- inject s@PathfindResumeActivity
- flag npc WorkingSet:!
}
}
'AITalkingProximityEvents':
type: task
script:
- chat "I<&sq>ll figure out what to put here later..."
exit_follow:
- run s@ToggleChatListener p:off
- inject s@AIAvailableProximityEvents p:NegativeChat instantly
- inject s@PathfindResumeActivity
- flag npc WorkingSet:!
exit_lead:
- run s@ToggleChatListener p:off
- run s@LeadDialogue p:DeclineLead
- inject s@PathfindResumeActivity
- flag npc WorkingSet:!
exit_leadChooseDestination:
- run s@ToggleChatListener p:off
- run s@LeadDialogue p:DeclineLead
- inject s@PathfindResumeActivity
- flag npc WorkingSet:!
exit_burn:
- chat "Don<&sq>t just leave me <player.name>!" no_target
'AvailableClickDialogue':
type: task
debug: false
script:
- ^define workingSet <npc.flag[WorkingSet].as_list>
- ^define player <def[workingSet].get[1]>
- ^define task <def[workingSet].get[2]>
- ^define previousStatus <def[workingSet].get[3]>
- ^flag npc WorkingSet:!
- ^flag npc WeightedRandomChoice:55/GeneralChat|20/follow|20/lead|5/burn
- ^inject s@WeightedRandomChoice instantly
- ^inject s@AvailableClickDialogue p:<def[result]>
- ^flag npc WeightedRandomChoice:!
GeneralChat:
- ^inject s@AIAvailableProximityEvents p:GeneralChat instantly
- ^flag npc Pathfind.Status:<def[PreviousStatus]>
follow:
- ^inject s@PathfindPauseActivity instantly
- ^walk <player.location> radius:5
- ^flag npc WorkingSet:|:<def[player]>|follow|<def[previousStatus]>
- ^inject s@FollowQuestionDialogue
lead:
- ^inject s@PathfindPauseActivity instantly
- ^walk <player.location> radius:5
- ^flag npc WorkingSet:|:<def[player]>|lead|<def[previousStatus]>
- ^inject s@LeadDialogue p:FirstQuestion
burn:
- ^inject s@PathfindPauseActivity instantly
- ^flag npc WorkingSet:|:<def[player]>|burn|<def[previousStatus]>
- ^inject s@SpontaneousCombustion
- ^inject s@PathfindResumeActivity instantly
- ^flag npc WorkingSet:!
error:
- ^announce "something went horribly wrong"
- ^inject s@PathfindPauseActivity instantly
- ^flag npc WorkingSet:|:<def[player]>|burn|<def[previousStatus]>
- ^inject s@SpontaneousCombustion
- ^inject s@PathfindResumeActivity instantly
- ^flag npc WorkingSet:!
'AITalkingChatEvents':
# This is split into subscipts and called from the on chat action
# - inject s@AITalkingChatEvents p:<def[task]>
#
# This removes a potential giant if block and allows us to only execute the
# script we need since the task is already known in the chat event
#
type: task
debug: false
script:
- chat "I<&sq>ll figure out what to put here later..."
follow:
- if <context.message.is[==].to[yes]> {
- if <def[previousStatus].is[==].to[Wandering]> {
- queue queue:<npc.id>_fidgetQueue stop
- queue queue:<npc.id>_WanderTask_Queue stop
}
- run s@ToggleChatListener p:off
- flag npc Pathfind.Follow.StartingLocation:<npc.location>
- flag npc Pathfind.Follow.StartTime:<server.current_time_millis>
- run s@PathfindFollowTask id:<npc.id>_PathfindFollowTask_Queue delay:10t
- run s@FollowClickDialogue delay:20t
}
else {
- run s@ToggleChatListener p:off
- run s@AIAvailableProximityEvents p:NegativeChat delay:10t
- inject s@PathfindResumeActivity instantly
- flag npc WorkingSet:!
}
lead:
- if <context.message.is[==].to[yes]> {
- flag npc WorkingSet:!
- flag npc WorkingSet:|:<def[player]>|leadChooseDestination|<def[previousStatus]>
- run s@LeadDialogue p:ChooseDestination delay:10t
}
else {
- run s@ToggleChatListener p:off
- run s@LeadDialogue p:DeclineLead delay:10t
- inject s@PathfindResumeActivity instantly
- flag npc WorkingSet:!
}
leadChooseDestination:
- define world '<npc.flag[Bio.HomeWorld] || <npc.world.name>>'
- define town '<npc.flag[Bio.HomeTown] || <npc.location.regions.last>>'
- if <global.flag[Pathfind.%world%.%town%.DestinationList].contains[<context.message>]> {
- if <def[previousStatus].is[==].to[Wandering]> {
- queue queue:<npc.id>_fidgetQueue stop
- queue queue:<npc.id>_WanderTask_Queue stop
}
- run s@ToggleChatListener p:off
- flag npc WorkingSet:!
- flag npc WorkingSet:|:<def[player]>|leading|<def[previousStatus]>
- flag npc Pathfind.Status:Leading
- flag npc Pathfind.DestinationName:<context.message>
- run s@PathfindLead id:<npc.id>_PathfindLead_Queue delay:10t
- run s@LeadDialogue p:Click delay:20t
}
else {
- run s@ToggleChatListener p:off
- run s@LeadDialogue p:UnknownDestination def:<context.message> delay:20t
- inject s@PathfindResumeActivity instantly
- flag npc WorkingSet:!
}
'AIAvailableProximityEvents':
#
# Some chat for proximity enter events
# Will use categories of topics that can be choosen from based on whatevs.
#
type: task
script:
- chat "A script to have NPCs say things to players as they walk by."
enter:
- if <player.flag[AI.Global.ChatCooldown]> queue clear
- if <player.flag[AI.<npc.id>.ProximityEntryCooldown]> queue clear
- flag player AI.Global.ChatCooldown duration:15s
- flag player AI.<npc.id>.ProximityEntryCooldown duration:30s
- if <player.has_permission[group.citizen]> {
- flag npc WeightedRandomChoice:35/CitizenGreetings|35/GeneralChat|30/Tips
}
else {
- flag npc WeightedRandomChoice:35/TouristGreetings|35/GeneralChat|30/Tips
}
- inject s@WeightedRandomChoice instantly
- flag npc WeightedRandomChoice:!
- if !<def[player].exists> define player <player>
- inject s@AIAvailableProximityEvents p:<def[result]>
exit:
- if <player.flag[AI.Global.ChatCooldown]> queue clear
- if <player.flag[AI.<npc.id>.ProximityExitCooldown]> queue clear
- flag player AI.Global.ChatCooldown duration:15s
- flag player AI.<npc.id>.ProximityExitCooldown duration:30s
- if <player.has_permission[group.citizen]> {
- flag npc WeightedRandomChoice:35/CitizenFarewell|35/GeneralChat|30/Tips
}
else {
- flag npc WeightedRandomChoice:35/TouristFarewell|35/GeneralChat|30/Tips
}
- inject s@WeightedRandomChoice instantly
- flag npc WeightedRandomChoice:!
- inject s@AIAvailableProximityEvents p:<def[result]>
GeneralChat:
- look <npc> <player.eye_location> duration:2s
- if !<def[player].exists> define player <player>
- random {
- chat "Hey <def[player].name>, I<&sq>m just <tern[<def[previousStatus].is[==].to[Walking]>]:walking to the <npc.flag[Pathfind.DestinationName]> || wandering around the <npc.flag[Pathfind.DestinationNameLast]>>." no_target
- chat "We<&sq>re off to see the Wizard..." no_target
- chat "It<&sq>s a <tern[<world.has_storm>]:horrid || lovely> <tern[<player.world.time.period.is[==].to[night]>]:night || day> isn<&sq>t it?" no_target
- chat "<tern[<player.has_permission[group.citizen]>]:Good day fellow Citizen! || Ugh, another Tourist...>"
- chat "You<&sq>re supposed to breed your animals, not mate with them..." no_target
- chat "How much wood could a woodchuck chuck... I wonder" no_target
- chat "Oh my god... that was the ugliest baby I<&sq>ve ever seen." no_target
- chat "Why do people keep clicking on me..." no_target
- chat "I shouldn<&sq>t have eaten that fourth burrito..." no_target
- chat "Why do people keep clicking on me..." no_target
- chat "I wasn<&sq>t scared! I was singing! I was singing my scream song. Wooaah! Wooaaooh!" no_target
- chat "I keep finding baby shoes. What the heck, man? And they<&sq>re all lefties!" no_target
- chat "Hey! Crack open that book and read something for fun<&sq>s sake, alright?" no_target
- chat "<def[player].name>, House-hunting is wiiiild! You<&sq>ve got to try it." no_target
- chat "I<&sq>d rather be dancin<&sq> with some babes!" no_target
- chat "My subconscious must be hungry, huh?" no_target
- chat "You guys are so cute, I could just maul you to death." no_target
- chat "I can<&sq>t have you messin<&sq> up my bread and butter, dude." no_target
- chat "I<&sq>ll kill you and raise your children as my own!" no_target
- chat "I<&sq>m not cute, I<&sq>ll mess you up..." no_target
- chat "Bad computer! No! No! Go sit in the corner, and think about your life." no_target
- chat "Girl, you smell good. Did you take a bath in rainbows and cupcakes?" no_target
- chat "If I had a penny for every time someone went crazy, hopped up and magic energy... I<&sq>d be Abraham Lincoln." no_target
- chat "It<&sq>s probably a computal gleetch." no_target
- chat "They<&sq>re trying to peel me! I<&sq>m... not... a... banana!" no_target
- chat "Oh, I<&sq>m coming with you... if only to be disruptive and obnoxious!
" no_target
- chat "I<&sq>m puttin<&sq> an end to all this craziness with my Pick-Axe Hand." no_target
- chat "Bad biscuits make the baker broke, bro." no_target
- chat "Your constant harassment of the female gender makes me siiick" no_target
- chat "I dreamed I was in kindergarten again, but I had really big feet, and was also the teacher." no_target
- chat "Don<&sq>t let the dragon drag on." no_target
- chat "Being crazy is hard. You<&sq>re getting all hung up, all hung up on imaginary problems. You gotta focus on what<&sq>s real, man." no_target
- chat "Dude, don<&sq>t make me feel any more awkward than I already do!" no_target
}
CitizenGreetings:
- if !<def[player].exists> define player <player>
- random {
- chat "Hello there Citizen!" no_target
- chat "Hey what<&sq>s going on there <def[player].name>?" no_target
- chat "Oh hey there <def[player].name>." no_target
- chat "How are you <def[player].name>?" no_target
- chat "Hey <def[player].name>, I forgot to tell you..." no_target
- chat "How<&sq>s work <def[player].name>?" no_target
- chat "Good <tern[<def[player].world.time.period.is[==].to[night]>]:evening || day> <def[player].name>." no_target
}
TouristGreetings:
- if !<def[player].exists> define player <player>
- random {
- chat "Hello there <&6><player.name><&f>!" no_target
- chat "Oh, you are new <&6><player.name><&f>." no_target
- chat "<&6><player.name><&f><&co> Have you read the <&e>/help" no_target
- chat "I haven<&sq>t seen you around before." no_target
- chat "I like to walk places. You can see a list of interesting destinations by typing <&e>/destination list" no_target
- chat "Check out the <&e>/destination<&f> command." no_target
- chat "<&6><player.name><&f><&co> Have you read <&e>/help rules" no_target
- chat "<&6><player.name><&f><&co> You need to find Betty. She<&sq>ll rank you up to <&a>Citizen" no_target
- chat "You can find Betty in the Municipal Building. That<&sq>s the quartz skyscraper in the center of town." no_target
- chat "You won<&sq>t earn much as a Tourist. You need to find Betty to become a Citizen." no_target
}
CitizenFarewell:
- if !<def[player].exists> define player <player>
- random {
- chat "Farewell Citizen!" no_target
- chat "Let<&sq>s do lunch sometime <def[player].name>." no_target
- chat "See you later <def[player].name>!" no_target
- chat "Take care <def[player].name>." no_target
- chat "Stay safe out there <def[player].name>." no_target
- chat "Yeah sure... ignore me..." no_target
- chat "Oh my... something really smells." no_target
- chat "I think <def[player].name> just made a stinky." no_target
}
TouristFarewell:
- if !<def[player].exists> define player <player>
- random {
- chat "Farewell Tourist!" no_target
- chat "I hope to see you again <&6><def[player].name><&f>!" no_target
- chat "Don<&sq>t forget to find Betty in the Municipal building <&6><def[player].name><&f>." no_target
- chat "Make sure you see Betty in the Municipal building before you head out of the city." no_target
- chat "We can show you around if you need some help <&6><def[player].name><&f>." no_target
- chat "Stay safe out there <&6><def[player].name><&f>." no_target
- chat "I<&sq>ll see you around sometime <&6><def[player].name><&f>." no_target
}
Tips:
- if !<def[player].exists> define player <player>
- random {
- chat "I will tell you some valuable secrets!" no_target
- chat "You can type <&e>/jobs stats<&f> to see your levels." no_target
- chat "There is a lot of information in the <&e>/help<&f> files." no_target
- chat "There is a way into the cemetery. You just have to know where to look." no_target
}
NegativeChat:
- ^define workingSet <npc.flag[WorkingSet].as_list>
- ^define player <def[workingSet].get[1]>
- ^define task <def[workingSet].get[2]>
- ^define previousStatus <def[workingSet].get[3]>
- look <npc> <player.eye_location> duration:2s
- wait 10t
- random {
- chat "Oh, ok then..." no_target
- chat "That<&sq>s not very nice of you <def[player].name>." no_target
- chat "I was hoping you would be more helpful." no_target
- chat "Of course... The great and mighty <def[player].name> doesn't have time to help ol<&sq> <npc.name>." no_target
- chat "That<&sq>s fine. I was only asking so you would finally leave me alone." no_target
- chat "Whatev<&sq>s... I only wanted to laugh while watching you fail." no_target
}