Date: 2015/01/24 14:26:23 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
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
# +----------------------------------
# | S.A.R.A.H
# | Self Actuated Real-Time Automated Helper
# +----------------------------------
Load_Sarah:
type: task
Script:
# Works
- if <server.has_file[Sarah_Data.yml]> {
- yaml "load:/Data/Sarah_Data.yml" id:Sarah_D
- narrate "<dark_green>Loading <gold>S.A.R.A.H<dark_green>'s Data"
} else {
- yaml create id:Sarah_D
- narrate "<red>Couldn't find Data file."
- narrate "<dark_green>Creating new <gold>Sarah_Data.yml <dark_green>file"
- yaml id:Sarah_D set Failed.Message:->:Temp
- yaml id:Sarah_D set Failed.Message:<-:Temp
- yaml id:Sarah_D set Failed.Definition:->:Temp
- yaml id:Sarah_D set Failed.Definition:<-:Temp
- yaml id:Sarah_D set Statistics.Fails:1
- yaml id:Sarah_D set Statistics.Requests.Who_Am_I:0
- yaml id:Sarah_D set Fun.Quotes.wonderdude:->:Don<&sq>t<&sp>be<&sp>a<&sp>Drem,<&sp>be<&sp>an<&sp>optimist!
- yaml id:Sarah_D set Fun.Quotes.Drem_:->:Tests by Dr. Drem
- yaml id:Sarah_D set Fun.Quotes.Unknown:->:Some<&sp>say<&sp>the<&sp>original<&sp>server<&sq>s<&sp>name<&sp><&dq>Erecia<&dq><&sp>was<&sp>related<&sp>to<&sp>a<&sp>certain<&sp>masculine<&sp>feature,<&sp>but<&sp>who<&sp>can<&sp>say<&sp>for<&sp>sure.
- yaml "savefile:/Data/Sarah_Data.yml" id:Sarah_D
}
Save_Sarah:
type: task
Script:
- yaml "savefile:/Data/Sarah_Data.yml" id:Sarah_D
- narrate "<dark_green>Saving <gold>S.A.R.A.H<dark_green>'s Data"
- run Save_Sarah delay:10m
SARAH:
type: world
events:
on player joins:
- narrate Format:Sarah_F "Welcome back <gold><player.name>"
- if <player.is_op> && (<yaml[Sarah_D].read[Failed.Message].size> != 0 || <yaml[Sarah_D].read[Failed.Definition].size> != 0) {
- if <yaml[Sarah_D].read[Failed.Message].size> != 0 && <yaml[Sarah_D].read[Failed.Definition].size> != 0 {
- if <yaml[Sarah_D].read[Failed.Message].size> > 1 && <yaml[Sarah_D].read[Failed.Definition].size> > 1 {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Message].size> <red>Failed Messages <gray>and <gold><yaml[Sarah_D].read[Failed.Definition].size> <blue>Failed Definitions"
} else if <yaml[Sarah_D].read[Failed.Message].size> > 1 && <yaml[Sarah_D].read[Failed.Definition].size> == 1 {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Message].size> <red>Failed Messages <gray>and <gold><yaml[Sarah_D].read[Failed.Definition].size> <blue>Failed Definition"
} else if <yaml[Sarah_D].read[Failed.Message].size> == 1 && <yaml[Sarah_D].read[Failed.Definition].size> > 1 {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Message].size> <red>Failed Message <gray>and <gold><yaml[Sarah_D].read[Failed.Definition].size> <blue>Failed Definitions"
} else {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Message].size> <red>Failed Message <gray>and <gold><yaml[Sarah_D].read[Failed.Definition].size> <blue>Failed Definition"
}
} else if <yaml[Sarah_D].read[Failed.Message].size> != 0 && <yaml[Sarah_D].read[Failed.Definition].size> == 0 {
- if <yaml[Sarah_D].read[Failed.Message].size> > 1 {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Message].size> <red>Failed Messages"
} else {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Message].size> <red>Failed Message"
}
} else if <yaml[Sarah_D].read[Failed.Message].size> == 0 && <yaml[Sarah_D].read[Failed.Definition].size> != 0 {
- if <yaml[Sarah_D].read[Failed.Definition].size> > 1 {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Definition].size> <blue>Failed Definitions"
} else {
- narrate Format:Sarah_F "I logged <gold><yaml[Sarah_D].read[Failed.Definition].size> <blue>Failed Definition"
}
}
}
on player (first) login:
- narrate Format:Sarah_F "Welcome to <gold>Arithia"
on player chats:
- if <context.message.starts_with[Sarah,]> || <context.message.starts_with[Sarah.]> {
- inject locally Message_Type
- determine passively cancelled
- inject locally Control_Center
}
# +----------------------------------
# | Message Type
# +----------------------------------
Message_Type:
# Attempt to add a way to narrate to a specific player. (FAILED)
- if <context.message.starts_with[Sarah,<&sp>@]> || <context.message.starts_with[Sarah.<&sp>@]> {
- define Targets <server.match_player[<context.message.regex[.*(\@)(\w+).*].group[2]>]>
- narrate format:Sarah_F"<red><context.message.regex[.*(\@)(\w+).*].group[2]>" targets:%Targets%
} else if <context.message.starts_with[Sarah,]> {
- define Targets <player>
} else {
- define Targets <server.list_online_players>
- wait 0.01
- inject locally Control_Center
}
# +----------------------------------
# | Control Center
# +----------------------------------
Control_Center:
# | Questions
# Who is Sarah
- if <context.message.contains[who<&sp>are<&sp>you]> || <context.message.contains[what<&sp>are<&sp>you]> inject locally Who_Am_I
# What time is it?
- if <context.message.contains[what<&sp>time<&sp>is<&sp>it]> inject locally Current_Time
# What am I looking at?
- if <context.message.contains[what<&sp>am<&sp>i<&sp>looking<&sp>at]> || <context.message.contains[who<&sp>am<&sp>i<&sp>looking<&sp>at]> inject locally Looking_at
# Where am I looking at?
- if <context.message.contains[where<&sp>am<&sp>i<&sp>looking<&sp>at]> {
- inject locally Looking_at_Location
} else if <context.message.contains[where<&sp>am<&sp>i]> {
- inject locally Location
}
# How far?
- if <context.message.contains[how<&sp>far]> inject locally How_Far
# How do I switch characters?
- if <context.message.contains[switch<&sp>characters]> inject locally Switching_Characters
# Character Commands
- if <context.message.contains[character<&sp>commands]> inject locally Character_Help
# What are the commands?
- if <context.message.contains[commands]> || <context.message.contains[cmds]> inject locally Commands_Help
# Who is ...?
- if <context.message.contains[<&sp>who<&sp>is<&sp>]> inject locally Who_Is
# 1 or 2?
- if <context.message.contains[<&sp>or<&sp>]> inject locally 1_or_2
# | Commands
# Reload SARAH
- if <context.message.contains[load<&sp>data]> inject locally Sarah_Load
# Reload Scripts
- if <context.message.contains[load<&sp>scripts]> inject locally Reload_Scripts
# Save SARAH
- if <context.message.contains[save<&sp>data]> inject locally Sarah_Save
# Delete Failed Messages
- if <context.message.contains[<&sp>clear<&sp>my<&sp>failed]> || <context.message.contains[<&sp>clear<&sp>failed]> || <context.message.contains[<&sp>remove<&sp>failed]> {
- inject locally Sarah_Remove_Failed
# Failed
} else if <context.message.contains[<&sp>failed]> {
- inject locally Sarah_Failed
}
# Kick
- if <context.message.starts_with[Sarah,<&sp>kick<&sp>]> || <context.message.starts_with[Sarah.<&sp>kick<&sp>]>inject locally CMD_Kick
# ban
- if <context.message.starts_with[Sarah,<&sp>ban<&sp>]> || <context.message.starts_with[Sarah.<&sp>ban<&sp>]> inject locally CMD_Ban
# Tell (someone)
- if <context.message.starts_with[Sarah,<&sp>tell<&sp>]> || <context.message.starts_with[Sarah.<&sp>tell<&sp>]> inject locally Tell_Player
# Say
- if <context.message.contains[Sarah,<&sp>say<&sp>]> || <context.message.contains[Sarah.<&sp>say<&sp>]> inject locally CMD_Say
# countdown
- if <context.message.contains[countdown]> inject locally CMD_Countdown
# Day
- if <context.message.contains[make<&sp>it<&sp>day]> || <context.message.contains[make<&sp>it<&sp>bright]> || <context.message.contains[make<&sp>it<&sp>shine]> inject locally CMD_Time_Day
# Night
- if <context.message.contains[make<&sp>it<&sp>night]> || <context.message.contains[make<&sp>it<&sp>dark]> inject locally CMD_Time_Night
# Dawn
- if <context.message.contains[make<&sp>it<&sp>morning]> inject locally CMD_Time_Dawn
# Sun
- if <context.message.contains[make<&sp>it<&sp>sunny]> || <context.message.contains[make<&sp>it<&sp>shine]> inject locally CMD_Weather_Sun
# Storm
- if <context.message.contains[make<&sp>it<&sp>rain]> || <context.message.contains[make<&sp>it<&sp>storm]> inject locally CMD_Weather_Storm
# Website
- if <context.message.contains[website]> inject locally CMD_Website
# | Fun
# Add quote
- if <context.message.contains[add<&sp>quote<&sp>by<&sp>]> inject locally Fun_Add_Quote
# Quote by
- if <context.message.contains[quote<&sp>by<&sp>]> inject locally Fun_Quote_By
# FUN quote
- if <context.message.contains[show<&sp>me<&sp>a<&sp>quote]> || <context.message.contains[give<&sp>me<&sp>a<&sp>quote]> || <context.message.contains[<&sp>random<&sp>quote]> inject locally Fun_Random_quote
# Slap
- if <context.message.contains[<&sp>slap<&sp>]> inject locally Fun_Slap
# Swag / Yolo
- if <context.message.contains[swag]> || <context.message.contains[yolo]> inject locally Fun_bad_word
# | Chatter
# Thank you Sarah
- if <context.message.contains[thank<&sp>you]> inject locally Chatter_Thank_You
# World ending
- if <context.message.contains[world<&sp>end]> || <context.message.contains[end<&sp>of<&sp>the<&sp>world]> inject locally Chatter_World_End
# Penis
- if <context.message.contains[penis]> inject locally Chatter_Penis
# Dirty_Talk
- if <context.message.contains[talk<&sp>dirty]> inject locally Chatter_dirty_Talk
# Meaning of life
- if <context.message.contains[meaning<&sp>of<&sp>life]> inject locally Chatter_Meaning_of_Life
# Deal with it
- if <context.message.contains[deal<&sp>with<&sp>it]> inject locally Chatter_Deal_With_it
# Define What is
- if <context.message.starts_with[Sarah,<&sp>define<&sp>]> || <context.message.starts_with[Sarah.<&sp>define<&sp>]> inject locally Define_What_Is
# What is
- if <context.message.starts_with[Sarah,<&sp>what<&sp>is<&sp>]> || <context.message.starts_with[Sarah.<&sp>what<&sp>is<&sp>]> inject locally What_Is
# If the message, wasn't caught by any of the above. Save the message, so we can add it to Sarah, later.
- define Number <yaml[Sarah_D].read[Statistics.Fails]>
- narrate format:Sarah_F "Sorry I don't know that."
- wait 1
- narrate format:Sarah_F "I'm logging your message for self-improvement"
- narrate format:Sarah_F "<red><player.name> <gray>logged a failed message<&co> <red><context.message>" targets:<server.list_online_ops>
- yaml id:Sarah_D set Failed.Message:->:%Number%<&co><&sp><context.message>
- yaml id:Sarah_D set Statistics.Fails:++
- queue clear