dott
04-14-2012, 09:00 AM
Figure I'd post this since I'm not competing this go-around, and honestly it's not like the script gives much of an edge anyway, as evidenced by me not winning any of my runs. Still, it was fun to write. Feedback is welcome.
Forgive the weird indentation, one of my text editors added tab characters in place of spaces in some cases for some reason, and I can't be fucked to figure out which right now.
-mark
#droughtmans.lic
#by mark (dott@PC)
#
#Usage: activate it, then run around manually. It should automatically grab keys and pull ropes.
#If it fucks up for some reason, kill it and restart it. It'll check your backpack for keys and
#remember what keys you've got.
#
#It may work in conjunction with randomized movement scripts. This is untested, if you try and
#it goes well let me know.
#
#Commands: door - opens whatever door is in the room and goes through (NOTE: if you enter the room with the
# white door while you have the gold key, it SHOULD automatically unlock it and go through.
# This isn't tested by me, as I never won the game. Set up a macro for that just in case.)
# keys - prints out a list of keys you currently have. If it works. I can't remember using it.
# wand - waves your wand at anyone in your targets list. NOTE: targets list is lost every time
# the script is restarted, which you'll probably have to do, so this functionality sucks.
# target (player) - Adds (player) to your target list. Probably case sensitive, don't remember or care.
# As stated before, target list will be lost every time you restart. Except for
# Derp. Who probably doesn't exist. He's there for testing and because I'm lazy.
#
# NOTE: The target and wand commands were added because I was having fun coding. They're pretty crap in
# practice, as it's kinda silly to use the wand as a runner.
#
# DISCLAIMER: This script was made and used twice by myself, in the first run of Droughtman's.
# It may be useless in subsequent runs.
# It may make you lose.
# It's my only lich script with anything resembling complexity.
# Set up macros so you can use them if this script is not satisfactory.
# Don't whine to me that it sucks. Your mileage may vary.
before_dying { UpstreamHook.remove('droughtmans'); }
$keys = { 'pale' => 0, 'yellow' => 0, 'blue' => 0, 'green' => 0, 'red' => 0, 'gold' => 0 }
$targetlist = %w$Derp$
$dooropen = 0
def get_color(object)
objdesc = object.name
if objdesc =~ /^.*(brown|yellow|red|blue|green|golden|white|pale) .*/
$1
else
'no'
end
end
def print_keys
$keys.each { |color, quantity| echo "#{color}: #{quantity}" }
$targetlist.each { |thistarget| echo "#{thistarget}" }
end
def open_door
door = GameObj.loot.find { |loot| loot.noun == 'archway' }
if door == nil
echo "ONOES DIDN'T FIND THE DOOR"
end
doorcolor = get_color(door)
keycolor = doorcolor
if doorcolor == 'white'
keycolor = 'golden'
unless Wounds.rhand == 3 or Wounds.rarm == 3
empty_right_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_right_hand
else
empty_left_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_right_hand
end
end
put "go ##{door.id}"
what_happened = waitfor "appears to be closed", "[Droughtman's Maze]", "blibityboo"
if what_happened == "appears to be closed"
unless Wounds.rhand == 3 or Wounds.rarm == 3
empty_right_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_right_hand
else
empty_left_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_left_hand
end
end
$keys[keycolor] -=1
end
def wand_wave
waved = 0
targets = GameObj.pcs
targets.each { |pc|
$targetlist.each { |targetpc|
if pc.name.casecmp targetpc
fput "wave my wand at ##{pc.id}"
targetlist.rotate!
waved = 1
end
}
}
if waved == 0
mytarget = targets.shift
fput "wave my wand at ##{mytarget.id}"
end
nil
end
fput "stow set backpack"
backpack = GameObj.inv.find { |loot| loot.noun = 'backpack' }
fput "look in my backpack"
for item in backpack.contents do
if item.noun == 'key'
col = get_color(item)
$keys[col] += 1
print_keys
end
end
toggle_upstream
action = proc { |client_string|
if client_string =~ /^.*\!door$/
echo "caught a !door"
$dooropen = 1;
nil
elsif client_string =~ /^.*\!keys$/
echo "caught a !keys"
print_keys
nil
elsif client_string =~ /^.*\!wand$/
echo "caught a !wand"
wand_wave
nil
elsif client_string =~ /^.*\!target (\w+)$/
echo "Targetting #{$1}!"
$targetlist << $1
nil
else
client_string
end
}
UpstreamHook.add('droughtmans', action)
loop{
waitrt?
wait_while {muckled? == true}
rope = GameObj.loot.find { |loot| loot.noun == 'rope'}
if rope
if $keys['gold'] == 0
fput "pull rope"
end
end
key = GameObj.loot.find { |loot| loot.noun == 'key'}
if key
unless Wounds.rhand == 3 or Wounds.rarm == 3
empty_right_hand
multifput "get ##{key.id}", "put ##{key.id} in my backpack"
fill_right_hand
else
empty_left_hand
multifput "get ##{key.id}", "put ##{key.id} in my backpack"
fill_left_hand
end
$keys[get_color(key.name)] += 1
end
mydoor = GameObj.loot.find { |loot| loot.noun == 'door' }
mydoorcolor = get_color(mydoor)
if mydoorcolor == 'white'
empty_left_hand
multifput "get golden key", "unlock ##{mydoor.id} with my key", "go ##{mydoor.id}"
end
if $dooropen == 1
echo "Opening door!"
open_door
$dooropen = 0
end
sleep 0.1
}
Forgive the weird indentation, one of my text editors added tab characters in place of spaces in some cases for some reason, and I can't be fucked to figure out which right now.
-mark
#droughtmans.lic
#by mark (dott@PC)
#
#Usage: activate it, then run around manually. It should automatically grab keys and pull ropes.
#If it fucks up for some reason, kill it and restart it. It'll check your backpack for keys and
#remember what keys you've got.
#
#It may work in conjunction with randomized movement scripts. This is untested, if you try and
#it goes well let me know.
#
#Commands: door - opens whatever door is in the room and goes through (NOTE: if you enter the room with the
# white door while you have the gold key, it SHOULD automatically unlock it and go through.
# This isn't tested by me, as I never won the game. Set up a macro for that just in case.)
# keys - prints out a list of keys you currently have. If it works. I can't remember using it.
# wand - waves your wand at anyone in your targets list. NOTE: targets list is lost every time
# the script is restarted, which you'll probably have to do, so this functionality sucks.
# target (player) - Adds (player) to your target list. Probably case sensitive, don't remember or care.
# As stated before, target list will be lost every time you restart. Except for
# Derp. Who probably doesn't exist. He's there for testing and because I'm lazy.
#
# NOTE: The target and wand commands were added because I was having fun coding. They're pretty crap in
# practice, as it's kinda silly to use the wand as a runner.
#
# DISCLAIMER: This script was made and used twice by myself, in the first run of Droughtman's.
# It may be useless in subsequent runs.
# It may make you lose.
# It's my only lich script with anything resembling complexity.
# Set up macros so you can use them if this script is not satisfactory.
# Don't whine to me that it sucks. Your mileage may vary.
before_dying { UpstreamHook.remove('droughtmans'); }
$keys = { 'pale' => 0, 'yellow' => 0, 'blue' => 0, 'green' => 0, 'red' => 0, 'gold' => 0 }
$targetlist = %w$Derp$
$dooropen = 0
def get_color(object)
objdesc = object.name
if objdesc =~ /^.*(brown|yellow|red|blue|green|golden|white|pale) .*/
$1
else
'no'
end
end
def print_keys
$keys.each { |color, quantity| echo "#{color}: #{quantity}" }
$targetlist.each { |thistarget| echo "#{thistarget}" }
end
def open_door
door = GameObj.loot.find { |loot| loot.noun == 'archway' }
if door == nil
echo "ONOES DIDN'T FIND THE DOOR"
end
doorcolor = get_color(door)
keycolor = doorcolor
if doorcolor == 'white'
keycolor = 'golden'
unless Wounds.rhand == 3 or Wounds.rarm == 3
empty_right_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_right_hand
else
empty_left_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_right_hand
end
end
put "go ##{door.id}"
what_happened = waitfor "appears to be closed", "[Droughtman's Maze]", "blibityboo"
if what_happened == "appears to be closed"
unless Wounds.rhand == 3 or Wounds.rarm == 3
empty_right_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_right_hand
else
empty_left_hand
multifput "get #{keycolor} key", "unlock ##{door.id} with my key", "go ##{door.id}"
fill_left_hand
end
end
$keys[keycolor] -=1
end
def wand_wave
waved = 0
targets = GameObj.pcs
targets.each { |pc|
$targetlist.each { |targetpc|
if pc.name.casecmp targetpc
fput "wave my wand at ##{pc.id}"
targetlist.rotate!
waved = 1
end
}
}
if waved == 0
mytarget = targets.shift
fput "wave my wand at ##{mytarget.id}"
end
nil
end
fput "stow set backpack"
backpack = GameObj.inv.find { |loot| loot.noun = 'backpack' }
fput "look in my backpack"
for item in backpack.contents do
if item.noun == 'key'
col = get_color(item)
$keys[col] += 1
print_keys
end
end
toggle_upstream
action = proc { |client_string|
if client_string =~ /^.*\!door$/
echo "caught a !door"
$dooropen = 1;
nil
elsif client_string =~ /^.*\!keys$/
echo "caught a !keys"
print_keys
nil
elsif client_string =~ /^.*\!wand$/
echo "caught a !wand"
wand_wave
nil
elsif client_string =~ /^.*\!target (\w+)$/
echo "Targetting #{$1}!"
$targetlist << $1
nil
else
client_string
end
}
UpstreamHook.add('droughtmans', action)
loop{
waitrt?
wait_while {muckled? == true}
rope = GameObj.loot.find { |loot| loot.noun == 'rope'}
if rope
if $keys['gold'] == 0
fput "pull rope"
end
end
key = GameObj.loot.find { |loot| loot.noun == 'key'}
if key
unless Wounds.rhand == 3 or Wounds.rarm == 3
empty_right_hand
multifput "get ##{key.id}", "put ##{key.id} in my backpack"
fill_right_hand
else
empty_left_hand
multifput "get ##{key.id}", "put ##{key.id} in my backpack"
fill_left_hand
end
$keys[get_color(key.name)] += 1
end
mydoor = GameObj.loot.find { |loot| loot.noun == 'door' }
mydoorcolor = get_color(mydoor)
if mydoorcolor == 'white'
empty_left_hand
multifput "get golden key", "unlock ##{mydoor.id} with my key", "go ##{mydoor.id}"
end
if $dooropen == 1
echo "Opening door!"
open_door
$dooropen = 0
end
sleep 0.1
}