-
Notifications
You must be signed in to change notification settings - Fork 0
/
play.cmd
285 lines (231 loc) · 10.8 KB
/
play.cmd
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
####################################################################################################
# .play
# Selesthiel - [email protected]
#
# Plays an instrument
#
# ****** MUST DEFINE THESE CHAR VARIABLES FIRST: ******
# char.instrument.noun
# char.instrument.tap
# char.inv.container.instrument
#
# USAGE
# .play [--noWait=1] #By default, the script will wait until you are done playing to exit
# .play [--loop=1] #By default, the script will play a song once, then exit
#
# .play
# .play --noWait=1
# .play --loop=1
####################################################################################################
include libmaster.cmd
include args.cmd
var play.songs arpeggios|ditty|folk|ballad|waltz|lullaby|march|jig|lament|wedding|hymn|rumba|polka|battle|reel|elegy|serenade|minuet|psalm|dirge|gavotte|tango|tarantella|bolero|nocturne|requiem|fantasia|rondo|aria|sonata|concerto
var play.songAtStart $char.instrument.song
# By default, we want to try a harder song every time to see if we can play it
var setHarderSong 1
action var setHarderSong 1 when ^You effortlessly begin
action var setEasierSong 1 when ^You (struggle|fumble)
action var setHarderSong 0;var setEasierSong 0 when only the slightest hint of difficulty\.$
var play.restart 0
action var play.restart 1; goto play.repairInstrument when ^The damage to your instrument affects your performance\.$
# action var play.restart 1; goto play.cleanInstrument when ^You notice that moisture has accumulated
action var play.restart 1; goto play.cleanInstrument when dirtiness may affect your performance\.$
action var play.restart 1; goto play.cleanInstrument when ^You really need to drain
#action var play.restart 0; var play.isRaining 1 when ^The steady rain falls down on the surface of your
#action var play.restart 0; var play.isRaining 1 when ^The heavy snow falls down on the surface of your
action var play.restart 0; var play.isRaining 1 when ^The .* falls down on the surface of your
action var play.refillRepairKit 1 when ^There are not enough.*in your repair kit
###############################
### play.top
###############################
play.top:
var play.restart 0
if ("$righthand" != "$char.instrument.tap" && "$righthand" != "Empty") then gosub stow right
gosub stow left
if ($Performance.LearningRate < 32) then {
if ("$righthand" != "$char.instrument.tap") then {
gosub stow right
gosub get my $char.instrument.noun
}
#if ("$char.instrument.song" = "\$char.instrument.song") then {
if (!contains("%play.songs", "$char.instrument.song")) then {
echo char.instrument.song not set (=$char.instrument.song), setting to default
gosub play.setCharacterSong
}
if ($hidden = 1) then gosub unhide
if ($SpellTimer.RefractiveField.active = 1) then gosub release rf
if ($SpellTimer.EyesoftheBlind.active = 1) then gosub release eotb
gosub play $char.instrument.song on my $char.instrument.noun
if (%setEasierSong = 1) then {
gosub play.setEasierSong
gosub stop play
goto play.top
}
if (%setHarderSong = 1) then {
gosub play.setHarderSong
gosub stop play
goto play.top
}
if ("$char.instrument.song" != "%play.songAtStart") then put #echo >Log [play] Changed songs from %play.songAtStart to $char.instrument.song
}
if (%args.noWait != 1) then gosub play.wait
if (%args.loop = 1 && $Performance.LearningRate < 34) then put .play --loop=1
goto play.done
###############################
### play.cleanInstrument
###############################
play.cleanInstrument:
gosub stop play
gosub stow left
if (%play.isRaining = 1) then goto play.done
gosub get my $char.instrument.cloth
if ("$lefthand" = "Empty" && "$righthand" = "Empty") then goto done.noCleaningCloth
gosub wring my cloth
if ("$char.instrument.noun" = "zills") then gosub remove my zills
gosub get my $char.instrument.noun
put dry my $char.instrument.noun with my cloth
gosub wipe my $char.instrument.noun with my cloth
gosub clean my $char.instrument.noun with my cloth
pause
put wring my cloth
if ("$char.instrument.noun" = "zills") then gosub wear my zills
gosub stow my cloth
if (%play.restart = 1) then goto play.top
return
###############################
### play.getSongIndex
###############################
play.getSongIndex:
var getSongIndex.song $0
var getSongIndex.index 0
play.getSongIndex.loop:
if ("%getSongIndex.song" = "%play.songs(%getSongIndex.index)") then return
math getSongIndex.index add 1
if (%getSongIndex.index > count("%play.songs", "|") then {
# Couldn't find the given song in the array, so return a not found value (-1)
var getSongIndex.index -1
return
}
goto play.getSongIndex.loop
###############################
### play.repairInstrument
###############################
play.repairInstrument:
gosub stop play
if ("$lefthandnoun" != "$char.instrument.noun") then gosub stow left
if ("$righthandnoun" != "$char.instrument.noun") then gosub stow right
if ("$righthand" = "Empty" && "$lefthand" = "Empty") then gosub get my $char.instrument.noun
gosub get my repair kit
if ("$lefthand" = "Empty") then goto done.noRepairKit
gosub repair my $char.instrument.noun with my repair kit
if (%play.refillRepairKit = 1) then {
gosub put my $char.instrument.noun in my $char.inv.container.instrument
gosub get my refill
if ("$righthand" = "Empty") then goto play.done.noRepairKitRefill
gosub put my refill in my repair kit
gosub stow my refill
gosub get my $char.instrument.noun
var play.refillRepairKit 0
goto play.repairInstrument
}
gosub stow my repair kit
if (%play.restart = 1) then goto play.top
return
###############################
### play.setEasierSong
###############################
play.setEasierSong:
gosub play.getSongIndex $char.instrument.song
# Couldn't find this char's song, so set a new default song
if (%getSongIndex.index = -1) then {
gosub play.setCharacterSong
return
}
# Can't make it any easier than 0 (arpeggios), so just return
if (%getSongIndex.index = 0) then return
evalmath getSongIndex.index (%getSongIndex.index - 1)
put #tvar char.instrument.song %play.songs(%getSongIndex.index)
echo [play] Moved to easier song: $char.instrument.song
return
###############################
### play.setHarderSong
###############################
play.setHarderSong:
gosub play.getSongIndex $char.instrument.song
# Couldn't find this char's song, so set a new default song
if (%getSongIndex.index = -1) then {
echo play.setHarderSong couldn't find songIndex of char song ($char.instrument.song)
gosub play.setCharacterSong
return
}
# Can't make it any harder than it currently is, so return
if (%getSongIndex.index > count("%play.songs", "|")) then {
echo Trying to set harder song, already at hardest song index %getSongIndex.index: $char.instrument.song
return
}
evalmath getSongIndex.index (%getSongIndex.index + 1)
put #tvar char.instrument.song %play.songs(%getSongIndex.index)
echo [play] Moved to harder song: $char.instrument.song
return
###############################
### play.wait
###############################
play.wait:
pause 2
if ($char.isPerforming != 1) then return
#if ($char.play.useAlmanac = 1) then gosub almanac.onTimer
goto play.wait
###############################
### play.setCharacterSong
###############################
play.setCharacterSong:
if ($Performance.Ranks >= 40) then put #tvar char.instrument.song arpeggios
if ($Performance.Ranks >= 50) then put #tvar char.instrument.song ditty
if ($Performance.Ranks >= 60) then put #tvar char.instrument.song ballad
if ($Performance.Ranks >= 70) then put #tvar char.instrument.song waltz
if ($Performance.Ranks >= 80) then put #tvar char.instrument.song march
if ($Performance.Ranks >= 100) then put #tvar char.instrument.song lament
if ($Performance.Ranks >= 125) then put #tvar char.instrument.song hymn
if ($Performance.Ranks >= 180) then put #tvar char.instrument.song polka
if ($Performance.Ranks >= 220) then put #tvar char.instrument.song reel
if ($Performance.Ranks >= 250) then put #tvar char.instrument.song serenade
if ($Performance.Ranks >= 300) then put #tvar char.instrument.song psalm
if ($Performance.Ranks >= 350) then put #tvar char.instrument.song tango
if ($Performance.Ranks >= 400) then put #tvar char.instrument.song tarantella
if ($Performance.Ranks >= 450) then put #tvar char.instrument.song bolero
if ($Performance.Ranks >= 475) then put #tvar char.instrument.song nocturne
if ($Performance.Ranks >= 525) then put #tvar char.instrument.song requiem
if ($Performance.Ranks >= 550) then put #tvar char.instrument.song concerto
echo Set default song to $char.instrument.song
return
###############################
### play.done.noRepairKitRefill
###############################
play.done.noRepairKitRefill:
echo [play] REPAIR KIT NEEDS REFILL, NO REFILL FOUND
put #echo >Log [play] No refill for repair kit
if ($char.isPerforming != 1 && ("$righthand" = "$char.instrument.tap" || "$lefthand" = "$char.instrument.tap")) then gosub put my $char.instrument.noun in my $char.inv.container.instrument
gosub stow right
gosub stow left
put #parse PLAY DONE
exit
###############################
### play.done
###############################
play.done:
if (%play.isRaining != 1) then {
gosub play.cleanInstrument
gosub play.repairInstrument
}
if ($char.isPerforming != 1 && ("$righthand" = "$char.instrument.tap" || "$lefthand" = "$char.instrument.tap")) then gosub put my $char.instrument.noun in my $char.inv.container.instrument
pause .2
put #parse PLAY DONE
exit
#You begin a quiet rumba on your voodoo priest's rattle with only the slightest hint of difficulty.
#You begin a quiet hymn on your voodoo priest's rattle with only the slightest hint of difficulty.
#You effortlessly begin a quiet ditty on your voodoo priest's rattle, your heart swelling in pride at your hard-earned skill.
#You struggle to begin a quiet concerto on your voodoo priest's rattle.
#You fumble slightly as you begin a spritely polka on your voodoo priest's rattle.
#You begin a quiet lament on your voodoo priest's rattle.
#trigger {^You begin|^You effortlessly begin|^You struggle to begin|^You fumble slightly|^You continue playing on your|^You continue to play|^You lean forward as the complex rhythm wafts from your|^A.*floats through the air as you continue playing} {#tvar char.isPerforming 1} {isPerforming}
#trigger {^You stop playing your song|^You finish playing|^In the name of love} {#tvar char.isPerforming 0} {isPerforming}