PDA

View Full Version : ;loot for group hunts (Repost as other thread was messed up)



vamosj
02-14-2012, 02:21 AM
so I've narrowed down the activation line to ;loot shown below. I'm still trying to figure out how I can change it search my other characters kills. I've put his name where I've highlighted and changed the nouns to third person views and nothing....




elsif line =~ /You (?:swing|gesture|sing|weave another verse|continue to sing|channel|fire|wave|tap|rub|hurl|thrust|slash|t hrow|punch|attempt to punch|attempt to kick|attempt to throw|quickly dart behind .*? and try to hamstring|mentally attempt to locate your implanted essence)|Your (?:<.*?>)?raging sandstorm(?:<.*?>)? swirls around|^The flames surrounding <pushBold\\/>an? <a exist=\"(?:\#{immolated.join('|')})\" noun=\".*?\">.*?<\\/a><popBold\\/> flare up violently\\.\\.\\.|A .*? leaps from a <a.*?>.*?<\\/a> <pushBold\\/>.*?<a exist=\"(?:\#{weapon_fired.join('|')})\".*?>.*?<\\/a><popBold\\/> is wielding\\./

vamosj
02-15-2012, 04:37 AM
See people viewing.. But no one is able to help?

Sam
02-15-2012, 05:53 AM
Hey I did my part!

I looked more the other day, but didn't see anything obvious. You should throw some echo 'GOT TO CHECKPOINT #' or whatever the ruby code for line number is.. So you can see if it ever gets to certain parts of the script.

Or just wait for someone to be bored like I was the other day. Don't really have a ton of time to look at this at the moment.

vamosj
02-15-2012, 09:27 AM
Aye, and thanks again for taking that amount of time to try and help me with it. Just hope to get things ironed out..

On a good note though, I was able to adjust the ;forge-perfects so that I can do hammers instead of using my lame SF script. That one is working quite nicely.

vamosj
02-17-2012, 02:58 PM
Still researching and still needing help...

DaCapn
02-17-2012, 07:45 PM
If you made your constraints clear, it would be easier to make a suggestion. To me it's not clear if you intend to use this manually, in the middle of a large script, or in conjunction with bigshot or what. Also it looks like you have a weird habit of erasing your old posts where (maybe?) this useful information was originally located.

I usually avoid doing this because I hate it when people do it to me (when I ask about something specific, it's for good reason) but... What's the problem with the other characters looting their own kills and keeping the (left|right)hand and getsilvers flags off? Just sounds like your reasoning is just to keep a packmule (but again, I'm guessing).

The idea of debugging your 600-character regex isn't going to sound very appealing to anyone.

Personally, I would just define a function somewhere that sets your list of group friends. Then run a script on the looting character that just waits until there's a dead creature, makes sure there's no non-friends in the room, loots, then loops back around.

vamosj
02-17-2012, 11:23 PM
If you made your constraints clear, it would be easier to make a suggestion. To me it's not clear if you intend to use this manually, in the middle of a large script, or in conjunction with bigshot or what. .......

I'm adjusting ;loot

Sorry, thought I made that clear enough..

All I'm trying to do is take that line that activates whenever I kill something, and set it for whenever my other character kills something instead. The below does not work.

i.e..


elsif line =~ /Szent (?:swings|gestures|sings|weaves another verse|continues to sings|channels|fires|waves|taps|rubs|hurls|thrusts |slashes|throws|punches|attempts to punch|attempts to kick|attempts to throw|quickly darts behind .*? and tries to hamstring|mentally attempt to locate your implanted essence)|^The flames surrounding <pushBold\\/>an? <a exist=\"(?:\#{immolated.join('|')})\" noun=\".*?\">.*?<\\/a><popBold\\/> flare up violently\\.\\.\\.|A .*? leaps from a <a.*?>.*?<\\/a> <pushBold\\/>.*?<a exist=\"(?:\#{weapon_fired.join('|')})\".*?>.*?<\\/a><popBold\\/> is wielding\\./

Reason being is I have a slow computer and play on a wireless hotspot, so sometimes it can get real laggy. I end up missing loot sometimes because one character will be going along smoothly while the other is hung up. I hoe this clears things up.

Smythe
02-18-2012, 12:05 AM
Fer now, comment out these lines. Den test it. Prolly create a race condition, an' den hafta put a delay in somewhere fer someone.


if line =~ /^The glimmer of an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> catches your eye|^<pushBold\\/>A <a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/> releases a groan of mingled ecstasy and relief as <pushBold\\/><a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/> fades away, leaving an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> behind!$/
obj_id = $1 || $2
$loot_grab_list.push(obj_id) unless $loot_grab_list.include?(obj_id)
next
elsif line =~ /^(?:The|Glancing shot. The|Bad angle. The|Lacking the force and angle to lodge in .*?, the) <a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> (?:ricochets away from .*?, landing nearby\\.|zips past its target to the ground\\.|flips over, landing behind .*?\\.|fails to stick in .*?\\.|simply falls\\.|is deflected to one side, sailing to the ground\\.)/
arrow_id = $1.dup
$loot_arrow_wait.push(arrow_id) unless $loot_arrow_wait.include?(arrow_id)
Thread.new {
sleep 16
arrow_id = $loot_arrow_wait.shift
$loot_grab_list.push(arrow_id) unless $loot_grab_list.include?(arrow_id) or !GameObj.loot.any? { |obj| obj.id == arrow_id }
}
next
end
if line =~ /Wisps of black smoke swirl around <pushBold\\/>.*?<a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a><popBold\\/> and s?he bursts into flame!/
immolated.push($1) unless immolated.include?($1)
end
if line =~ /You successfully hit <pushBold\\/>.*?<a exist=\"(.*?)\".*?>.*?<\\/a><popBold\\/> <a.*?>.*?<\\/a> with the spell\\./
weapon_fired.push($1) unless weapon_fired.include?($1)
end


- Smythe

vamosj
02-19-2012, 04:29 PM
Well testing and trying to steal lines from other scripts such as ;haste I still can't get this baby to work...

I just can't get it to trigger when Szent kills something, or even swings for that matter...




=begin

This script waits for you to kill something, and then it skins (optional),
searches, and picks up loot.

;loot help

tillmen@lichproject.org

# Author: Tillmen
# Category: loot

=end

if defined?(GameObj.type_data)
GameObj.load_data if GameObj.type_data.empty? or GameObj.type_data.nil?
if GameObj.type_data.nil?
wait_while { running?('updater') }
wait_while { running?('repository') }
start_script 'repository', [ 'download', 'gameobj-data.xml' ]
wait_while { running?('repository') }
wait_while { running?('updater') }
start_script 'updater', [ 'add', 'gameobj-data.xml' ]
wait_while { running?('updater') }
GameObj.load_data
exit if GameObj.type_data.nil?
end
end

# fixme: open/close lootsack

Settings['unskinnable'] = Array.new if Settings['unskinnable'].nil?
Settings['blunt-skinnable'] = Array.new if Settings['blunt-skinnable'].nil?
CharSettings['skin'] = true if CharSettings['skin'].nil?
CharSettings['604'] = false if CharSettings['604'].nil?
CharSettings['safe-kneel'] = false if CharSettings['safe-kneel'].nil?
CharSettings['kneel'] = false if CharSettings['kneel'].nil?
CharSettings['stance'] = false if CharSettings['stance'].nil?
CharSettings['empty'] = false if CharSettings['empty'].nil?
CharSettings['phase-boxes'] = false if CharSettings['phase-boxes'].nil?
CharSettings['get-arrows'] = false if CharSettings['get-arrows'].nil?
CharSettings['eblade-arrows'] = false if CharSettings['eblade-arrows'].nil?

CharSettings['loot-types'] = 'gem|reagent|herb|jewelry|magic|scroll|wand|uncomm on|box' if CharSettings['loot-types'].nil?

$new_loot ||= Array.new

if script.vars.empty?
nil
elsif script.vars[0].downcase == 'list'
fix_setting = { true => 'on', false => 'off' }
respond "skin: #{fix_setting[CharSettings['skin']]}"
respond "604: #{fix_setting[CharSettings['604']]}"
respond "kneel: #{fix_setting[CharSettings['kneel']]}"
respond "safe-kneel: #{fix_setting[CharSettings['safe-kneel']]}"
respond "stance: #{fix_setting[CharSettings['stance']]}"
respond "empty: #{fix_setting[CharSettings['empty']]}"
respond "phase-boxes: #{fix_setting[CharSettings['phase-boxes']]}"
respond "get-arrows: #{fix_setting[CharSettings['get-arrows']]}"
respond "eblade-arrows: #{fix_setting[CharSettings['eblade-arrows']]}"
respond "exclude: #{CharSettings['exclude']}"
respond "loot-types: #{CharSettings['loot-types']}"
# respond "unskinnable: #{Settings['unskinnable'].join(', ')}"
exit
elsif script.vars[0] =~ /^(skin|604|kneel|safe\-kneel|stance|empty|phase\-boxes|get\-arrows|eblade\-arrows)=(on|off|yes|no|true|false)$/i
fix_setting = { 'on' => true, 'yes' => true, 'true' => true, 'off' => false, 'no' => false, 'false' => false }
CharSettings[$1.downcase] = fix_setting[$2.downcase]
echo 'setting saved'
exit
elsif script.vars[0] =~ /^exclude=(.*)$/i
if $1 == 'nil'
CharSettings['exclude'] = nil
echo 'setting cleared'
else
CharSettings['exclude'] = $1
echo 'setting saved'
end
exit
elsif script.vars[0] =~ /^loot\-?types=(.*)$/i
if $1 == 'nil'
CharSettings['loot-types'] = 'gem|reagent|herb|jewelry|magic|scroll|wand|uncomm on|box'
echo 'setting reset'
else
CharSettings['loot-types'] = $1
echo 'setting saved'
end
exit
else
respond
respond "#{$lich_char}#{script.name} waits for you to kill someting and loots it"
respond "#{$lich_char}#{script.name} skin=<on/off> skins before looting"
respond "#{$lich_char}#{script.name} 604=<on/off> cast 604 before skinning"
respond "#{$lich_char}#{script.name} kneel=<on/off> always kneels to skin"
respond "#{$lich_char}#{script.name} safe-kneel=<on/off> kneels to skin if no live npcs are in the room"
respond "#{$lich_char}#{script.name} stance=<on/off> changes to offensive stance to skin"
respond "#{$lich_char}#{script.name} empty=<on/off> empty left hand when skinning"
respond "#{$lich_char}#{script.name} phase-boxes=<on/off> make boxes lighter"
respond "#{$lich_char}#{script.name} get-arrows=<on/off> pick up the arrows you fire and put them in your"
respond "#{''.rjust($lich_char.length)}#{''.rjust(script.na me.length)} arrowsack (or lootsack if arrowsack isn't set)"
respond "#{$lich_char}#{script.name} eblade-arrows=<on/off> eblade arrows when they fail to bundle"
respond "#{$lich_char}#{script.name} exclude=<regex> regex of items not to pick up"
respond "#{$lich_char}#{script.name} exclude=nil clear exclude setting"
respond "#{$lich_char}#{script.name} loot-types=<regex> regex of the types of items to pick up"
respond "#{$lich_char}#{script.name} loot-types=nil reset loot types to the default"
respond
exit
end

if UserVars.lootsack.nil? or UserVars.lootsack.empty?
echo 'error: lootsack is not set. (;set change lootsack <container name>)'
exit
end
unless lootsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack).sub(' ', ' .*')}/i }
echo 'error: failed to find your lootsack'
exit
end
if CharSettings['skin']
if (UserVars.skinweaponsack.nil? or UserVars.skinweaponsack.empty?)
echo 'error: skinning is enabled, but skinweaponsack is not set. (;set change skinweaponsack <container name>)'
exit
end
unless skinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}/i }
dothistimeout "pull my #{UserVars.skinweaponsack}", 3, /^You pull|^You reach|^I'm afraid|^What were you referring to/
dothistimeout "inventory", 3, /^You are wearing/
if skinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}/i }
dothistimeout "push ##{skinweaponsack.id}", 3, /^You push|^You reach/
else
echo 'error: failed to find your skinweaponsack'
exit
end
end
if skinweaponsack.contents.nil?
dothistimeout "look in ##{skinweaponsack.id}", 3, /^In the/
end
if(UserVars.skinweapon.nil? or UserVars.skinweapon.empty?)
echo 'error: skinning is enabled, but skinweapon is not set. (;set change skinweapon <weapon name>)'
exit
end
unless skinweapon = ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon.strip)}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon).sub(' ', ' .*')}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon).sub(' ', ' .*')}/i }
echo 'error: failed to find your skinweapon'
exit
end
if UserVars.bluntskinweaponsack and UserVars.bluntskinweapon
if bluntskinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack.str ip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack).su b(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack).su b(' ', ' .*')}/i }
if bluntskinweaponsack.contents.nil?
dothistimeout "look in ##{bluntskinweaponsack.id}", 3, /^In the/
end
bluntskinweapon = ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon.strip)} $/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon).sub(' ', ' .*')}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon).sub(' ', ' .*')}/i }
end
else
bluntskinweaponsack = nil
bluntskinweapon = nil
end
end
if CharSettings['get-arrows']
if UserVars.arrowsack.nil? or UserVars.arrowsack.empty?
arrowsack = lootsack
else
unless arrowsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack).sub(' ', ' .*')}/i }
echo 'error: failed to find your arrowsack'
exit
end
end
end

