PDA

View Full Version : Anyone have a town locksmith script?



Drew
01-27-2010, 09:05 PM
For the wizard or lich?

Marl
01-27-2010, 09:11 PM
Echo Script Usage is .lock [box] [your container] [where to put the empty box]
put get my %1
put put my %1 on count
pause 1
put ring bell
put pay
pause 1
put get %1 from count
put open my %1
pause 1
put look in my %1
put get silver coin
pause 1
put empty my %1 in my %2
pause 1
put put %1 in %3
exit

Durgrimst
01-27-2010, 09:16 PM
This is sloppy but what I use on Teras...

PICK:
put Look in my cloak
MATCH TR trunk
MATCH CH chest
MATCH CO coffer
MATCH ST strongbox
MATCH BO box
MATCH RESTART Get what?
MATCHWAIT

TR:
PUT get my trunk
WAITFOR you remove
put put my trunk on counter
waitfor You put
put pull key
waitfor and I'll have it open
put pay 7000
waitfor Turning his attention to the
put get trunk from counter
waitfor You remove
put open my trunk
waitfor You open
put look in my trunk
put get coins from my trunk
wait 3
put empty my trunk into my cloak
wait 3
put look in my trunk
put put my trunk in crate
wait 2
goto PICK


CH:
PUT get my chest
WAITFOR you remove
put put my chest on counter
waitfor You put
put pull key
waitfor and I'll have it open
put pay 7000
waitfor Turning his attention to the
put get chest from counter
waitfor You remove
put open my chest
waitfor You open
put look in my chest
put get coins from my chest
wait 3
put empty my chest into my cloak
wait 3
put look in my chest
put put my chest in crate
wait 2
goto PICK


CO:
PUT get my coffer
WAITFOR you remove
put put my coffer on counter
waitfor You put
put pull key
waitfor and I'll have it open
put pay 7000
waitfor Turning his attention to the
put get coffer from counter
waitfor You remove
put open my coffer
waitfor You open
put look in my coffer
put get coins from my coffer
wait 3
put empty my coffer into my cloak
wait 3
put look in my coffer
put put my coffer in crate
wait 2
goto PICK


ST:
PUT get my strongbox
WAITFOR you remove
put put my strongbox on counter
waitfor You put
put pull key
waitfor and I'll have it open
put pay 7000
waitfor Turning his attention to the
put get strongbox from counter
waitfor You remove
put open my strongbox
waitfor You open
put look in my strongbox
put get coins from my strongbox
wait 3
put empty my strongbox into my cloak
wait 3
put look in my strongbox
put put my strongbox in crate
wait 2
goto PICK


BO:
PUT get my box
WAITFOR you remove
put put my box on counter
waitfor You put
put pull key
waitfor and I'll have it open
put pay 7000
waitfor Turning his attention to the
put get box from counter
waitfor You remove
put open my box
waitfor You open
put look in my box
put get coins from my box
wait 3
put empty my box into my cloak
wait 3
put look in my box
put put my box in crate
wait 2
goto PICK

RESTART:
put .pick


None:
exit

