need halp
if anyones bored and better then i am at scripting(wich prolly most are) i need npcpick to check all my containers for boxes instead of just my lootsack..
silence_me
withdraw_amount = 25000
close_lootsack = false
junk_nouns = [ 'lockpick', 'tabard', 'shirt', 'scarf', 'cap', 'hat', 'snood', 'doughnut', 'tart', 'cupcake', 'ribbon', 'cookie', 'horseshoe', 'muffin', 'dress', 'boots', 'skirt', 'harness', 'satchel', 'vest', 'gloves', 'bonnet', 'purse', 'scabbard', 'cloak', 'greatcloak', 'knapsack' ]
junk_regex = /^(?:scratched|corroded|polished|shiny|tarnished|de nted|rusty|bent) (?:ring|medallion|earring|anklet|bracelet|fork|spo on|plate|coin|cup|nail|doorknob)$|^smooth stone$|^steel shield$|^some tree bark$|^table leg$|^moldy bone$|^some tattered cloth$|^piece of iron$|^chipped brick$|^scratched steel helm$/
disk = GameObj.loot.find { |obj| obj.name =~ /#{Char.name} disk$/ }
if UserVars.lootsack.nil? or UserVars.lootsack.empty?
echo 'error: lootsack is not set (;set change lootsack <container>)'
exit
end
unless lootsack = GameObj.inv.find { |obj| obj.name =~ /#{Regexp.escape(UserVars.lootsack.strip)}/i } || GameObj.inv.find { |obj| obj.name =~ /#{Regexp.escape(UserVars.lootsack).sub(' ', ' .*')}/i }
echo "error: unable to find your lootsack #{UserVars.lootsack} in your inventory"
exit
end
if lootsack.contents.nil?
open_result = dothis "open ##{lootsack.id}", /You open|already open/
close_lootsack = true if open_result =~ /You open/
if lootsack.contents.nil?
dothis "look in ##{lootsack.id}", /In the .* you see/
if lootsack.contents.nil?
echo 'fixme (1)'
exit
end
end
end
unless (GameObj.right_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/) or (GameObj.left_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/) or lootsack.contents.find { |obj| obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/ }
if disk and disk.contents.nil?
echo "Waiting On Your Disk To Arrive"
pause 3
dothistimeout "look in ##{disk.id}", 2, /^In the|^There is nothing in there\.$/
end
unless disk.contents.any? { |obj| obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/ }
echo 'no boxes'
exit
end
end
start_script 'go2', [ 'bank', '_disable_confirm_' ]
wait_while { running?('go2') }
fput "withdraw #{withdraw_amount} silvers"
start_script 'go2', [ 'locksmith', '_disable_confirm_' ]
wait_while { running?('go2') }
empty_hands
unless trash = (GameObj.room_desc.to_a + GameObj.loot.to_a).find { |obj| obj.noun =~ /^(?:crate|barrel|wastebarrel|casket)$/ } || trash = (GameObj.room_desc.to_a + GameObj.loot.to_a).find { |obj| obj.noun == 'coffer' }
echo 'warning: failed to find a trash container'
end
unless table = (GameObj.room_desc.to_a + GameObj.loot.to_a).find { |obj| obj.noun =~ /^(?:table|counter)$/ }
echo 'error: failed to find a table'
exit
end
if table.contents.nil?
dothistimeout "look on ##{table.id}", 5, /On the .*? you see/
if table.contents.nil?
echo 'fixme (2)'
exit
end
end
if table.contents.find { |obj| obj.noun == 'bell' }
activator = 'ring bell'
elsif table.contents.find { |obj| obj.noun == 'keys' }
activator = 'pull keys'
elsif table.contents.find { |obj| obj.noun == 'chime' }
activator = 'ring chime'
else
echo 'error: failed to find bell/keys/chime type thing'
exit
end
open_box = proc { |box|
unless (GameObj.right_hand.id == box.id) or (GameObj.left_hand.id == box.id)
dothistimeout "get ##{box.id}", 3, /^You remove|^Get what\?$/
end
if (GameObj.right_hand.id == box.id) or (GameObj.left_hand.id == box.id)
put_result = dothistimeout "put ##{box.id} on ##{table.id}", 5, /^You put|^Your .*? won't fit on .*?\.$/
if (put_result =~ /won't fit/) and table.contents.length > 1
for obj in table.contents
if obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
fput "get ##{obj.id}"
sleep 0.1
fput "drop ##{obj.id}"
sleep 0.1
end
end
put_result = dothistimeout "put ##{box.id} on ##{table.id}", 5, /^You put|^Your .*? won't fit on .*?\.$/
end
if put_result =~ /^You put/
fput 'unhide' if invisible?
activator_result = dothistimeout activator, 5, /^You .*? the .*? but .*? ignores you|I'm afraid that you can't pull that.|^You .*? the .*?, and ask .*?/
if activator_result =~ /^You .*? the .*?, and ask .*?/
pay_result = dothistimeout 'pay', 5, /^But you don't have enough!|accepts your silvers./
if pay_result =~ /^But you don't have enough!/
start_script 'go2', ['bank']
wait_while { running?('go2') }
start_script 'go2', [ 'bank', '_disable_confirm_' ]
wait_while { running?('go2') }
fput "withdraw #{withdraw_amount} silvers"
start_script 'go2', [ 'locksmith', '_disable_confirm_' ]
wait_while { running?('go2') }
pay_result = dothistimeout "pay", 5, /^But you don't have enough!|accepts your silvers./
end
if pay_result = /accepts your silvers./
get_result = dothistimeout "get ##{box.id}", 5, /^Get what?|^You remove/
if get_result =~ /^You remove/
open_result = dothistimeout "open ##{box.id}", 5, /^You open/
if open_result =~ /^You open/
get_result = dothistimeout "get coins from ##{box.id}", 5, /^You gather the remaining/
unless get_result =~ /^You gather the remaining/
echo 'fixme (9)'
end
waitrt?
for obj in box.contents
if junk_nouns.include?(obj.noun) or (obj.name =~ junk_regex)
dothistimeout "get ##{obj.id}", 3, /^You/
if trash
dothistimeout "put ##{obj.id} in ##{trash.id}", 3, /^You put|^As you place/
else
dothistimeout "drop ##{obj.id}", 3, /^You drop/
end
else
dothistimeout "_drag ##{obj.id} ##{lootsack.id}", 3, /^You put/
end
end
unless box.contents.empty?
echo 'fixme (10)'
exit
end
if trash
dothistimeout "put ##{box.id} in ##{trash.id}", 3, /^You put|^As you place/
else
dothistimeout "drop ##{box.id}", 3, /^You drop/
end
sleep 0.1
else
echo 'fixme (8)'
end
else
echo 'fixme (7)'
end
else
echo 'fixme (6)'
end
else
echo 'fixme (5)'
end
else
echo 'fixme (4)'
fput "drop ##{box.id}"
end
else
echo 'fixme (3)'
end
}
#
# start when there are no pcs in the room, or the table doesn't change for 10 seconds, or two minutes pass.
#
max_wait = Time.now + 120
after = table.contents.collect { |obj| obj.id }
while checkpcs
before = after.dup
50.times {
sleep 0.2
break if checkpcs
after = table.contents.collect { |obj| obj.id }
break if before != after
}
break if (before == after) or (Time.now > max_wait)
end
if GameObj.right_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
open_box.call(GameObj.right_hand)
end
if GameObj.left_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
open_box.call(GameObj.left_hand)
end
for obj in lootsack.contents
if obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
open_box.call(obj)
end
end
if disk
50.times { break if GameObj.loot.any? { |obj| obj.id == disk.id }; sleep 0.1 }
if GameObj.loot.any? { |obj| obj.id == disk.id }
if disk.contents.nil?
dothistimeout "look in ##{disk.id}", 2, /^In the|^There is nothing in there\.$/
end
for obj in disk.contents
if obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
open_box.call(obj)
end
end
end
end
fill_hands
fput "close ##{lootsack.id}" if close_lootsack
if anyone wants to help, thanks in advance
R.I.P Grandma, You Will Always Be Remembered
__________________
~Snoopy/Tune/Psycho