status_tags
silence_me

$loot_dead_npcs = Array.new
$loot_grab_list = Array.new
$loot_working = false
$loot_berserking = false

$loot_stats ||= Hash.new
$loot_stats['start_time'] ||= Time.now
$loot_stats['kills'] ||= 0
$loot_stats['successful_skins'] ||= 0
$loot_stats['failed_skins'] ||= 0
$loot_stats['loot_count'] ||= 0
$loot_arrow_ids ||= LimitedArray.new
$loot_arrow_wait = Array.new
$loot_needs_eblade ||= Array.new
$loot_search_rooms ||= Array.new

can_drag = true

people = 'Szent'


exec_string = "
hide_me
status_tags
before_dying { kill_script(#{script.name.inspect}) if running?(#{script.name.inspect}) }
Thread.new { wait_while { running?(#{Script.self.name.inspect}) }; Script.self.kill }
immolated = LimitedArray.new
immolated.max_size = 15
weapon_fired = LimitedArray.new
weapon_fired.max_size = 15
while line = get
if line =~ /<stream id=\"thoughts\">/
next
elsif line =~ /^(?:<.*?>)?You nock an? .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">/
$loot_arrow_ids.push($1) unless $loot_arrow_ids.include?($1)
elsif line =~ /^(?:<.*?>)?The scintillating light fades from an .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrows\">.*?<\\/a>\\./
$loot_needs_eblade.push($1)
elsif line =~ /^(?:<.*?>)?The scintillating .*?light surrounding the .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> fades away\\./
$loot_needs_eblade.push($1)
elsif line =~ /<comp(?:onent|Def) id='room objs'>.*?<a exist=\"(?:\#{$loot_arrow_ids.join('|')})\".*?<\\/comp(?:onent|Def)>/
$loot_grab_list = ($loot_grab_list | GameObj.loot.to_a.find_all { |obj| $loot_arrow_ids.include?(obj.id) }.collect { |obj| obj.id }) - $loot_arrow_wait
echo 'check temp 4'
elsif line =~ /^(?:The|Glancing shot. The|Bad angle. The|Lacking the force and angle to lodge in .*?, the) <a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> (?:ricochets away from .*?, landing nearby\\.|zips past its target to the ground\\.|flips over, landing behind .*?\\.|fails to stick in .*?\\.|simply falls\\.|is deflected to one side, sailing to the ground\\.|disappears into the local environs\\.|zips past its target to the ground\\.)/
arrow_id = $1.dup
$loot_arrow_wait.push(arrow_id) unless $loot_arrow_wait.include?(arrow_id)
echo 'check temp 5'
Thread.new {
sleep 16
arrow_id = $loot_arrow_wait.shift
$loot_grab_list.push(arrow_id) unless $loot_grab_list.include?(arrow_id) or !GameObj.loot.any? { |obj| obj.id == arrow_id }
}
if (line =~ /disappears into the local environs/) and (room = Room.current)
$loot_search_rooms.push(room.id)
end
elsif line =~ /^#{people} (?:swings|gestures|sings|weaves another verse|continues to sing|channels|fires|wave|tap|rub|hurl|thrust|slash |throw|punch|attempt to punch|attempt to kick|attempt to throw|quickly dart behind .*? and try to hamstring|mentally attempt to locate your implanted essence)|Your (?:<.*?>)?raging sandstorm(?:<.*?>)? swirls around|^The flames surrounding <pushBold\\/>an? <a exist=\"(?:\#{immolated.join('|')})\" noun=\".*?\">.*?<\\/a><popBold\\/> flare up violently\\.\\.\\.|A .*? leaps from a <a.*?>.*?<\\/a> <pushBold\\/>.*?<a exist=\"(?:\#{weapon_fired.join('|')})\".*?>.*?<\\/a><popBold\\/> is wielding\\./
candidates = Array.new
while (line = get) and (line !~ /Roundtime|A little bit late for that don't you think|<prompt/)
if line =~ /^The glimmer of an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> catches your eye|^<pushBold\\/>A <a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/> releases a groan of mingled ecstasy and relief as <pushBold\\/><a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/> fades away, leaving an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> behind!$/
obj_id = $1 || $2
$loot_grab_list.push(obj_id) unless $loot_grab_list.include?(obj_id)
next
elsif line =~ /^(?:The|Glancing shot. The|Bad angle. The|Lacking the force and angle to lodge in .*?, the) <a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> (?:ricochets away from .*?, landing nearby\\.|zips past its target to the ground\\.|flips over, landing behind .*?\\.|fails to stick in .*?\\.|simply falls\\.|is deflected to one side, sailing to the ground\\.)/
arrow_id = $1.dup
$loot_arrow_wait.push(arrow_id) unless $loot_arrow_wait.include?(arrow_id)
Thread.new {
sleep 16
arrow_id = $loot_arrow_wait.shift
$loot_grab_list.push(arrow_id) unless $loot_grab_list.include?(arrow_id) or !GameObj.loot.any? { |obj| obj.id == arrow_id }
}
next
end
if line =~ /Wisps of black smoke swirl around <pushBold\\/>.*?<a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a><popBold\\/> and s?he bursts into flame!/
immolated.push($1) unless immolated.include?($1)
end
if line =~ /Szent successfully hit <pushBold\\/>.*?<a exist=\"(.*?)\".*?>.*?<\\/a><popBold\\/> <a.*?>.*?<\\/a> with the spell\\./
weapon_fired.push($1) unless weapon_fired.include?($1)
end
if line =~ /<a exist=['\"](.*?)['\"]/
candidates.push($1) unless candidates.include?($1)
end
end
for obj_id in candidates
if (npc = GameObj.npcs.find { |npc| npc.id == obj_id }) and (npc.status == 'dead')
unless $loot_dead_npcs.include?(obj_id)
$loot_dead_npcs.push(obj_id) unless (npc.name =~ /ice golem|fire elemental|skayl|lava golem|mein golem|mein android/)
$loot_stats['kills'] += 1
end
end
end
elsif line =~ /^You spy .*?<a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a>, which looks like the heirloom that you are searching for!$/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
elsif line =~ /^You cannot do that while berserking\.$|^Everything around you turns red as you work yourself into a berserker's rage!|^You rage across the battlefield, striking with unrelenting fury!/
$loot_berserking = true
elsif line =~ /^The redness fades from the world and you begin to breathe harder\.$/
$loot_berserking = false
end
end
"
start_exec_script(exec_string, flags={ :quiet => true })

loop {
if ($loot_dead_npcs.empty? and $loot_grab_list.empty?) or $loot_berserking
$loot_working = false
script.want_downstream = false
clear
wait_while { $loot_dead_npcs.empty? and $loot_grab_list.empty? and not $loot_berserking }
end
$loot_working = true
need_fill_hand = false
need_fill_left_hand = false
need_fill_right_hand = false
waitrt?
script.want_downstream = true
right_hand_save = GameObj.right_hand
unless $loot_dead_npcs.empty?
dead_npcs = Array.new
while target = $loot_dead_npcs.shift
if GameObj.npcs.find { |npc| npc.id == target }.status == 'dead'
dead_npcs.push(target)
end
end
if CharSettings['skin'] and dead_npcs.any? { |test_npc| !Settings['unskinnable'].include?(GameObj.npcs.find { |npc| npc.id == test_npc }.name) }
unless (GameObj.right_hand.id == skinweapon.id) or (GameObj.left_hand.id == skinweapon.id)
empty_hand
need_fill_hand = true
dothistimeout("get ##{skinweapon.id}", 4, /^You remove|^You already have that|^You slip a hand/)
end
if CharSettings['604'] and (skinning = Spell[604]) and skinning.known? and skinning.affordable? and not skinning.active?
skinning.cast
end
if CharSettings['kneel'] or (CharSettings['safe kneel'] and not GameObj.npcs.any? { |npc| npc.status !~ /dead/ })
dothistimeout 'kneel', 2, /You kneel/
end
if CharSettings['stance'] and stance != 'offensive'
save_stance = stance
dothistimeout 'stance offensive', 2, /You are now in an offensive stance/
else
save_stance = nil
end
if CharSettings['empty'] and GameObj.right_hand.id and (GameObj.right_hand.id != skinweapon.id)
need_fill_right_hand = true
empty_right_hand
end
if CharSettings['empty'] and GameObj.left_hand.id and (GameObj.left_hand.id != skinweapon.id)
need_fill_left_hand = true
empty_left_hand
end
for target in dead_npcs
if (name = GameObj.npcs.find { |npc| npc.id == target }.name) and not Settings['unskinnable'].include?(name)
if GameObj.left_hand.id == skinweapon.id
skin_result = dothistimeout "skin ##{target} left", 2, /^You (?:skinned|botched)|^You might want to wait until after it is dead|^You can only skin creatures|has already been skinned|^You cannot skin|^Could not find your target creature|unable to cut|^You are unable to break through/
else
skin_result = dothistimeout "skin ##{target}", 2, /You (?:skinned|botched)|You might want to wait until after it is dead|You can only skin creatures|has already been skinned|You cannot skin|Could not find your target creature|unable to cut/
end
if skin_result =~ /You cannot skin/
Settings['unskinnable'].push(name)
elsif skin_result =~ /unable to cut|^You are unable to break through/
Settings['unskinnable'].push(name)
#Settings['blunt-skinnable'].push(name)
elsif skin_result =~ /yielding an? <a exist="(.*?)"/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
$loot_stats['successful_skins'] += 1
else
$loot_stats['failed_skins'] += 1
end
end
end
if need_fill_left_hand
fill_left_hand
end
if need_fill_right_hand
fill_right_hand
end
unless standing?
fput 'stand'
waitrt?
end
if save_stance
fput "stance #{save_stance}"
end
if need_fill_hand
dothistimeout "put ##{skinweapon.id} in ##{skinweaponsack.id}", 2, /You put|^You slip your hand/
end
end
for target in dead_npcs
search_result = dothistimeout "search ##{target}", 4, /You search|What were you referring to|Could not find a valid target to loot|You plunge your hand into/
if search_result =~ /You plunge your hand into .*? withdraw your arm to find a .*? (\w+) in your grasp!/
echo 'fixme'
fput 'stow right'
elsif search_result =~ /You search/
while (line = get) and (line !~ /prompt/)
if line =~ /exist="(.*?)".*which looks like the heirloom that you are searching for/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
else
for link in line.scan(/<a.*?>.*?<\/a>/)
if link =~ /<a exist="(.*?)" noun="(.*?)">(.*?)<\/a>/
exist, noun, name = $1, $2, $3
next if name =~ /^(?:he|she|it|her|his|him|its|itself)$|'s$/i
unless thing = GameObj.loot.find { |obj| obj.id == exist }
thing = GameObj.new(exist, noun, name)
end
if thing.type.nil?
Script.log "#{Time.now.strftime("%Y-%m-%d %I:%M%P")}: missing type for: #{thing.name}"
elsif (thing.type =~ /junk/) or (CharSettings['exclude'] and thing.name =~ /#{CharSettings['exclude']}/)
nil
elsif thing.type =~ /#{CharSettings['loot-types']}/
$loot_grab_list.push(thing.id) unless $loot_grab_list.include?(thing.id)
unless thing.sellable or (thing.type =~ /herb/)
Script.log "#{Time.now.strftime("%Y-%m-%d %I:%M%P")}: missing sellable for: #{thing.name}"
end
end
end
end
end
end
end
end
end
if $loot_grab_list.empty?
if need_fill_hand
fill_hand
end
else
need_close_disk = false
need_close_lootsack = false
unless need_fill_hand
empty_hand
end
while obj_id = $loot_grab_list.shift
unless obj = GameObj.loot.find { |o| o.id == obj_id }
next if CharSettings['get-arrows'] and $loot_arrow_ids.include?(obj_id)
dothistimeout "get ##{obj_id}", 2, /^You pick up/
if GameObj.right_hand.id == obj_id
obj = GameObj.right_hand
elsif GameObj.left_hand.id == obj_id
obj = GameObj.left_hand
else
echo 'fixme'
next
end
end
if (obj.type =~ /box/) and ((disk = GameObj.loot.find { |o| o.name =~ /#{Char.name} disk$/ }) or reget.any? { |line| line =~ /^Your disk arrives, following you dutifully\.\r?$/ })
25.times { break if GameObj.loot.any? { |o| o.name =~ /#{Char.name} disk$/ }; sleep 0.1 }
if disk
result = dothistimeout "_drag ##{obj.id} ##{disk.id}", 2, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$/
if result =~ /It's closed!/
dothistimeout "open ##{disk.id}", 3, /^You open|^That is already open\./
need_close_disk = true
result = dothistimeout "_drag ##{obj.id} ##{disk.id}", 2, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$/
end
if result =~ /You put/
$new_loot.push(obj.id)
next
end
end
end
if CharSettings['get-arrows'] and not $loot_search_rooms.empty? and not GameObj.npcs.any? { |npc| (npc.type !~ /passive npc/) and (npc.status !~ /dead/) } and (room = Room.current) and $loot_search_rooms.include?(room.id)
$loot_search_rooms.count(room.id).times {
dothistimeout 'search', 2, /^You don't find|^You spy/
waitrt?
}
$loot_search_rooms.delete(room.id)
end
while CharSettings['eblade-arrows'] and (eblade = Spell[411]) and eblade.known? and eblade.affordable? and (arrow_id = $loot_needs_eblade.shift)
if arrow = (GameObj.loot.to_a + arrowsack.contents.to_a).find { |obj| obj.id == arrow_id }
waitcastrt?
result = eblade.cast(arrow)
if (result == false) or (result =~ /^\[Spell Hindrance/)
arrow_id = $loot_needs_eblade.unshift(arrow_id)
end
end
end
if CharSettings['get-arrows'] and $loot_arrow_ids.include?(obj.id)
if bundle = arrowsack.contents.find { |o| o.noun == 'arrows' }
if GameObj.loot.find_all { |o| o.noun == 'arrow' }.length > 2
dothistimeout "gather ##{obj.id}", 4, /^You gather|^You pick up|^You need a free hand to pick that up\.|^I could not find what you were referring to\.|^Get what\?|^The .*? is out of your reach\./
result = dothistimeout "put my arrow in ##{bundle.id}", 4, /^You add|^You bundle|^I could not find what you were referring to\.|^You cannot bundle these together\./
else
result = dothistimeout "_drag ##{obj.id} ##{bundle.id}", 4, /You add|You need a free hand to pick that up\.|^I could not find what you were referring to\.|^Get what\?|^The .*? is out of your reach\.|^You cannot bundle these together\./
end
if result =~ /^You cannot bundle these together\./
result = dothistimeout "put my arrow in ##{arrowsack.id}", 4, /^You put/
end
else
result = dothistimeout "_drag ##{obj.id} ##{arrowsack.id}", 4, /^You put/
end
else
if can_drag
$loot_stats['loot_count'] += 1
result = dothistimeout "_drag ##{obj.id} ##{lootsack.id}", 4, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\.|^Do you want to put that in or on/
if result =~ /^Do you want to put that in or on/
can_drag = false
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /^You put|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\./
end
else
dothistimeout "get ##{obj.id}", 4, /^You pick up|^You remove|^You need a free hand to pick that up\.|^I could not find what you were referring to\./
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /^You put|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\./
end
if result =~ /It's closed!/
dothistimeout "open ##{lootsack.id}", 3, /^You open|^That is already open\./
need_close_lootsack = true
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\./
end
if result =~ /won't fit/
fput "drop ##{obj.id}"
else
$new_loot.push(obj.id)
if CharSettings['phase-boxes'] and (obj.type =~ /box/) and Spell[704].known? and Spell[704].affordable?
loop {
result = cast 704, obj
break unless (result =~ /^\[Spell Hindrance for/) and Spell[704].affordable?
}
end
end
end
end
fill_hand
if need_close_lootsack
dothistimeout "close ##{lootsack.id}", 3, /^You close|^That is already closed;\./
end
if need_close_disk
dothistimeout "close ##{disk.id}", 3, /^You close|^That is already closed;\./
end
end
}

# You are unable to break through the krag dweller's stone hide with a dagger!

=begin
arrow gets hidden, option to search when nothing is alive
can't pick up arrow for x seconds, option to wait when nothing is alive
start second bundle when charges run out
keep track of charged/dead bundle
option to eblade/bless dead arrows

The <a exist="14692818" noun="arrow">wooden arrow</a> disappears into the local environs.

The scintillating red light surrounding the arrow fades away.
The scintillating light fades from a <a exist="14575103" noun="arrows">bundle of wooden arrows</a>.
You cannot bundle these together.

only gather after kill
only gather with no live npcs
search for arrows
wait for arrows
e-blade arrows
bless arrows
=end

Smythe
02-20-2012, 01:15 PM
Narrow down more.

Try dis fer da line.



elsif line =~ /^#{people} (?:swing|gesture|sing|weave|continue|channel|fire| wave|tap|rub|hurl|thrust|slash|throw|punch)/


Build from der.

- Smythe

vamosj
02-21-2012, 11:35 AM
Tried that and it's still not picking up on his swinging. I put in some echo's to see where the script is running and where it isn't.

I see the echo right after this line that starts the sub-routine (while line = get) and I see the echo right after the end of that sub-routine but the esleif line that watches for the attack (elsif line =~ /^#{people} (?:swing|gesture|sing|weave|continue|channel|fire| wave|tap|rub|hurl|thrust|slash|throw|punch)/) just isn't getting triggered for some reason when he attacks. I don't know if I am missing something that sets up that line so it can trigger or if there is some command in that line I need to change to make it trigger.

vamosj
02-21-2012, 01:08 PM
=begin

This script waits for you to kill something, and then it skins (optional),
searches, and picks up loot.

;loot help

tillmen@lichproject.org

# Author: Tillmen
# Category: loot

=end

if defined?(GameObj.type_data)
GameObj.load_data if GameObj.type_data.empty? or GameObj.type_data.nil?
if GameObj.type_data.nil?
wait_while { running?('updater') }
wait_while { running?('repository') }
start_script 'repository', [ 'download', 'gameobj-data.xml' ]
wait_while { running?('repository') }
wait_while { running?('updater') }
start_script 'updater', [ 'add', 'gameobj-data.xml' ]
wait_while { running?('updater') }
GameObj.load_data
exit if GameObj.type_data.nil?
end
end

# fixme: open/close lootsack

Settings['unskinnable'] = Array.new if Settings['unskinnable'].nil?
Settings['blunt-skinnable'] = Array.new if Settings['blunt-skinnable'].nil?
CharSettings['skin'] = true if CharSettings['skin'].nil?
CharSettings['604'] = false if CharSettings['604'].nil?
CharSettings['safe-kneel'] = false if CharSettings['safe-kneel'].nil?
CharSettings['kneel'] = false if CharSettings['kneel'].nil?
CharSettings['stance'] = false if CharSettings['stance'].nil?
CharSettings['empty'] = false if CharSettings['empty'].nil?
CharSettings['phase-boxes'] = false if CharSettings['phase-boxes'].nil?
CharSettings['get-arrows'] = false if CharSettings['get-arrows'].nil?
CharSettings['eblade-arrows'] = false if CharSettings['eblade-arrows'].nil?

CharSettings['loot-types'] = 'gem|reagent|herb|jewelry|magic|scroll|wand|uncomm on|box' if CharSettings['loot-types'].nil?

$new_loot ||= Array.new

if script.vars.empty?
nil
elsif script.vars[0].downcase == 'list'
fix_setting = { true => 'on', false => 'off' }
respond "skin: #{fix_setting[CharSettings['skin']]}"
respond "604: #{fix_setting[CharSettings['604']]}"
respond "kneel: #{fix_setting[CharSettings['kneel']]}"
respond "safe-kneel: #{fix_setting[CharSettings['safe-kneel']]}"
respond "stance: #{fix_setting[CharSettings['stance']]}"
respond "empty: #{fix_setting[CharSettings['empty']]}"
respond "phase-boxes: #{fix_setting[CharSettings['phase-boxes']]}"
respond "get-arrows: #{fix_setting[CharSettings['get-arrows']]}"
respond "eblade-arrows: #{fix_setting[CharSettings['eblade-arrows']]}"
respond "exclude: #{CharSettings['exclude']}"
respond "loot-types: #{CharSettings['loot-types']}"
# respond "unskinnable: #{Settings['unskinnable'].join(', ')}"
exit
elsif script.vars[0] =~ /^(skin|604|kneel|safe\-kneel|stance|empty|phase\-boxes|get\-arrows|eblade\-arrows)=(on|off|yes|no|true|false)$/i
fix_setting = { 'on' => true, 'yes' => true, 'true' => true, 'off' => false, 'no' => false, 'false' => false }
CharSettings[$1.downcase] = fix_setting[$2.downcase]
echo 'setting saved'
exit
elsif script.vars[0] =~ /^exclude=(.*)$/i
if $1 == 'nil'
CharSettings['exclude'] = nil
echo 'setting cleared'
else
CharSettings['exclude'] = $1
echo 'setting saved'
end
exit
elsif script.vars[0] =~ /^loot\-?types=(.*)$/i
if $1 == 'nil'
CharSettings['loot-types'] = 'gem|reagent|herb|jewelry|magic|scroll|wand|uncomm on|box'
echo 'setting reset'
else
CharSettings['loot-types'] = $1
echo 'setting saved'
end
exit
else
respond
respond "#{$lich_char}#{script.name} waits for you to kill someting and loots it"
respond "#{$lich_char}#{script.name} skin=<on/off> skins before looting"
respond "#{$lich_char}#{script.name} 604=<on/off> cast 604 before skinning"
respond "#{$lich_char}#{script.name} kneel=<on/off> always kneels to skin"
respond "#{$lich_char}#{script.name} safe-kneel=<on/off> kneels to skin if no live npcs are in the room"
respond "#{$lich_char}#{script.name} stance=<on/off> changes to offensive stance to skin"
respond "#{$lich_char}#{script.name} empty=<on/off> empty left hand when skinning"
respond "#{$lich_char}#{script.name} phase-boxes=<on/off> make boxes lighter"
respond "#{$lich_char}#{script.name} get-arrows=<on/off> pick up the arrows you fire and put them in your"
respond "#{''.rjust($lich_char.length)}#{''.rjust(script.na me.length)} arrowsack (or lootsack if arrowsack isn't set)"
respond "#{$lich_char}#{script.name} eblade-arrows=<on/off> eblade arrows when they fail to bundle"
respond "#{$lich_char}#{script.name} exclude=<regex> regex of items not to pick up"
respond "#{$lich_char}#{script.name} exclude=nil clear exclude setting"
respond "#{$lich_char}#{script.name} loot-types=<regex> regex of the types of items to pick up"
respond "#{$lich_char}#{script.name} loot-types=nil reset loot types to the default"
respond
exit
end

if UserVars.lootsack.nil? or UserVars.lootsack.empty?
echo 'error: lootsack is not set. (;set change lootsack <container name>)'
exit
end
unless lootsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack).sub(' ', ' .*')}/i }
echo 'error: failed to find your lootsack'
exit
end
if CharSettings['skin']
if (UserVars.skinweaponsack.nil? or UserVars.skinweaponsack.empty?)
echo 'error: skinning is enabled, but skinweaponsack is not set. (;set change skinweaponsack <container name>)'
exit
end
unless skinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}/i }
dothistimeout "pull my #{UserVars.skinweaponsack}", 3, /^You pull|^You reach|^I'm afraid|^What were you referring to/
dothistimeout "inventory", 3, /^You are wearing/
if skinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}/i }
dothistimeout "push ##{skinweaponsack.id}", 3, /^You push|^You reach/
else
echo 'error: failed to find your skinweaponsack'
exit
end
end
if skinweaponsack.contents.nil?
dothistimeout "look in ##{skinweaponsack.id}", 3, /^In the/
end
if(UserVars.skinweapon.nil? or UserVars.skinweapon.empty?)
echo 'error: skinning is enabled, but skinweapon is not set. (;set change skinweapon <weapon name>)'
exit
end
unless skinweapon = ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon.strip)}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon).sub(' ', ' .*')}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon).sub(' ', ' .*')}/i }
echo 'error: failed to find your skinweapon'
exit
end
if UserVars.bluntskinweaponsack and UserVars.bluntskinweapon
if bluntskinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack.str ip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack).su b(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack).su b(' ', ' .*')}/i }
if bluntskinweaponsack.contents.nil?
dothistimeout "look in ##{bluntskinweaponsack.id}", 3, /^In the/
end
bluntskinweapon = ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon.strip)} $/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon).sub(' ', ' .*')}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon).sub(' ', ' .*')}/i }
end
else
bluntskinweaponsack = nil
bluntskinweapon = nil
end
end
if CharSettings['get-arrows']
if UserVars.arrowsack.nil? or UserVars.arrowsack.empty?
arrowsack = lootsack
else
unless arrowsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack).sub(' ', ' .*')}/i }
echo 'error: failed to find your arrowsack'
exit
end
end
end