Bobmuhthol
01-27-2010, 09:19 PM
I wrote a relatively advanced one for JSE a while back but like every other fantastic automated script I wrote it got lost in a hard drive crash. :(

Sam
01-27-2010, 09:23 PM
here's what i use for larton once in a while.. obviously needs some customizations, but it works well.. hangs once in a while when I gather a bunch of coins.. needs more waits probably.



goto trydisk

trydisk:
SETVARIABLE mycontainer brute disk
SETVARIABLE mystep trydisk

match gotcoffer coffer
match gottrunk trunk
match gotstrong strongbox
match gotbox box
match gotchest chest
match nothing nothing in there
match nothing2 you see
match nothing2 could not find
put look in %mycontainer
MATCHWAIT

trycloak:
SETVARIABLE mycontainer my cloak
SETVARIABLE mystep trycloak
match gotcoffer coffer
match gottrunk trunk
match gotstrong strongbox
match gotbox box
match gotchest chest
match nothing3 nothing in there
match nothing4 you see
put look in %mycontainer
MATCHWAIT

trybackpack:
SETVARIABLE mycontainer my backpack
SETVARIABLE mystep trybackpack
match gotcoffer coffer
match gottrunk trunk
match gotstrong strongbox
match gotbox box
match gotchest chest
match nothing5 nothing in there
match nothing6 you see
put look in %mycontainer
MATCHWAIT

gotcoffer:
SETVARIABLE boxtype coffer
goto doBox

gottrunk:
SETVARIABLE boxtype trunk
goto doBox

gotstrong:
SETVARIABLE boxtype strongbox
goto doBox

gotbox:
SETVARIABLE boxtype box
goto doBox

gotchest:
SETVARIABLE boxtype chest
goto doBox

nothing:
goto trycloak

nothing2:
goto trycloak

nothing3:
goto finished

nothing4:
goto finished

nothing5:
goto finished

nothing6:
goto finished

doBox:
put get %boxtype from %mycontainer
put put my %boxtype on counter
wait
put ring bell
put pay
wait
put get %boxtype from counter
put open my %boxtype
wait
put get coins
waitfor You gather
put empty my %boxtype into my cloak
waitfor You try to empty
put put my %boxtype in casket
waitfor you place a
goto %mystep

nothing3:
goto finished

nothing4:
goto finished


finished:
echo **************************
echo ***ALL DONE WITH BOXES****
echo **************************

pabstblueribbon
01-27-2010, 09:23 PM
Work in progress. Use at own risk. Send me bugs. Project started by Annelie, with some of my help. Final version will be on the repository eventually. You can start it anywhere and it works everywhere, I think. Anyways, here it is.


=begin

comment!

=end


boxitems=["box", "strongbox", "chest", "coffer", "trunk"]

result = dothistimeout "look in my #{Lich.lootsack}", 5, /In the .*? you see/

contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)

exit if contents.empty?


start_script 'go2', [ 'bank' ]
wait_while{running?( 'go2' )}
fput "withdraw 5000 silvers"

sleep 1
start_script 'go2', [ 'locksmith']
wait_while{running?('go2')}

if Room.current.id == 1881
cmd = "pull keys"
elsif Room.current.id == 12282
cmd = "ring chime"
else
cmd = "ring bell"
end

#9491=nothing, 5724=wastebarrel, 5612=casket, 4024=barrel, 10434=barrel, 2425=barrel 4663=coffer

room = Room.current.id
if room == 1881 or room ==12282 then trashcan = "crate"
elsif room == 5724 then trashcan = "wastebarrel"
elsif room == 5612 then trashcan = "casket"
elsif room == 4663 then trashcan = "coffer"
elsif room == 4024 or room == 10434 or room == 2425 then trashcan = "barrel"
else;echo "I dont know where the fuck you are!";exit
end

if room == 12282 then workspace = "table" else workspace = "counter"
end


contents.each { |box|
fput "take my #{box} from my #{Lich.lootsack}"
fput "put my #{box} on #{workspace}"
result = dothis cmd, /Gimme \d+ silvers/
amount = /Gimme (\d+) silvers/.match(result).captures.first
fput "pay #{amount}"
fput "get #{box} from #{workspace}"
fput "open my #{box}"
fput "get coins from my #{box}"
fput "empty my #{box} in my #{Lich.lootsack}"
result = dothis "look in my #{box}", /There is nothing in there|In the .* you see/
if result =~ /There is nothing in there/
if room == 9491
fput "drop #{box}"
echo "Make sure to clean this up!"
else
fput "put #{box} in #{trashcan}"
end
else
respond 'Box not empty!'
exit
end
}

pabstblueribbon
01-27-2010, 10:22 PM
I added a routine to check for disks and get all of those boxes picked too. However I had to separate everything into definitions and there might be some issues with accessing variables. I need someone who has some boxes to test this out for me...



=begin

comment!

=end

def get_money
start_script 'go2', [ 'bank' ]
wait_while{running?( 'go2' )}
fput "withdraw 8000 silvers"
end

