forked from jrad2017/gs4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlore.lic
372 lines (338 loc) · 13.8 KB
/
lore.lic
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
=begin
Script: Lore
Author: WilliamW1979 ([email protected])
Game: Gemstone
Date: August 21, 2017
Version: 2.3
Description: LoreSing to an object in your right hand, gives results at the end!
Commands: ;lore help (usage and options)
What script does: It has automated loresinging, even a whisper feature to give data to people, logging feature so you can get data later from other characters, and a silent mode so you don't see your own singing.
Update history
2.3
fput was locking up script, fixed problem using dothistimeout instead
2.2
Fixed some minor issues.
2.1
Change the right hand to detect only if you are singing to an object.
2.0
Added a whisper feature so you can whisper the details to someone you are loresinging to and it works with autolore script now!
1.84
Got rid of the settings.lic file to be used and started using UserVars in its place for a better solution!
1.83
Weird bugs for some reason needed fixing. Stopped working at one point, so fixed the errors!
1.82
Upgrading to utilities messed up some variables I had to fix to enable silent mode to work again.
1.81
Fixed some bugs (Changed number commands to reflect which verse singing (0 is all now instead of 1).
1.8
Upgraded script to have universal settings file for easy upgrading for future updates!
1.7
Added the settings class to allow for cross-script compatibility. A special setting file is created for each character individually that can be used for all scripts I create!
1.6
Added a treat!
1.5
updated silent loresinging so others hear that you are speaking bard and not common.
1.4
Added more features to the logging ability and changed made a few detects for trust so no errors should come up
1.3
Added LOG command to enable and disable logging
Removed SEEALL command, now Silence / Silent will take a second variale of on or off.
1.2
Added a logging feature (needs to be trusted to work) This logging feature will allow future scripts to access the data as it stores all singing attempts based on name and id
1.1
Added silent feature using SILENCE and SEEALL commands
1.0
First version made which as a basic loresinging script
=end
temppass = 0
object = nil
Silent = false
Enable_Logs = true
ResultAbility = nil
ResultEnhance = nil
ResultPurpose = nil
ResultValue = nil
def SingLore(var)
loretype = [", please tell me and tell me true,;What might be your own value?", " I am listening and it is all coming clear,;But your purpose is what I would most like to hear.", " it will be helpful for me to know,;What enhance within will you now show?", ", from my ears and eyes you have nothing to hide,;What special ability do you hold inside?"]
while true
dothistimeout "loresing #{$object}" + loretype[var].to_s, 15, /You sing/
while line = get
if line =~ /you learn something/ or line =~ /in your hand/
line = get
if line2 = Script.current.gets?
if line2 =~ /You sense/
respond line + " " + line2
return line + " " + line2
else
respond line
return line
end
else
return line
end
elsif line =~ /you previously learned/
return nil
elsif line =~ /reached the end/
return nil
elsif line =~ /without sufficient power/ or line =~ /You open your mouth, but find yourself unable to sing/
respond
respond
respond "You are out of mana to find out anything else!"
respond
respond
exit
elsif line =~ /glean more/
break
end
end
end
end
class Lore
attr_accessor :type, :objectname, :objectid
def initialize()
silence_me
$Silent = UserVars.Lore_Silent
$Enable_Logs = UserVars.Lore_Logs
$Enable_Logs = true
@objectname = GameObj.right_hand.name
@objectid = GameObj.right_hand.id
$object = GameObj.right_hand.noun
load_data
if $Silent == true
before_dying {DownstreamHook.remove("Lore_LoreSilent")}
end
unless $SAFE == 0
$Enable_Logs = false
end
end
LoreSilent = proc{
action = proc { |server_string|
if $Silent == true or server_string.include?("now speaking")
nil
else
server_string
end
}
if $Silent == true then DownstreamHook.add("Lore_LoreSilent", action) end
fput "speak bard"
case $Temppass
when 0
$ResultValue = SingLore(0)
when 1
$ResultPurpose = SingLore(1)
when 2
$ResultEnhance = SingLore(2)
when 3
$ResultAbility = SingLore(3)
when 4
$ResultAbility = SingLore(3)
$ResultEnhance = SingLore(2)
$ResultPurpose = SingLore(1)
$ResultValue = SingLore(0)
end
fput "speak common"
if $Silent == true then DownstreamHook.remove("Lore_LoreSilent") end
}
def command
if Stats.prof != "Bard"
respond
respond
respond "Displaying previously sung data!"
display_data
exit
elsif Script.current.vars[1].nil?
if $Enable_Logs == true and File.exists?("#{$lich_dir}logs/#{XMLData.game}-Lore/#{@objectname}-#{@objectid}.txt")
respond
respond
respond "Displaying what we know sung in the past!"
display_data
exit
else
$Temppass = 4
LoreSilent.call
end
elsif "all".include?(variable[1].to_s) or variable[1] == '0'
if GameObj.right_hand.name == "Empty" and Script.current.vars[1] then respond; respond; respond "Can't loresing to an empty hand silly!"; respond; respond; exit end
$Temppass = 4
LoreSilent.call
# if $Silent then LoreSilent.call else $ResultAbility = SingLore(3); $ResultEnhance = SingLore(2); $ResultPurpose = SingLore(1); $ResultValue = SingLore(0) end
elsif "value".include?(Script.current.vars[1].to_s) or Script.current.vars[1] == '1'
if GameObj.right_hand.name == "Empty" and Script.current.vars[1] then respond; respond; respond "Can't loresing to an empty hand silly!"; respond; respond; exit end
$Temppass = 0
LoreSilent.call
# if $Silent then LoreSilent.call else $ResultValue = SingLore(0) end
elsif "purpose".include?(Script.current.vars[1].to_s) or Script.current.vars[1] == '2'
if GameObj.right_hand.name == "Empty" and Script.current.vars[1] then respond; respond; respond "Can't loresing to an empty hand silly!"; respond; respond; exit end
$Temppass = 1
LoreSilent.call
# if $Silent then LoreSilent.call else $ResultPurpose = SingLore(1) end
elsif "enhance".include?(Script.current.vars[1].to_s) or Script.current.vars[1] == '3'
if GameObj.right_hand.name == "Empty" and Script.current.vars[1] then respond; respond; respond "Can't loresing to an empty hand silly!"; respond; respond; exit end
$Temppass = 2
LoreSilent.call
# if $Silent then LoreSilent.call else $ResultEnhance = SingLore(2) end
elsif "ability".include?(Script.current.vars[1].to_s) or Script.current.vars[1] == '4'
if GameObj.right_hand.name == "Empty" and Script.current.vars[1] then respond; respond; respond "Can't loresing to an empty hand silly!"; respond; respond; exit end
$Temppass = 3
LoreSilent.call
# if $Silent then LoreSilent.call else $ResultAbility = SingLore(3); end
elsif "whisper".include?(Script.current.vars[1].to_s)
unless Script.current.vars[2].nil?
# unless $ResultValue.nil? then fput "whisper #{Script.current.vars[2]} #{$ResultValue}" end
# unless $ResultPurpose.nil? then fput "whisper #{Script.current.vars[2]} #{$ResultPurpose}" end
# unless $ResultEnhance.nil? then fput "whisper #{Script.current.vars[2]} #{$ResultEnhance}" end
# unless $ResultAbility.nil? then fput "whisper #{Script.current.vars[2]} #{$ResultAbility}" end
data = "#{@objectname}: "
unless $ResultValue.nil? then data = data + $ResultValue + " " end
unless $ResultPurpose.nil? then data = data + $ResultPurpose + " " end
unless $ResultEnhance.nil? then data = data + $ResultEnhance + " " end
unless $ResultAbility.nil? then data = data + $ResultAbility + " " end
fput "whisper #{Script.current.vars[2]} #{data}"
end
exit
elsif "silence".include?(Script.current.vars[1].to_s) or "silent".include?(Script.current.vars[1].to_s)
if Script.current.vars[2].to_s == 'on' or Script.current.vars[2].to_s == 'true'
UserVars.change("Lore_Silent", true)
UserVars.save
respond
respond "Silent Mode is now active!"
respond
elsif Script.current.vars[2].to_s == 'off' or Script.current.vars[2].to_s == 'false'
UserVars.change("Lore_Silent", false)
UserVars.save
respond
respond "Silent Mode is now deactive!"
respond
end
exit
elsif "logs".include?(Script.current.vars[1].to_s)
if Script.current.vars[2].to_s == 'on' or Script.current.vars[2].to_s == 'true'
unless $SAFE == 0
echo "This script must be trusted to be allowed to write to log files."
echo "You can trust it with the following command: #{$lich_char}trust #{script.name}"
exit
end
UserVars.change("Lore_Logs", true)
UserVars.save
respond
respond "Logs are now active!"
respond
elsif Script.current.vars[2].to_s == 'off' or Script.current.vars[2].to_s == 'false'
UserVars.change("Lore_Logs", false)
UserVars.save
respond
respond "Logs are now deactivated!"
respond
end
exit
elsif "virgins".include?(Script.current.vars[1])
respond
respond "You have discovered the hidden command!"
respond
fput "sing A dragon has come to our village today.;We've asked him to leave, but he won't go away.;Now he's talked to our king and they worked out a deal.;No homes will he burn and no crops will he steal."
pause 7
fput "sing Now there is but one catch, we dislike it a bunch.;Twice a year he invites him a virgin to lunch.;Well, we've no other choice, so the deal we'll respect.;But we can't help but wonder and pause to reflect."
pause 7
fput "sing Do virgins taste better than those who are not?;Are they salty, or sweeter, more juicy or what?;Do you savor them slowly? Gulp them down on the spot?;Do virgins taste better than those who are not?"
pause 7
fput "sing Now we'd like to be shed you, and many have tried.;But no one can get through your thick scaly hide.;We hope that some day, some brave knight will come by.;'Cause we can't wait around 'til you're too fat to fly."
pause 7
fput "sing Now you have such good taste in your women for sure,;They always are pretty, they always are pure.;But your notion of dining, it makes us all flinch,;For your favorite entree is barbecued wench."
pause 7
fput "sing Now we've found a solution, it works out so neat,;If you insist on nothing but virgins to eat.;No more will our number ever grow small,;We'll simply make sure there's no virgins at all!"
exit
else
respond
respond "Place the object in your right hand you want to loresing!"
respond
respond " COMMANDS DESCRIPTION"
respond
respond ";lore all or ;lore 0 Loresing EVERYTHING (All verses in order)"
respond ";lore value or ;lore 1 Loresing Value Only (verse 1)"
respond ";lore purpose or ;lore 2 Loresing Purpose Only (verse 2)"
respond ";lore enhance or ;lore 3 Loresing enhance Only (verse 3)"
respond ";lore ability or ;lore 4 Loresing Ability Only (verse 4)"
respond
respond ";lore If logging is enabled and there is a log, will pull log or else it will sing all 4 types!"
respond
respond " OPTIONS"
respond
respond ";lore log [on/off/true/false] Enable/Disable logging (off by default)"
respond ";lore silence [on/off/true/false] Hide/See singing (on by default)"
respond ";lore silent [on/off/true/false] Hide/See singing (on by default)"
respond ";lore whisper [PERSON] Whispers details to person of object already sung to in right hand (Requires logging)."
respond
respond
respond 'Please note, there is a script called "AUTOLORE" that will automatically run this script for mass loresinging'
respond
return
end
if $Enable_Logs == true then log end
display_data
end
def log
basedir = "#{$lich_dir}logs/"
directory = basedir + "#{XMLData.game}-Lore/"
Dir.mkdir(basedir) unless File.exists?(basedir)
Dir.mkdir(directory) unless File.exists?(directory)
if File.exists?("#{$lich_dir}logs/#{XMLData.game}-Lore/#{@objectname}-#{@objectid}.txt")
my_file = File.open("#{$lich_dir}logs/#{XMLData.game}-Lore/#{@objectname}-#{@objectid}.txt", "w+")
else
my_file = File.new("#{$lich_dir}logs/#{XMLData.game}-Lore/#{@objectname}-#{@objectid}.txt", "w")
end
my_file.write("Object Name:#{GameObj.right_hand.name}\n")
my_file.write("Object ID:#{GameObj.right_hand.id}\n")
if $ResultValue
my_file.write("Value:#{$ResultValue}\n")
end
if $ResultPurpose
my_file.write("Purpose:#{$ResultPurpose}\n")
end
if $ResultEnhance
my_file.write("Enhance:#{$ResultEnhance}\n")
end
if $ResultAbility
my_file.write("Ability:#{$ResultAbility}\n")
end
my_file.close
end
def display_data
respond
respond
respond "Object Name: #{@objectname}"
respond "Object ID: #{@objectid}"
respond
unless $ResultValue.nil? then respond "Value: #{$ResultValue}" end
unless $ResultPurpose.nil? then respond "Purpose: #{$ResultPurpose}" end
unless $ResultEnhance.nil? then respond "Enhansive: #{$ResultEnhance}" end
unless $ResultAbility.nil? then respond "Ability: #{$ResultAbility}" end
respond
respond
end
def load_data
if File.exists?("#{$lich_dir}logs/#{XMLData.game}-Lore/#{@objectname}-#{@objectid}.txt")
datafile = File.open("#{$lich_dir}logs/#{XMLData.game}-Lore/#{@objectname}-#{@objectid}.txt", "r")
while (line = datafile.gets)
if line.include?("Value:")
data = line.gsub("Value:", "")
data.delete!("\n")
$ResultValue = data;
elsif line.include?("Purpose:")
data = line.gsub("Purpose:", "")
data.delete!("\n")
$ResultPurpose = data;
elsif line.include?("Enhance:")
data = line.gsub("Enhance:", "")
data.delete!("\n")
$ResultEnhance = data;
elsif line.include?("Ability:")
data = line.gsub("Ability:", "")
$ResultAbility = data;
end
end
datafile.close
end
end
end
sing = Lore.new
sing.command