status_tags
silence_me

$loot_dead_npcs = Array.new
$loot_grab_list = Array.new
$loot_working = false
$loot_berserking = false

$loot_stats ||= Hash.new
$loot_stats['start_time'] ||= Time.now
$loot_stats['kills'] ||= 0
$loot_stats['successful_skins'] ||= 0
$loot_stats['failed_skins'] ||= 0
$loot_stats['loot_count'] ||= 0
$loot_arrow_ids ||= LimitedArray.new
$loot_arrow_wait = Array.new
$loot_needs_eblade ||= Array.new
$loot_search_rooms ||= Array.new

can_drag = true

people = 'Szent'
echo people
echo 'checking szent before string'
exec_string = "
hide_me
status_tags
before_dying { kill_script(#{script.name.inspect}) if running?(#{script.name.inspect}) }
Thread.new { wait_while { running?(#{Script.self.name.inspect}) }; Script.self.kill }
immolated = LimitedArray.new
immolated.max_size = 15
weapon_fired = LimitedArray.new
weapon_fired.max_size = 15
echo 'checking szent before while line'
while line = get
echo 'checking szent after while line'
if line =~ /<stream id=\"thoughts\">/
next
elsif line =~ /^(?:<.*?>)?You nock an? .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">/
$loot_arrow_ids.push($1) unless $loot_arrow_ids.include?($1)
elsif line =~ /^(?:<.*?>)?The scintillating light fades from an .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrows\">.*?<\\/a>\\./
$loot_needs_eblade.push($1)
elsif line =~ /^(?:<.*?>)?The scintillating .*?light surrounding the .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> fades away\\./
$loot_needs_eblade.push($1)
elsif line =~ /<comp(?:onent|Def) id='room objs'>.*?<a exist=\"(?:\#{$loot_arrow_ids.join('|')})\".*?<\\/comp(?:onent|Def)>/
$loot_grab_list = ($loot_grab_list | GameObj.loot.to_a.find_all { |obj| $loot_arrow_ids.include?(obj.id) }.collect { |obj| obj.id }) - $loot_arrow_wait
echo 'check temp 4'
elsif line =~ /^(?:The|Glancing shot. The|Bad angle. The|Lacking the force and angle to lodge in .*?, the) <a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> (?:ricochets away from .*?, landing nearby\\.|zips past its target to the ground\\.|flips over, landing behind .*?\\.|fails to stick in .*?\\.|simply falls\\.|is deflected to one side, sailing to the ground\\.|disappears into the local environs\\.|zips past its target to the ground\\.)/
arrow_id = $1.dup
$loot_arrow_wait.push(arrow_id) unless $loot_arrow_wait.include?(arrow_id)
echo 'check temp 5'
Thread.new {
sleep 16
arrow_id = $loot_arrow_wait.shift
$loot_grab_list.push(arrow_id) unless $loot_grab_list.include?(arrow_id) or !GameObj.loot.any? { |obj| obj.id == arrow_id }
}
if (line =~ /disappears into the local environs/) and (room = Room.current)
$loot_search_rooms.push(room.id)
end

elsif line =~ /^#{people} (?:swing|gesture|sing|weave|continue|channel|fire| wave|tap|rub|hurl|thrust|slash|throw|punch)/
echo 'You just saw him swing'
candidates = Array.new
while (line = get) and (line !~ /Roundtime|A little bit late for that don't you think|<prompt/)
if line =~ /^The glimmer of an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> catches your eye|^<pushBold\\/>A <a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/> releases a groan of mingled ecstasy and relief as <pushBold\\/><a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/> fades away, leaving an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> behind!$/
obj_id = $1 || $2
$loot_grab_list.push(obj_id) unless $loot_grab_list.include?(obj_id)
next
elsif line =~ /^(?:The|Glancing shot. The|Bad angle. The|Lacking the force and angle to lodge in .*?, the) <a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> (?:ricochets away from .*?, landing nearby\\.|zips past its target to the ground\\.|flips over, landing behind .*?\\.|fails to stick in .*?\\.|simply falls\\.|is deflected to one side, sailing to the ground\\.)/
arrow_id = $1.dup
$loot_arrow_wait.push(arrow_id) unless $loot_arrow_wait.include?(arrow_id)
Thread.new {
sleep 16
arrow_id = $loot_arrow_wait.shift
$loot_grab_list.push(arrow_id) unless $loot_grab_list.include?(arrow_id) or !GameObj.loot.any? { |obj| obj.id == arrow_id }
}
next
end
if line =~ /Wisps of black smoke swirl around <pushBold\\/>.*?<a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a><popBold\\/> and s?he bursts into flame!/
immolated.push($1) unless immolated.include?($1)
end
if line =~ /Szent successfully hit <pushBold\\/>.*?<a exist=\"(.*?)\".*?>.*?<\\/a><popBold\\/> <a.*?>.*?<\\/a> with the spell\\./
weapon_fired.push($1) unless weapon_fired.include?($1)
end
if line =~ /<a exist=['\"](.*?)['\"]/
candidates.push($1) unless candidates.include?($1)
end
end
for obj_id in candidates
if (npc = GameObj.npcs.find { |npc| npc.id == obj_id }) and (npc.status == 'dead')
unless $loot_dead_npcs.include?(obj_id)
$loot_dead_npcs.push(obj_id) unless (npc.name =~ /ice golem|fire elemental|skayl|lava golem|mein golem|mein android/)
$loot_stats['kills'] += 1
end
end
end
elsif line =~ /^You spy .*?<a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a>, which looks like the heirloom that you are searching for!$/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
elsif line =~ /^You cannot do that while berserking\.$|^Everything around you turns red as you work yourself into a berserker's rage!|^You rage across the battlefield, striking with unrelenting fury!/
$loot_berserking = true
elsif line =~ /^The redness fades from the world and you begin to breathe harder\.$/
$loot_berserking = false
end
echo 'checking szent the end'
end
echo 'checking szent the end again'
"
start_exec_script(exec_string, flags={ :quiet => true })

loop {
if ($loot_dead_npcs.empty? and $loot_grab_list.empty?) or $loot_berserking
$loot_working = false
script.want_downstream = false
clear
wait_while { $loot_dead_npcs.empty? and $loot_grab_list.empty? and not $loot_berserking }
end
$loot_working = true
need_fill_hand = false
need_fill_left_hand = false
need_fill_right_hand = false
waitrt?
script.want_downstream = true
right_hand_save = GameObj.right_hand
unless $loot_dead_npcs.empty?
dead_npcs = Array.new
while target = $loot_dead_npcs.shift
if GameObj.npcs.find { |npc| npc.id == target }.status == 'dead'
dead_npcs.push(target)
end
end
if CharSettings['skin'] and dead_npcs.any? { |test_npc| !Settings['unskinnable'].include?(GameObj.npcs.find { |npc| npc.id == test_npc }.name) }
unless (GameObj.right_hand.id == skinweapon.id) or (GameObj.left_hand.id == skinweapon.id)
empty_hand
need_fill_hand = true
dothistimeout("get ##{skinweapon.id}", 4, /^You remove|^You already have that|^You slip a hand/)
end
if CharSettings['604'] and (skinning = Spell[604]) and skinning.known? and skinning.affordable? and not skinning.active?
skinning.cast
end
if CharSettings['kneel'] or (CharSettings['safe kneel'] and not GameObj.npcs.any? { |npc| npc.status !~ /dead/ })
dothistimeout 'kneel', 2, /You kneel/
end
if CharSettings['stance'] and stance != 'offensive'
save_stance = stance
dothistimeout 'stance offensive', 2, /You are now in an offensive stance/
else
save_stance = nil
end
if CharSettings['empty'] and GameObj.right_hand.id and (GameObj.right_hand.id != skinweapon.id)
need_fill_right_hand = true
empty_right_hand
end
if CharSettings['empty'] and GameObj.left_hand.id and (GameObj.left_hand.id != skinweapon.id)
need_fill_left_hand = true
empty_left_hand
end
for target in dead_npcs
if (name = GameObj.npcs.find { |npc| npc.id == target }.name) and not Settings['unskinnable'].include?(name)
if GameObj.left_hand.id == skinweapon.id
skin_result = dothistimeout "skin ##{target} left", 2, /^You (?:skinned|botched)|^You might want to wait until after it is dead|^You can only skin creatures|has already been skinned|^You cannot skin|^Could not find your target creature|unable to cut|^You are unable to break through/
else
skin_result = dothistimeout "skin ##{target}", 2, /You (?:skinned|botched)|You might want to wait until after it is dead|You can only skin creatures|has already been skinned|You cannot skin|Could not find your target creature|unable to cut/
end
if skin_result =~ /You cannot skin/
Settings['unskinnable'].push(name)
elsif skin_result =~ /unable to cut|^You are unable to break through/
Settings['unskinnable'].push(name)
#Settings['blunt-skinnable'].push(name)
elsif skin_result =~ /yielding an? <a exist="(.*?)"/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
$loot_stats['successful_skins'] += 1
else
$loot_stats['failed_skins'] += 1
end
end
end
if need_fill_left_hand
fill_left_hand
end
if need_fill_right_hand
fill_right_hand
end
unless standing?
fput 'stand'
waitrt?
end
if save_stance
fput "stance #{save_stance}"
end
if need_fill_hand
dothistimeout "put ##{skinweapon.id} in ##{skinweaponsack.id}", 2, /You put|^You slip your hand/
end
end
for target in dead_npcs
search_result = dothistimeout "search ##{target}", 4, /You search|What were you referring to|Could not find a valid target to loot|You plunge your hand into/
if search_result =~ /You plunge your hand into .*? withdraw your arm to find a .*? (\w+) in your grasp!/
echo 'fixme'
fput 'stow right'
elsif search_result =~ /You search/
while (line = get) and (line !~ /prompt/)
if line =~ /exist="(.*?)".*which looks like the heirloom that you are searching for/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
else
for link in line.scan(/<a.*?>.*?<\/a>/)
if link =~ /<a exist="(.*?)" noun="(.*?)">(.*?)<\/a>/
exist, noun, name = $1, $2, $3
next if name =~ /^(?:he|she|it|her|his|him|its|itself)$|'s$/i
unless thing = GameObj.loot.find { |obj| obj.id == exist }
thing = GameObj.new(exist, noun, name)
end
if thing.type.nil?
Script.log "#{Time.now.strftime("%Y-%m-%d %I:%M%P")}: missing type for: #{thing.name}"
elsif (thing.type =~ /junk/) or (CharSettings['exclude'] and thing.name =~ /#{CharSettings['exclude']}/)
nil
elsif thing.type =~ /#{CharSettings['loot-types']}/
$loot_grab_list.push(thing.id) unless $loot_grab_list.include?(thing.id)
unless thing.sellable or (thing.type =~ /herb/)
Script.log "#{Time.now.strftime("%Y-%m-%d %I:%M%P")}: missing sellable for: #{thing.name}"
end
end
end
end
end
end
end
end
end
if $loot_grab_list.empty?
if need_fill_hand
fill_hand
end
else
need_close_disk = false
need_close_lootsack = false
unless need_fill_hand
empty_hand
end
while obj_id = $loot_grab_list.shift
unless obj = GameObj.loot.find { |o| o.id == obj_id }
next if CharSettings['get-arrows'] and $loot_arrow_ids.include?(obj_id)
dothistimeout "get ##{obj_id}", 2, /^You pick up/
if GameObj.right_hand.id == obj_id
obj = GameObj.right_hand
elsif GameObj.left_hand.id == obj_id
obj = GameObj.left_hand
else
echo 'fixme'
next
end
end
if (obj.type =~ /box/) and ((disk = GameObj.loot.find { |o| o.name =~ /#{Char.name} disk$/ }) or reget.any? { |line| line =~ /^Your disk arrives, following you dutifully\.\r?$/ })
25.times { break if GameObj.loot.any? { |o| o.name =~ /#{Char.name} disk$/ }; sleep 0.1 }
if disk
result = dothistimeout "_drag ##{obj.id} ##{disk.id}", 2, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$/
if result =~ /It's closed!/
dothistimeout "open ##{disk.id}", 3, /^You open|^That is already open\./
need_close_disk = true
result = dothistimeout "_drag ##{obj.id} ##{disk.id}", 2, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$/
end
if result =~ /You put/
$new_loot.push(obj.id)
next
end
end
end
if CharSettings['get-arrows'] and not $loot_search_rooms.empty? and not GameObj.npcs.any? { |npc| (npc.type !~ /passive npc/) and (npc.status !~ /dead/) } and (room = Room.current) and $loot_search_rooms.include?(room.id)
$loot_search_rooms.count(room.id).times {
dothistimeout 'search', 2, /^You don't find|^You spy/
waitrt?
}
$loot_search_rooms.delete(room.id)
end
while CharSettings['eblade-arrows'] and (eblade = Spell[411]) and eblade.known? and eblade.affordable? and (arrow_id = $loot_needs_eblade.shift)
if arrow = (GameObj.loot.to_a + arrowsack.contents.to_a).find { |obj| obj.id == arrow_id }
waitcastrt?
result = eblade.cast(arrow)
if (result == false) or (result =~ /^\[Spell Hindrance/)
arrow_id = $loot_needs_eblade.unshift(arrow_id)
end
end
end
if CharSettings['get-arrows'] and $loot_arrow_ids.include?(obj.id)
if bundle = arrowsack.contents.find { |o| o.noun == 'arrows' }
if GameObj.loot.find_all { |o| o.noun == 'arrow' }.length > 2
dothistimeout "gather ##{obj.id}", 4, /^You gather|^You pick up|^You need a free hand to pick that up\.|^I could not find what you were referring to\.|^Get what\?|^The .*? is out of your reach\./
result = dothistimeout "put my arrow in ##{bundle.id}", 4, /^You add|^You bundle|^I could not find what you were referring to\.|^You cannot bundle these together\./
else
result = dothistimeout "_drag ##{obj.id} ##{bundle.id}", 4, /You add|You need a free hand to pick that up\.|^I could not find what you were referring to\.|^Get what\?|^The .*? is out of your reach\.|^You cannot bundle these together\./
end
if result =~ /^You cannot bundle these together\./
result = dothistimeout "put my arrow in ##{arrowsack.id}", 4, /^You put/
end
else
result = dothistimeout "_drag ##{obj.id} ##{arrowsack.id}", 4, /^You put/
end
else
if can_drag
$loot_stats['loot_count'] += 1
result = dothistimeout "_drag ##{obj.id} ##{lootsack.id}", 4, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\.|^Do you want to put that in or on/
if result =~ /^Do you want to put that in or on/
can_drag = false
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /^You put|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\./
end
else
dothistimeout "get ##{obj.id}", 4, /^You pick up|^You remove|^You need a free hand to pick that up\.|^I could not find what you were referring to\./
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /^You put|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\./
end
if result =~ /It's closed!/
dothistimeout "open ##{lootsack.id}", 3, /^You open|^That is already open\./
need_close_lootsack = true
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring to\./
end
if result =~ /won't fit/
fput "drop ##{obj.id}"
else
$new_loot.push(obj.id)
if CharSettings['phase-boxes'] and (obj.type =~ /box/) and Spell[704].known? and Spell[704].affordable?
loop {
result = cast 704, obj
break unless (result =~ /^\[Spell Hindrance for/) and Spell[704].affordable?
}
end
end
end
end
fill_hand
if need_close_lootsack
dothistimeout "close ##{lootsack.id}", 3, /^You close|^That is already closed;\./
end
if need_close_disk
dothistimeout "close ##{disk.id}", 3, /^You close|^That is already closed;\./
end
end
}

# You are unable to break through the krag dweller's stone hide with a dagger!

=begin
arrow gets hidden, option to search when nothing is alive
can't pick up arrow for x seconds, option to wait when nothing is alive
start second bundle when charges run out
keep track of charged/dead bundle
option to eblade/bless dead arrows

The <a exist="14692818" noun="arrow">wooden arrow</a> disappears into the local environs.

The scintillating red light surrounding the arrow fades away.
The scintillating light fades from a <a exist="14575103" noun="arrows">bundle of wooden arrows</a>.
You cannot bundle these together.

only gather after kill
only gather with no live npcs
search for arrows
wait for arrows
e-blade arrows
bless arrows
=end

vamosj
02-21-2012, 01:16 PM
J>;lootszent
--- Lich: lootszent active.
[lootszent: Szent]
[lootszent: checking szent before string]
[exec2: checking szent before while line]
A rolton trots in!
J>
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
A rolton tries to bite you!
AS: +36 vs DS: +344 with AvD: +32 + d100 roll: +32 = -244
A clean miss.
J>
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
Szent swings a raven black Saramar-enruned spikestar at a rolton!
AS: +326 vs DS: +48 with AvD: +36 + d100 roll: +55 = +369
... and hits for 143 points of damage!
Strike to left arm cleanly severs it at the shoulder!
The rolton bleats loudly as she slumps to the ground and cradles her wounded left foreleg.
The rolton lets out a final agonized bleat and dies.
J>
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
[exec2: checking szent after while line]
[exec2: checking szent the end]
>;kill lootszent
--- Lich: lootszent has exited.

Pereus
02-21-2012, 04:26 PM
There ya go.


=begin

This script waits for you to kill something, and then it skins (optional),
searches, and picks up loot.

;loot help

tillmen@lichproject.org

# Author: Tillmen
# Category: loot

=end

if defined?(GameObj.type_data)
GameObj.load_data if GameObj.type_data.empty? or GameObj.type_data.nil?
if GameObj.type_data.nil?
wait_while { running?('updater') }
wait_while { running?('repository') }
start_script 'repository', [ 'download', 'gameobj-data.xml' ]
wait_while { running?('repository') }
wait_while { running?('updater') }
start_script 'updater', [ 'add', 'gameobj-data.xml' ]
wait_while { running?('updater') }
GameObj.load_data
exit if GameObj.type_data.nil?
end
end

# fixme: open/close lootsack

Settings['unskinnable'] = Array.new if Settings['unskinnable'].nil?
Settings['blunt-skinnable'] = Array.new if Settings['blunt-skinnable'].nil?
CharSettings['skin'] = true if CharSettings['skin'].nil?
CharSettings['604'] = false if CharSettings['604'].nil?
CharSettings['safe-kneel'] = false if CharSettings['safe-kneel'].nil?
CharSettings['kneel'] = false if CharSettings['kneel'].nil?
CharSettings['stance'] = false if CharSettings['stance'].nil?
CharSettings['empty'] = false if CharSettings['empty'].nil?
CharSettings['phase-boxes'] = false if CharSettings['phase-boxes'].nil?
CharSettings['get-arrows'] = false if CharSettings['get-arrows'].nil?
CharSettings['eblade-arrows'] = false if CharSettings['eblade-arrows'].nil?

CharSettings['loot-types'] = 'gem|reagent|herb|jewelry|magic|scroll|wand|uncomm on|box' if CharSettings['loot-types'].nil?

$new_loot ||= Array.new

if script.vars.empty?
nil
elsif script.vars[0].downcase == 'list'
fix_setting = { true => 'on', false => 'off' }
respond "skin: #{fix_setting[CharSettings['skin']]}"
respond "604: #{fix_setting[CharSettings['604']]}"
respond "kneel: #{fix_setting[CharSettings['kneel']]}"
respond "safe-kneel: #{fix_setting[CharSettings['safe-kneel']]}"
respond "stance: #{fix_setting[CharSettings['stance']]}"
respond "empty: #{fix_setting[CharSettings['empty']]}"
respond "phase-boxes: #{fix_setting[CharSettings['phase-boxes']]}"
respond "get-arrows: #{fix_setting[CharSettings['get-arrows']]}"
respond "eblade-arrows: #{fix_setting[CharSettings['eblade-arrows']]}"
respond "exclude: #{CharSettings['exclude']}"
respond "loot-types: #{CharSettings['loot-types']}"
# respond "unskinnable: #{Settings['unskinnable'].join(', ')}"
exit
elsif script.vars[0] =~ /^(skin|604|kneel|safe\-kneel|stance|empty|phase\-boxes|get\-arrows|eblade\-arrows)=(on|off|yes|no|true|false)$/i
fix_setting = { 'on' => true, 'yes' => true, 'true' => true, 'off' => false, 'no' => false, 'false' => false }
CharSettings[$1.downcase] = fix_setting[$2.downcase]
echo 'setting saved'
exit
elsif script.vars[0] =~ /^exclude=(.*)$/i
if $1 == 'nil'
CharSettings['exclude'] = nil
echo 'setting cleared'
else
CharSettings['exclude'] = $1
echo 'setting saved'
end
exit
elsif script.vars[0] =~ /^loot\-?types=(.*)$/i
if $1 == 'nil'
CharSettings['loot-types'] = 'gem|reagent|herb|jewelry|magic|scroll|wand|uncomm on|box'
echo 'setting reset'
else
CharSettings['loot-types'] = $1
echo 'setting saved'
end
exit
else
respond
respond "#{$lich_char}#{script.name} waits for you to kill someting and loots it"
respond "#{$lich_char}#{script.name} skin=<on/off> skins before looting"
respond "#{$lich_char}#{script.name} 604=<on/off> cast 604 before skinning"
respond "#{$lich_char}#{script.name} kneel=<on/off> always kneels to skin"
respond "#{$lich_char}#{script.name} safe-kneel=<on/off> kneels to skin if no live npcs are in the room"
respond "#{$lich_char}#{script.name} stance=<on/off> changes to offensive stance to skin"
respond "#{$lich_char}#{script.name} empty=<on/off> empty left hand when skinning"
respond "#{$lich_char}#{script.name} phase-boxes=<on/off> make boxes lighter"
respond "#{$lich_char}#{script.name} get-arrows=<on/off> pick up the arrows you fire and put them in your"
respond "#{''.rjust($lich_char.length)}#{''.rjust(script.na me.length)} arrowsack (or lootsack if arrowsack isn't set)"
respond "#{$lich_char}#{script.name} eblade-arrows=<on/off> eblade arrows when they fail to bundle"
respond "#{$lich_char}#{script.name} exclude=<regex> regex of items not to pick up"
respond "#{$lich_char}#{script.name} exclude=nil clear exclude setting"
respond "#{$lich_char}#{script.name} loot-types=<regex> regex of the types of items to pick up"
respond "#{$lich_char}#{script.name} loot-types=nil reset loot types to the default"
respond
exit
end

if UserVars.lootsack.nil? or UserVars.lootsack.empty?
echo 'error: lootsack is not set. (;set change lootsack <container name>)'
exit
end
unless lootsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack).sub(' ', '

.*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.lootsack).sub(' ', ' .*')}/i }
echo 'error: failed to find your lootsack'
exit
end
if CharSettings['skin']
if (UserVars.skinweaponsack.nil? or UserVars.skinweaponsack.empty?)
echo 'error: skinning is enabled, but skinweaponsack is not set. (;set change skinweaponsack <container name>)'
exit
end
unless skinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape

(UserVars.skinweaponsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}/i }
dothistimeout "pull my #{UserVars.skinweaponsack}", 3, /^You pull|^You reach|^I'm afraid|^What were you referring to/
dothistimeout "inventory", 3, /^You are wearing/
if skinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape

(UserVars.skinweaponsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweaponsack).sub(' ', ' .*')}/i }
dothistimeout "push ##{skinweaponsack.id}", 3, /^You push|^You reach/
else
echo 'error: failed to find your skinweaponsack'
exit
end
end
if skinweaponsack.contents.nil?
dothistimeout "look in ##{skinweaponsack.id}", 3, /^In the/
end
if(UserVars.skinweapon.nil? or UserVars.skinweapon.empty?)
echo 'error: skinning is enabled, but skinweapon is not set. (;set change skinweapon <weapon name>)'
exit
end
unless skinweapon = ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon.strip)}$/i } || ([

GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon).sub(' ', ' .*')}$/i } || ([ GameObj.right_hand,

GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.skinweapon).sub(' ', ' .*')}/i }
echo 'error: failed to find your skinweapon'
exit
end
if UserVars.bluntskinweaponsack and UserVars.bluntskinweapon
if bluntskinweaponsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack.str ip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#

{Regexp.escape(UserVars.bluntskinweaponsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweaponsack).su b(' ', ' .*')}/i }
if bluntskinweaponsack.contents.nil?
dothistimeout "look in ##{bluntskinweaponsack.id}", 3, /^In the/
end
bluntskinweapon = ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape

(UserVars.bluntskinweapon.strip)}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon).sub('

', ' .*')}$/i } || ([ GameObj.right_hand, GameObj.left_hand ] | GameObj.containers.values.flatten).find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.bluntskinweapon).sub(' ', ' .*')}/i }
end
else
bluntskinweaponsack = nil
bluntskinweapon = nil
end
end
if CharSettings['get-arrows']
if UserVars.arrowsack.nil? or UserVars.arrowsack.empty?
arrowsack = lootsack
else
unless arrowsack = GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack.strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape

(UserVars.arrowsack).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.arrowsack).sub(' ', ' .*')}/i }
echo 'error: failed to find your arrowsack'
exit
end
end
end

