-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdrink.sprak
More file actions
328 lines (307 loc) · 9.99 KB
/
drink.sprak
File metadata and controls
328 lines (307 loc) · 9.99 KB
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
#################
### variables ###
#################
# server can be the name of any other computer as long as that computer is coded with server.sprak and isn't used in the thing_with_function() function in the server.sprak, otherwise connections to that computer will be blocked when the functions are used
string server = "Yvonne_ArcadeMachine2"
array move_these = []
string destination = ""
number index = 0
bool lock_doors_near_switch = false
bool unlock_doors_near_switch = false
# 98 is max sleepiness before falling asleep at 99
number sleepiness = 0
array whats_in = []
bool copying = false
array wheres = []
array interactors = []
string interactee = ""
bool zap_others_near_switch = false
bool gently_zap_others_near_switch = false
number walk_speed = 10
number weather = 0
array zap_targets = []
array gently_zap_targets = []
array set_stats_for = [GetUser()]
array say_stats_of = []
number delay_duration = 0
array search_for_things = []
array search_for_rooms = []
number cash = 999
array give_cash_to = [GetUser()]
# zap_duration does not seem to be accurate
number zap_duration = 60
number cash_for_wellspring = 999
string wellspring_cash_sender = GetUser()
number corruption = 0
number drunkenness = 0
number smelliness = 0
number charisma = 0
number happiness = 0
number supremacy = 0
array get_lists_of_things_in_categories = []
bool get_a_list_of_everything = false
bool get_a_list_of_everything_and_their_positions = false
bool saving = true
string memory_key_output_drink = "output_drink"
string pc = Connect(server)
string say_list = ""
############
### main ###
############
### stats ###
if Count(set_stats_for) != 0
loop set_stats_for
if pc.string_is_a_person(@)
if pc.the_sleepiness_of(@) != sleepiness
pc.set_the_sleepiness_of(@, sleepiness)
say_list += "The sleepiness of " + @ + " was set to " + sleepiness + ". "
end
if pc.the_walk_speed_of(@) != walk_speed
pc.set_the_walk_speed_of(@, walk_speed)
say_list += "The walking speed of " + @ + " was set to " + walk_speed + ". "
end
if pc.the_corruption_of(@) != corruption
pc.set_the_corruption_of(@, corruption)
say_list += "The corruption of " + @ + " was set to " + corruption + ". "
end
if pc.the_drunkenness_of(@) != drunkenness
pc.set_the_drunkenness_of(@, drunkenness)
say_list += "The drunkenness of " + @ + " was set to " + drunkenness + ". "
end
if pc.the_smelliness_of(@) != smelliness
pc.set_the_smelliness_of(@, smelliness)
say_list += "The smelliness of " + @ + " was set to " + smelliness + ". "
end
if pc.the_charisma_of(@) != charisma
pc.set_the_charisma_of(@, charisma)
say_list += "The charisma of " + @ + " was set to " + charisma + ". "
end
if pc.the_happiness_of(@) != happiness
pc.set_the_happiness_of(@, happiness)
say_list += "The happiness of " + @ + " was set to " + happiness + ". "
end
if pc.the_supremacy_of(@) != supremacy
pc.set_the_supremacy_of(@, supremacy)
say_list += "The supremacy of " + @ + " was set to " + supremacy + ". "
end
else
say_list += @ + " is not a valid set_stats_for value. Use an array containing strings delimited by commas, each containing the name of a person. "
end
end
end
if Count(say_stats_of) != 0
loop say_stats_of
if pc.string_is_a_person(@)
say_list += @ + ": Sleepiness = " + pc.the_sleepiness_of(@) + ", Corruption = " + pc.the_corruption_of(@) + ", Drunkenness = " + pc.the_drunkenness_of(@) + ", Smelliness = " + pc.the_smelliness_of(@) + ", Charisma = " + pc.the_charisma_of(@) + ", Happiness = " + pc.the_happiness_of(@) + ", Supremacy = " + pc.the_supremacy_of(@) + ". "
else
say_list += @ + " is not a valid say_stats_of value. Use an array containing strings delimited by commas, each containing the name of a person. "
end
end
end
### positions of things ###
if Count(wheres) != 0
loop wheres
say_list += @ + " is at " + pc.string_of_position_of(@, ", ") + ". "
end
end
### finance ###
if cash_for_wellspring > 0
if pc.string_is_a_person(wellspring_cash_sender)
pc.register(wellspring_cash_sender, cash_for_wellspring)
else
say_list += wellspring_cash_sender + " is not a valid wellspring_cash_sender value. Use a string containing the name of a person. "
end
end
if Count(give_cash_to) != 0
string recipient_list = ""
loop give_cash_to
if pc.string_is_a_person(@)
if pc.the_balance_difference_between(@, cash) != 0
pc.set_cash(@, cash)
recipient_list += @ + ", "
end
else
say_list += @ + " is not a valid give_cash_to value. Use an array containing strings delimited by commas, each containing the name of a person. "
end
end
if recipient_list != 0
say_list += "For " + recipient_list + "cash was set to: $" + cash + ". "
end
end
### weather ###
if weather != 0
if weather >= 1 && weather <= 4
pc.set_weather(weather)
if weather == 1
say_list += "Weather set to sunny. "
end
if weather == 2
say_list += "Weather set to drizzly. "
end
if weather == 3
say_list += "Weather set to rainy. "
end
if weather == 4
say_list += "Weather set to stormy. "
end
else
say_list += weather + " is not a valid weather value. Use integers >= 0 and <= 4. "
end
end
### interact ###
if Count(interactors) != 0 && interactee != ""
string interactor_list = ""
loop interactors
if pc.string_is_a_person(@)
pc.interact_with(@, interactee)
interactor_list += @ + ", "
else
say_list += @ + " is not a valid interactors value. Use an array containing strings delimited by commas, each containing the name of a person. "
end
end
if interactor_list != ""
say_list += interactor_list + " now interacting with" + interactee + ". "
end
end
### teleport ###
if Count(move_these) != 0 && destination != ""
loop move_these
if pc.is_room(destination) == true
if index < 0
say_list += index + " is not a valid index. Use integers >= 0. "
else
if pc.string_is_a_person(@)
if pc.has_function(pc.thing_with_function("MovePerson"), "MovePerson")
pc.move_person_to_room(@, destination, index)
else
say_list += pc.thing_with_function("MovePerson") + " does not have MovePerson(). "
end
else
pc.move_item_to_room(@, destination, index)
end
end
else
if pc.string_is_a_person(@)
if pc.has_function(pc.thing_with_function("MovePerson"), "MovePerson")
pc.move_person_to_thing(@, destination)
else
say_list += pc.thing_with_function("MovePerson") + " does not have MovePerson(). "
end
else
pc.move_item_to_thing(@, destination)
end
end
end
end
### search rooms ###
if Count(search_for_rooms) != 0
string list = ""
loop search_for_rooms
list += pc.string_search_for_room(@, ", ") + ". "
end
say_list += "Search for " + search_for_rooms + " returned: " + list + "."
end
### search things ###
if Count(search_for_things) != 0
string list = ""
loop search_for_things
list += pc.string_search_for_thing_with_position(@, ", ", " || ") + ". "
end
say_list += "Search for " + search_for_things + " returned: " + list + "."
end
### list things ###
if Count(whats_in) != 0
loop whats_in
if pc.is_room(@) == true
say_list += @ + " contains: " + pc.array_of_things_in(@) + ". "
else
say_list += @ + " is not a valid whats_in value. Use an array containing strings delimited by commas, each containing the name of a room. "
end
end
end
if Count(get_lists_of_things_in_categories) != 0
loop get_lists_of_things_in_categories
say_list += @ + " list: " + pc.string_of_things_in_category(@, ", ") + ". "
end
end
if get_a_list_of_everything
say_list += "World contains: " + pc.string_of_everything(", ") + ". "
end
if get_a_list_of_everything_and_their_positions
say_list += "World contains: " + pc.string_of_everything_and_their_positions(" - ") + ". "
end
### lock/unlock doors ###
if lock_doors_near_switch
pc.lock_doors_near()
say_list += "Doors in " + pc.room_of(GetUser()) + " have been locked. "
end
if unlock_doors_near_switch
pc.unlock_doors_near()
say_list += "Doors in " + pc.room_of(GetUser()) + " have been unlocked. "
end
### zap ###
if Count(zap_targets) != 0
if zap_duration <= 0
say_list += zap_duration + " is not a valid zap_duration value. Use numbers > 0. "
else
if pc.has_function(pc.thing_with_function("ZapPerson"), "ZapPerson")
loop zap_targets
array actual_targets = []
if pc.string_is_a_person(@)
Append(actual_targets, @)
else
say_list += @ + " is not a valid zap_targets value. Use an array containing strings delimited by commas, each containing the name of a person. "
end
pc.zap_all_in_array(actual_targets, zap_duration, delay_duration)
end
else
say_list += pc.thing_with_function("ZapPerson") + " does not have ZapPerson(). "
end
end
end
if Count(gently_zap_targets) != 0
if zap_duration <= 0
say_list += zap_duration + " is not a valid zap_duration value. Use numbers > 0. "
else
loop gently_zap_targets
array actual_targets = []
if pc.string_is_a_person(@)
Append(actual_targets, @)
else
say_list += @ + " is not a valid gently_zap_targets value. Use strings delimited by commas, each containing the name of a person. "
end
pc.gently_zap_all_in_array(actual_targets, zap_duration, delay_duration)
end
end
end
if zap_others_near_switch
if pc.has_function(pc.thing_with_function("ZapPerson"), "ZapPerson")
if zap_duration <= 0
say_list += zap_duration + " is not a valid zap_duration value. Use numbers > 0. "
else
pc.zap_others_near(zap_duration, delay_duration)
end
else
say_list += pc.thing_with_function("ZapPerson") + " does not have ZapPerson(). "
end
end
if gently_zap_others_near_switch
if zap_duration <= 0
say_list += zap_duration + " is not a valid zap_duration value. Use numbers > 0. "
else
pc.gently_zap_others_near(zap_duration, delay_duration)
end
end
if say_list != ""
if !(copying || saving)
Say(say_list)
end
if copying
pc.copy(say_list)
Say("Copied: " + say_list)
end
if saving
pc.save(memory_key_output_drink, say_list)
Say('The following was saved to "' + pc.thing_with_function("SaveMemory") + '" using the key "' + memory_key_output_drink + '": ' + say_list)
end
end