def find_locksmith
start_script 'go2', [ 'locksmith']
wait_while{running?('go2')}
end

def set_cmd
if Room.current.id == 1881
$cmd = "pull keys"
elsif Room.current.id == 12282
$cmd = "ring chime"
else
$cmd = "ring bell"
end
end


#9491=nothing, 5724=wastebarrel, 5612=casket, 4024=barrel, 10434=barrel, 2425=barrel 4663=coffer
def set_trashcan
room = Room.current.id
if room == 1881 or room ==12282 then $trashcan = "crate"
elsif room == 5724 then $trashcan = "wastebarrel"
elsif room == 5612 then $trashcan = "casket"
elsif room == 4663 then $trashcan = "coffer"
elsif room == 4024 or room == 10434 or room == 2425 then $trashcan = "barrel"
else;echo "I dont know where the fuck you are!";exit
end

if room == 12282 then $workspace = "table" else $workspace = "counter"
end
end


def box_pick

$contents.each { |box|
fput "get #{box} from #{$container}"
fput "put my #{box} on #{$workspace}"
result = dothis $cmd, /Gimme \d+ silvers/
amount = /Gimme (\d+) silvers/.match(result).captures.first
fput "pay #{amount}"
fput "get #{box} from #{$workspace}"
fput "open my #{box}"
fput "get coins from my #{box}"
fput "empty my #{box} in my #{Lich.lootsack}"
result = dothis "look in my #{box}", /There is nothing in there|In the .* you see/
if result =~ /There is nothing in there/
if room == 9491
fput "drop #{box}"
echo "Make sure to clean this up!"
else
fput "put #{box} in #{$trashcan}"
end
else
respond 'Box not empty!'
exit
end
}
end

boxitems=["box", "strongbox", "chest", "coffer", "trunk"]

if GameObj.loot.any? { |obj| obj.noun == 'disk' and obj.name =~ /#{checkname}/ }
result = dothistimeout "look in #{checkname} disk", 5, /In the .*? you see|There is nothing in there/
if result !~ /There is nothing in there/
$contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
echo "Disk: #{$contents}"
$container = "#{checkname} disk"
get_money
find_locksmith
set_cmd
set_trashcan
wait_until { GameObj.loot.any? { |obj| obj.noun == 'disk' and obj.name =~ /#{checkname}/} == true}
box_pick

end
end

result = dothistimeout "look in my #{Lich.lootsack}", 5, /In the .*? you see|There is nothing in there/
if result !~ /There is nothing in there/
$contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
echo "Lootsack: #{$contents}"
$container = "my #{Lich.lootsack}"
get_money
find_locksmith
set_cmd
set_trashcan
box_pick
end

exit

pabstblueribbon
01-28-2010, 12:35 AM
Updated.

Drew
01-28-2010, 12:40 AM
I've trusted the script:


;box
--- Lich: box active.
[box]>look in Kanyda disk
>In the Kanyda disk you see the following:
2 Box: an iron-bound modwir strongbox and a battered silver strongbox.
>
--- Exception: undefined local variable or method `contents' for main:Object
box:78:in `block in start_script'
--- Lich: box has exited



>l
[Ta'Vaalor, Tyrnian Court]
A small cluster of trees stands near the edge of the court, providing a shady spot and a chance for a brief respite from the bustle of the city. Several elven guards stand beneath a nearby tree, chatting quietly amongst themselves as they scan the crowded court. You also see the purple Kanyda disk, a darkly stained wooden bench with some stuff on it and a wooden barrel.
Also here: Squire Legionnaire Kogona, Vorbius who is sitting, Squire Legionnaire Driock
Obvious paths: north, east, south, west
>


EDIT: I tried starting it in the bank and at the locksmith and same problem.

pabstblueribbon
01-28-2010, 12:51 AM
Updated again

Cephalopod
01-28-2010, 12:55 AM
[Ta'Vaalor, Tyrnian Court]


I spotted the problem.

Drew
01-28-2010, 01:00 AM
I spotted the problem.

LOL yeah.

Danical
01-28-2010, 01:12 AM
125

Flessen
01-28-2010, 11:12 AM
I added a routine to check for disks and get all of those boxes picked too. However I had to separate everything into definitions and there might be some issues with accessing variables. I need someone who has some boxes to test this out for me...




[box]>empty my chest in my backpack
You try to empty the contents of your chest into your backpack, and everything falls in quite nicely.
Roundtime: 3 sec.
R>
[box]>look in my chest
There is nothing in there.
R>
box:61:in `box_pick'
--- Lich: box has exited.
R>


=begin

comment!

=end

def get_money
start_script 'go2', [ 'bank' ]
wait_while{running?( 'go2' )}
fput "withdraw 8000 silvers"
end

def find_locksmith
start_script 'go2', [ 'locksmith']
wait_while{running?('go2')}
end

def set_cmd
if Room.current.id == 1881
$cmd = "pull keys"
elsif Room.current.id == 12282
$cmd = "ring chime"
else
$cmd = "ring bell"
end
end


#9491=nothing, 5724=wastebarrel, 5612=casket, 4024=barrel, 10434=barrel, 2425=barrel 4663=coffer
def set_trashcan
room = Room.current.id
if room == 1881 or room ==12282 then $trashcan = "crate"
elsif room == 5724 then $trashcan = "wastebarrel"
elsif room == 5612 then $trashcan = "casket"
elsif room == 4663 then $trashcan = "coffer"
elsif room == 4024 or room == 10434 or room == 2425 then $trashcan = "barrel"
else;echo "I dont know where the fuck you are!";exit
end

if room == 12282 then $workspace = "table" else $workspace = "counter"
end
end


def box_pick

$contents.each { |box|
fput "get #{box} from #{$container}"
fput "put my #{box} on #{$workspace}"
result = dothis $cmd, /Gimme \d+ silvers/
amount = /Gimme (\d+) silvers/.match(result).captures.first
fput "pay #{amount}"
fput "get #{box} from #{$workspace}"
fput "open my #{box}"
fput "get coins from my #{box}"
fput "empty my #{box} in my #{Lich.lootsack}"
result = dothis "look in my #{box}", /There is nothing in there|In the .* you see/
if result =~ /There is nothing in there/

fput "put #{box} in ##{GameObj.loot.find{|trash| trash.noun =~ /barrel|casket|wastebarrel|crate|coffer|well/}.id}"
else
respond 'Box not empty!'
exit
end
}
end

boxitems=["box", "strongbox", "chest", "coffer", "trunk"]
starting_room_id = Room.current.id
if GameObj.loot.any? { |obj| obj.noun == 'disk' and obj.name =~ /#{checkname}/ }
result = dothistimeout "look in #{checkname} disk", 5, /In the .*? you see|box|strongbox|chest|coffer|trunk/
if result =~ /box|strongbox|chest|coffer|trunk/
$contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
echo "Disk: #{$contents}"
$container = "#{checkname} disk"
get_money
find_locksmith
set_cmd
set_trashcan
wait_until { GameObj.loot.any? { |obj| obj.noun == 'disk' and obj.name =~ /#{checkname}/} == true}
box_pick
result = dothistimeout "look in my #{Lich.lootsack}", 5, /In the .*? you see|box|strongbox|chest|coffer|trunk/
if result =~ /box|strongbox|chest|coffer|trunk/
$contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
echo "Lootsack: #{$contents}"
$container = "my #{Lich.lootsack}"
set_cmd
set_trashcan
box_pick
end
start_script("go2", [ starting_room_id, '_disable_confirm_' ])
wait_while { running?("go2")}
exit
end
end

result = dothistimeout "look in my #{Lich.lootsack}", 5, /In the .*? you see|box|strongbox|chest|coffer|trunk/
if result =~ /box|strongbox|chest|coffer|trunk/
$contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
echo "Lootsack: #{$contents}"
$container = "my #{Lich.lootsack}"
get_money
find_locksmith
set_cmd
set_trashcan
box_pick
start_script("go2", [ starting_room_id, '_disable_confirm_' ])
wait_while { running?("go2")}
end

exit

This is my fix with some extra in there.

Anne
01-28-2010, 03:02 PM
Work in progress. Use at own risk. Send me bugs. Project started by Annelie, with some of my help. Final version will be on the repository eventually. You can start it anywhere and it works everywhere, I think. Anyways, here it is.



For the record, I don't have a thing to do with this script other than starting it and having someone else do the work.

:club:

pabstblueribbon
01-28-2010, 04:11 PM
Yeah I found that too..

Here's the fix PLUS it will make sure no one is in the room before trying to use the locksmith. I need to add a timeout though since it will simply wait until no one is there currently. So.. dont use it afk. Also it will now scan the 'workspace' and make sure some dipstick hasnt left their box on the counter before trying to get your own boxes done.


=begin

comment!

=end

# List group members here.
$group = []

def get_money
start_script 'go2', [ 'bank' ]
wait_while{running?( 'go2' )}
fput "withdraw 8000 silvers"
end

def find_locksmith
start_script 'go2', [ 'locksmith']
wait_while{running?('go2')}
end

def set_cmd
if Room.current.id == 1881
$cmd = "pull keys"
elsif Room.current.id == 12282
$cmd = "ring chime"
else
$cmd = "ring bell"
end
end


#9491=nothing, 5724=wastebarrel, 5612=casket, 4024=barrel, 10434=barrel, 2425=barrel 4663=coffer
def set_trashcan
$room = Room.current.id
if $room == 1881 or $room ==12282 then $trashcan = "crate"
elsif $room == 5724 then $trashcan = "wastebarrel"
elsif $room == 5612 then $trashcan = "casket"
elsif $room == 4663 then $trashcan = "coffer"
elsif $room == 4024 or $room == 10434 or room == 2425 then $trashcan = "barrel"
else;echo "I dont know where the fuck you are!";exit
end

if $room == 12282 then $workspace = "table" else $workspace = "counter"
end
end

def scan_counter
result = dothistimeout "look on #{$workspace}", 5, /On the .* you see|There is nothing on there/
if result !~ /There is nothing on there/
contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
contents.each { |box|
fput "get #{box} from #{$workspace}"
if $room != 9491
fput "drop #{box}"
else
set_trashcan
fput "put #{box} in #{$trashcan}"
end
}
end
end


def box_pick

$contents.each { |box|
wait_until { (checkpcs.to_a - ["#{$group}"]).empty? == true) }
scan_counter
fput "get #{box} from #{$container}"
fput "put my #{box} on #{$workspace}"
result = dothis $cmd, /Gimme \d+ silvers/
amount = /Gimme (\d+) silvers/.match(result).captures.first
fput "pay #{amount}"
fput "get #{box} from #{$workspace}"
fput "open my #{box}"
fput "get coins from my #{box}"
fput "empty my #{box} in my #{Lich.lootsack}"
result = dothis "look in my #{box}", /There is nothing in there|In the .* you see/
if result =~ /There is nothing in there/
if $room == 9491
fput "drop #{box}"
echo "Make sure to clean this up!"
else
fput "put #{box} in #{$trashcan}"
end
elsif result =~ /In the .* you see/
respond 'Box not empty!'
exit
end
}
end

boxitems=["box", "strongbox", "chest", "coffer", "trunk"]

if GameObj.loot.any? { |obj| obj.noun == 'disk' and obj.name =~ /#{checkname}/ }
result = dothistimeout "look in #{checkname} disk", 5, /In the .*? you see|There is nothing in there/
if result !~ /There is nothing in there/
$contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
echo "Disk: #{$contents}"
$container = "#{checkname} disk"
get_money
find_locksmith
set_cmd
set_trashcan
wait_until { GameObj.loot.any? { |obj| obj.noun == 'disk' and obj.name =~ /#{checkname}/} == true}
box_pick

end
end

result = dothistimeout "look in my #{Lich.lootsack}", 5, /In the .*? you see|There is nothing in there/
if result !~ /There is nothing in there/
$contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
echo "Lootsack: #{$contents}"
$container = "my #{Lich.lootsack}"
get_money
find_locksmith
set_cmd
set_trashcan
box_pick
end

exit

Drew
01-28-2010, 08:25 PM
[box]>get coins from my coffer
You gather the remaining 891 coins from inside your haon coffer.
Roundtime: 1 sec.
[box]>empty my coffer in my backpack
>
[box]>look in my coffer
...wait 1 seconds.

Drew
01-28-2010, 08:27 PM
It hung last time. This time it didn't but this happened:


box]>get coins from my coffer
You gather the remaining 3633 coins from inside your brass coffer.
Roundtime: 3 sec.
>
[box]>empty my coffer in my backpack
>
...wait 2 seconds.
>
[box]>empty my coffer in my backpack
You try to empty the contents of your coffer into your backpack, but nothing comes out.
>
[box]>look in my coffer
There is nothing in there.
>
--- Exception: undefined local variable or method `room' for main:Object
box:59:in `block in box_pick'
--- Lich: box has exited.

pabstblueribbon
01-28-2010, 09:18 PM
I do reckon that you did updated wit the last post mmhmm.

Drew
01-28-2010, 09:21 PM
I did, I was just thinking I wish you put version numbers in the comments so I was sure though.

pabstblueribbon
01-28-2010, 09:30 PM
Damn you and your good ideas.

Im a locomotive mechanic, not a programmer Jim!

Androidpk
01-28-2010, 09:41 PM
For the record, I don't have a thing to do with this script other than starting it and having someone else do the work.

:club:

LIES!

Flessen
01-28-2010, 10:06 PM
Couldn't you get rid of the set_trash and just do


fput "put #{box} in ##{GameObj.loot.find{|trash| trash.noun =~ /barrel|casket|wastebarrel|crate|coffer|well/}.id}"

Cut down on the lines that way.

Or course that would mean other changes


def scan_counter
result = dothistimeout "look on #{$workspace}", 5, /On the .* you see|There is nothing on there/
if result !~ /There is nothing on there/
contents = result.scan(/\b(?:#{boxitems.join('|')})(?= and an? |,|\.)/)
contents.each { |box|
fput "get #{box} from #{$workspace}"
if Room.current.id == 9491
fput "drop #{box}"
else
fput "put #{box} in ##{GameObj.loot.find{|trash| trash.noun =~ /barrel|casket|wastebarrel|crate|coffer|well/}.id}"
end
}
end
end

def box_pick
$contents.each { |box|
if Room.current.id == 12282 then $workspace = "table" else $workspace = "counter"
wait_until { (checkpcs.to_a - ["#{$group}"]).empty? == true) }
fput "get #{box} from #{$container}"
fput "put my #{box} on #{$workspace}"
result = dothis $cmd, /Gimme \d+ silvers/
amount = /Gimme (\d+) silvers/.match(result).captures.first
fput "pay #{amount}"
fput "get #{box} from #{$workspace}"
fput "open my #{box}"
fput "get coins from my #{box}"
waitrt?
fput "empty my #{box} in my #{Lich.lootsack}"
result = dothis "look in my #{box}", /There is nothing in there|In the .* you see/
if result =~ /There is nothing in there/
if Room.current.id == 9491
fput "drop #{box}"
respond("You will need to clean this up")
else
fput "put #{box} in ##{GameObj.loot.find{|trash| trash.noun =~ /barrel|casket|wastebarrel|crate|coffer|well/}.id}"
end
else
respond 'Box not empty!'
exit
end
}
end

Drew
02-01-2010, 01:32 AM
Is this the latest version of the script PBR? I'm getting this error now, maybe it's just my lich that's messed up:


;box
--- Lich: box active.
--- SyntaxError: box:67: syntax error, unexpected ')', expecting '}'
wait_until { (checkpcs.to_a - ["#{$group}"]).empty? == true) }
^
box:91: syntax error, unexpected keyword_end, expecting '}'
box:123: syntax error, unexpected $end, expecting '}'
C:/Users/DellPCDec2008/Documents/Lich/lich.rb:4099:in `eval'
--- Lich: cannot execute box, aborting.
--- Lich: box has exited.