status_tags
silence_me

$loot_dead_npcs = Array.new
$loot_grab_list = Array.new
$loot_working = false
$loot_berserking = false

$loot_stats ||= Hash.new
$loot_stats['start_time'] ||= Time.now
$loot_stats['kills'] ||= 0
$loot_stats['successful_skins'] ||= 0
$loot_stats['failed_skins'] ||= 0
$loot_stats['loot_count'] ||= 0
$loot_arrow_ids ||= LimitedArray.new
$loot_arrow_wait = Array.new
$loot_needs_eblade ||= Array.new
$loot_search_rooms ||= Array.new

can_drag = true

exec_string = "
hide_me
status_tags
before_dying { kill_script(#{script.name.inspect}) if running?(#{script.name.inspect}) }
Thread.new { wait_while { running?(#{Script.self.name.inspect}) }; Script.self.kill }
immolated = LimitedArray.new
immolated.max_size = 15
weapon_fired = LimitedArray.new
weapon_fired.max_size = 15
while line = get
target_line = waitfor('swings', 'gestures', 'channels', 'fires', 'waves', 'hurls', 'thrusts')

if line =~ /<stream id=\"thoughts\">/
next
elsif line =~ /^(?:<.*?>)?You nock an? .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">/
$loot_arrow_ids.push($1) unless $loot_arrow_ids.include?($1)
elsif line =~ /^(?:<.*?>)?The scintillating light fades from an .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrows\">.*?<\\/a>\\./
$loot_needs_eblade.push($1)
elsif line =~ /^(?:<.*?>)?The scintillating .*?light surrounding the .*?<a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> fades away\\./
$loot_needs_eblade.push($1)
elsif line =~ /<comp(?:onent|Def) id='room objs'>.*?<a exist=\"(?:\#{$loot_arrow_ids.join('|')})\".*?<\\/comp(?:onent|Def)>/
$loot_grab_list = ($loot_grab_list | GameObj.loot.to_a.find_all { |obj| $loot_arrow_ids.include?(obj.id) }.collect { |obj| obj.id }) - $loot_arrow_wait
elsif line =~ /^(?:The|Glancing shot. The|Bad angle. The|Lacking the force and angle to lodge in .*?, the) <a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a> (?:ricochets away

from .*?, landing nearby\\.|zips past its target to the ground\\.|flips over, landing behind .*?\\.|fails to stick in .*?\\.|simply falls\\.|is deflected to one side, sailing to the ground\\.|

disappears into the local environs\\.|zips past its target to the ground\\.)/
arrow_id = $1.dup
$loot_arrow_wait.push(arrow_id) unless $loot_arrow_wait.include?(arrow_id)
Thread.new {
sleep 16
arrow_id = $loot_arrow_wait.shift
$loot_grab_list.push(arrow_id) unless $loot_grab_list.include?(arrow_id) or !GameObj.loot.any? { |obj| obj.id == arrow_id }
}
if (line =~ /disappears into the local environs/) and (room = Room.current)
$loot_search_rooms.push(room.id)
end
elsif(target_line =~/(?:swings|gestures|channels|fires|waves|hurls|thru sts)/i)
candidates = Array.new

while (line = get) and (line !~ /Roundtime|A little bit late for that don't you think|<prompt/)
if line =~ /^The glimmer of an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> catches your eye|^<pushBold\\/>A <a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/>

releases a groan of mingled ecstasy and relief as <pushBold\\/><a exist=\".*?\" noun=\".*?\">.*?<\\/a><popBold\\/> fades away, leaving an? <a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a> behind!$/
obj_id = $1 || $2
$loot_grab_list.push(obj_id) unless $loot_grab_list.include?(obj_id)
next
elsif line =~ /^(?:The|Glancing shot. The|Bad angle. The|Lacking the force and angle to lodge in .*?, the) <a exist=\"(\\-?[0-9]+)\" noun=\"arrow\">.*?<\\/a>

(?:ricochets away from .*?, landing nearby\\.|zips past its target to the ground\\.|flips over, landing behind .*?\\.|fails to stick in .*?\\.|simply falls\\.|is deflected to one side, sailing to

the ground\\.)/
arrow_id = $1.dup
$loot_arrow_wait.push(arrow_id) unless $loot_arrow_wait.include?(arrow_id)
Thread.new {
sleep 16
arrow_id = $loot_arrow_wait.shift
$loot_grab_list.push(arrow_id) unless $loot_grab_list.include?(arrow_id) or !GameObj.loot.any? { |obj| obj.id == arrow_id }
}
next
end
if line =~ /Wisps of black smoke swirl around <pushBold\\/>.*?<a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a><popBold\\/> and s?he bursts into flame!/
immolated.push($1) unless immolated.include?($1)
end
if line =~ /You successfully hit <pushBold\\/>.*?<a exist=\"(.*?)\".*?>.*?<\\/a><popBold\\/> <a.*?>.*?<\\/a> with the spell\\./
weapon_fired.push($1) unless weapon_fired.include?($1)
end
if line =~ /<a exist=['\"](.*?)['\"]/
candidates.push($1) unless candidates.include?($1)
end
end
for obj_id in candidates
if (npc = GameObj.npcs.find { |npc| npc.id == obj_id }) and (npc.status == 'dead')
unless $loot_dead_npcs.include?(obj_id)
$loot_dead_npcs.push(obj_id) unless (npc.name =~ /ice golem|fire elemental|skayl|lava golem|mein golem|mein android/)
$loot_stats['kills'] += 1
end
end
end
elsif line =~ /^You spy .*?<a exist=\"(.*?)\" noun=\".*?\">.*?<\\/a>, which looks like the heirloom that you are searching for!$/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
elsif line =~ /^You cannot do that while berserking\.$|^Everything around you turns red as you work yourself into a berserker's rage!|^You rage across the battlefield, striking with

unrelenting fury!/
$loot_berserking = true
elsif line =~ /^The redness fades from the world and you begin to breathe harder\.$/
$loot_berserking = false
end
end
"
start_exec_script(exec_string, flags={ :quiet => true })

loop {
if ($loot_dead_npcs.empty? and $loot_grab_list.empty?) or $loot_berserking
$loot_working = false
script.want_downstream = false
clear
wait_while { $loot_dead_npcs.empty? and $loot_grab_list.empty? and not $loot_berserking }
end
$loot_working = true
need_fill_hand = false
need_fill_left_hand = false
need_fill_right_hand = false
waitrt?
script.want_downstream = true
right_hand_save = GameObj.right_hand
unless $loot_dead_npcs.empty?
dead_npcs = Array.new
while target = $loot_dead_npcs.shift
if GameObj.npcs.find { |npc| npc.id == target }.status == 'dead'
dead_npcs.push(target)
end
end
if CharSettings['skin'] and dead_npcs.any? { |test_npc| !Settings['unskinnable'].include?(GameObj.npcs.find { |npc| npc.id == test_npc }.name) }
unless (GameObj.right_hand.id == skinweapon.id) or (GameObj.left_hand.id == skinweapon.id)
empty_hand
need_fill_hand = true
dothistimeout("get ##{skinweapon.id}", 4, /^You remove|^You already have that|^You slip a hand/)
end
if CharSettings['604'] and (skinning = Spell[604]) and skinning.known? and skinning.affordable? and not skinning.active?
skinning.cast
end
if CharSettings['kneel'] or (CharSettings['safe kneel'] and not GameObj.npcs.any? { |npc| npc.status !~ /dead/ })
dothistimeout 'kneel', 2, /You kneel/
end
if CharSettings['stance'] and stance != 'offensive'
save_stance = stance
dothistimeout 'stance offensive', 2, /You are now in an offensive stance/
else
save_stance = nil
end
if CharSettings['empty'] and GameObj.right_hand.id and (GameObj.right_hand.id != skinweapon.id)
need_fill_right_hand = true
empty_right_hand
end
if CharSettings['empty'] and GameObj.left_hand.id and (GameObj.left_hand.id != skinweapon.id)
need_fill_left_hand = true
empty_left_hand
end
for target in dead_npcs
if (name = GameObj.npcs.find { |npc| npc.id == target }.name) and not Settings['unskinnable'].include?(name)
if GameObj.left_hand.id == skinweapon.id
skin_result = dothistimeout "skin ##{target} left", 2, /^You (?:skinned|botched)|^You might want to wait until after it is dead|^You can only skin

creatures|has already been skinned|^You cannot skin|^Could not find your target creature|unable to cut|^You are unable to break through/
else
skin_result = dothistimeout "skin ##{target}", 2, /You (?:skinned|botched)|You might want to wait until after it is dead|You can only skin

creatures|has already been skinned|You cannot skin|Could not find your target creature|unable to cut/
end
if skin_result =~ /You cannot skin/
Settings['unskinnable'].push(name)
elsif skin_result =~ /unable to cut|^You are unable to break through/
Settings['unskinnable'].push(name)
#Settings['blunt-skinnable'].push(name)
elsif skin_result =~ /yielding an? <a exist="(.*?)"/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
$loot_stats['successful_skins'] += 1
else
$loot_stats['failed_skins'] += 1
end
end
end
if need_fill_left_hand
fill_left_hand
end
if need_fill_right_hand
fill_right_hand
end
unless standing?
fput 'stand'
waitrt?
end
if save_stance
fput "stance #{save_stance}"
end
if need_fill_hand
dothistimeout "put ##{skinweapon.id} in ##{skinweaponsack.id}", 2, /You put|^You slip your hand/
end
end
for target in dead_npcs
search_result = dothistimeout "search ##{target}", 4, /You search|What were you referring to|Could not find a valid target to loot|You plunge your hand into/
if search_result =~ /You plunge your hand into .*? withdraw your arm to find a .*? (\w+) in your grasp!/
echo 'fixme'
fput 'stow right'
elsif search_result =~ /You search/
while (line = get) and (line !~ /prompt/)
if line =~ /exist="(.*?)".*which looks like the heirloom that you are searching for/
$loot_grab_list.push($1) unless $loot_grab_list.include?($1)
else
for link in line.scan(/<a.*?>.*?<\/a>/)
if link =~ /<a exist="(.*?)" noun="(.*?)">(.*?)<\/a>/
exist, noun, name = $1, $2, $3
next if name =~ /^(?:he|she|it|her|his|him|its|itself)$|'s$/i
unless thing = GameObj.loot.find { |obj| obj.id == exist }
thing = GameObj.new(exist, noun, name)
end
if thing.type.nil?
Script.log "#{Time.now.strftime("%Y-%m-%d %I:%M%P")}: missing type for: #{thing.name}"
elsif (thing.type =~ /junk/) or (CharSettings['exclude'] and thing.name =~ /#{CharSettings['exclude']}/)
nil
elsif thing.type =~ /#{CharSettings['loot-types']}/
$loot_grab_list.push(thing.id) unless $loot_grab_list.include?(thing.id)
unless thing.sellable or (thing.type =~ /herb/)
Script.log "#{Time.now.strftime("%Y-%m-%d %I:%M%P")}: missing sellable for: #{thing.name}"
end
end
end
end
end
end
end
end
end
if $loot_grab_list.empty?
if need_fill_hand
fill_hand
end
else
need_close_disk = false
need_close_lootsack = false
unless need_fill_hand
empty_hand
end
while obj_id = $loot_grab_list.shift
unless obj = GameObj.loot.find { |o| o.id == obj_id }
next if CharSettings['get-arrows'] and $loot_arrow_ids.include?(obj_id)
dothistimeout "get ##{obj_id}", 2, /^You pick up/
if GameObj.right_hand.id == obj_id
obj = GameObj.right_hand
elsif GameObj.left_hand.id == obj_id
obj = GameObj.left_hand
else
echo 'fixme'
next
end
end
if (obj.type =~ /box/) and ((disk = GameObj.loot.find { |o| o.name =~ /#{Char.name} disk$/ }) or reget.any? { |line| line =~ /^Your disk arrives, following you dutifully\.

\r?$/ })
25.times { break if GameObj.loot.any? { |o| o.name =~ /#{Char.name} disk$/ }; sleep 0.1 }
if disk
result = dothistimeout "_drag ##{obj.id} ##{disk.id}", 2, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$/
if result =~ /It's closed!/
dothistimeout "open ##{disk.id}", 3, /^You open|^That is already open\./
need_close_disk = true
result = dothistimeout "_drag ##{obj.id} ##{disk.id}", 2, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$/
end
if result =~ /You put/
$new_loot.push(obj.id)
next
end
end
end
if CharSettings['get-arrows'] and not $loot_search_rooms.empty? and not GameObj.npcs.any? { |npc| (npc.type !~ /passive npc/) and (npc.status !~ /dead/) } and (room =

Room.current) and $loot_search_rooms.include?(room.id)
$loot_search_rooms.count(room.id).times {
dothistimeout 'search', 2, /^You don't find|^You spy/
waitrt?
}
$loot_search_rooms.delete(room.id)
end
while CharSettings['eblade-arrows'] and (eblade = Spell[411]) and eblade.known? and eblade.affordable? and (arrow_id = $loot_needs_eblade.shift)
if arrow = (GameObj.loot.to_a + arrowsack.contents.to_a).find { |obj| obj.id == arrow_id }
waitcastrt?
result = eblade.cast(arrow)
if (result == false) or (result =~ /^\[Spell Hindrance/)
arrow_id = $loot_needs_eblade.unshift(arrow_id)
end
end
end
if CharSettings['get-arrows'] and $loot_arrow_ids.include?(obj.id)
if bundle = arrowsack.contents.find { |o| o.noun == 'arrows' }
if GameObj.loot.find_all { |o| o.noun == 'arrow' }.length > 2
dothistimeout "gather ##{obj.id}", 4, /^You gather|^You pick up|^You need a free hand to pick that up\.|^I could not find what you were referring to

\.|^Get what\?|^The .*? is out of your reach\./
result = dothistimeout "put my arrow in ##{bundle.id}", 4, /^You add|^You bundle|^I could not find what you were referring to\.|^You cannot bundle

these together\./
else
result = dothistimeout "_drag ##{obj.id} ##{bundle.id}", 4, /You add|You need a free hand to pick that up\.|^I could not find what you were referring

to\.|^Get what\?|^The .*? is out of your reach\.|^You cannot bundle these together\./
end
if result =~ /^You cannot bundle these together\./
result = dothistimeout "put my arrow in ##{arrowsack.id}", 4, /^You put/
end
else
result = dothistimeout "_drag ##{obj.id} ##{arrowsack.id}", 4, /^You put/
end
else
if can_drag
$loot_stats['loot_count'] += 1
result = dothistimeout "_drag ##{obj.id} ##{lootsack.id}", 4, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$|^I

could not find what you were referring to\.|^Do you want to put that in or on/
if result =~ /^Do you want to put that in or on/
can_drag = false
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /^You put|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were

referring to\./
end
else
dothistimeout "get ##{obj.id}", 4, /^You pick up|^You remove|^You need a free hand to pick that up\.|^I could not find what you were referring to\./
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /^You put|It's closed!|^Your .*? won't fit in .*?\.$|^I could not find what you were referring

to\./
end
if result =~ /It's closed!/
dothistimeout "open ##{lootsack.id}", 3, /^You open|^That is already open\./
need_close_lootsack = true
result = dothistimeout "put ##{obj.id} in ##{lootsack.id}", 4, /You put|You need a free hand to pick that up\.|It's closed!|^Your .*? won't fit in .*?\.$|^I

could not find what you were referring to\./
end
if result =~ /won't fit/
fput "drop ##{obj.id}"
else
$new_loot.push(obj.id)
if CharSettings['phase-boxes'] and (obj.type =~ /box/) and Spell[704].known? and Spell[704].affordable?
loop {
result = cast 704, obj
break unless (result =~ /^\[Spell Hindrance for/) and Spell[704].affordable?
}
end
end
end
end
fill_hand
if need_close_lootsack
dothistimeout "close ##{lootsack.id}", 3, /^You close|^That is already closed;\./
end
if need_close_disk
dothistimeout "close ##{disk.id}", 3, /^You close|^That is already closed;\./
end
end
}

# You are unable to break through the krag dweller's stone hide with a dagger!

=begin
arrow gets hidden, option to search when nothing is alive
can't pick up arrow for x seconds, option to wait when nothing is alive
start second bundle when charges run out
keep track of charged/dead bundle
option to eblade/bless dead arrows

The <a exist="14692818" noun="arrow">wooden arrow</a> disappears into the local environs.

The scintillating red light surrounding the arrow fades away.
The scintillating light fades from a <a exist="14575103" noun="arrows">bundle of wooden arrows</a>.
You cannot bundle these together.

only gather after kill
only gather with no live npcs
search for arrows
wait for arrows
e-blade arrows
bless arrows
=end

vamosj
02-21-2012, 05:10 PM
Was getting this error.... Turned skinning off and it's not a problem anymore.

-- Lich: grouploot active.
--- Exception: wrong number of arguments (0 for 1)
grouploot:124:in `escape'
--- Lich: grouploot has exited.

Smythe
02-22-2012, 12:21 AM
Niiiice, Pereus. See what ya did an' like where ya took it. Looks like some code we don' need, but runs ok? Guess I'll prod it a bit.

- Smythe

:up: