Renian
03-18-2008, 05:17 AM
So despite the fact that I had a reliable safeguard (at least, it's reliable in SF), my script's trying to poach dudes every so often.
[huntotf2]>north
>
[Old Ta'Faendryl, Basilica Plaza]
To the east a series of wide stone steps lead up the side of a pyramid. A palatial building awaits at the top of the stairs, towering above the ruins of the surrounding city. In the river to the west, partially submerged in the water, can be seen a carved obsidian statue fashioned in the image of a massive warrior. The tip of a thick obsidian spear rests among the bulrush growing along the edge of the river bank. You also see a war griffin that is flying around, some silver coins and a twisted crystal-tipped staff.
Also here: Great Lord Wecodean
Obvious paths: north, south
[huntotf2]>aim right eye
>
A wrathful crevasse spirit floats in, following Wecodean.
[huntotf2]>stance offensive
>
You're now aiming at the right eye of your target when using a ranged weapon, or while ambushing.
>
You are now in an offensive stance.
[huntotf2]>get 1 arrow from my backpack
>
Wecodean chants a reverent litany and clasps his hands while tightly focusing his thoughts...
Wecodean gestures at a war griffin.
A single dim, crystal green globe springs to life in Wecodean's left hand. The globe leaps from Wecodean's left hand and dances through the air toward a war griffin!
CS: +503 - TD: +403 + CvA: +25 + d100: +91 == +216
Warding failed!
The orb squarely impacts a war griffin, discharging the crystal green energy over its entire being for 85 points of damage!
The crystal green energy pulses for an additional 59 points of damage ...
The war griffin crashes to the ground, motionless.
... the remaining energy dissipates harmlessly from the griffin's corpse.
>
You remove a single arrow from a bundle of arrows.
[huntotf2]>fire griffin
>
A war griffin is quite dead already.
[huntotf2]>put my arrow in my arrows in my backpack
>
You add an arrow to your bundle.
[huntotf2]>loot
>
Here's the script. The problem likely lies in the huntotf2 subroutine. I made the script into a class because I'm probably going to optimize it so it's good by programming standards.
$i = 0
$return = false
class Huntotf
def initialize
end
load "scripts/lootfunc.lic"
def tablecheck
if checkroom =~ /Table/i
move "out"
move "out"
tootf()
end
if checkroom =~ /[Ta'Faendryl Approach]/i
bounty()
huntotf()
end
end
def tootf
fput "ready weapon"
fput "tootf"
matchwait "Cannot follow"
fput "go water"
fput "swim east"
sleep 6
signs()
bounty()
fput "tootf"
matchwait "Reached destination"
huntotf()
end
def fromotf
fput "tavern"
matchwait "Cannot follow"
fput "go water"
fput "swim west"
sleep 6
fput "tavern"
matchwait "Reached destination"
move "go tavern"
fput "go tiad table"
fput "go tiad table"
fput "tap tiad"
unbox()
exit
end
def bounty
fput "bounty"
bountycheck = matchtimeout 3, "ithzir adept", "ithzir janissary", "ithzir seer", "ithzir initiate", "war griffin"
if bountycheck =~ /ithzir adept/i
$bounty = true
$bountytarget = "adept"
elsif bountycheck =~ /ithzir janissary/i
$bounty = true
$bountytarget = "janissary"
elsif bountycheck =~ /ithzir seer/i
$bounty = true
$bountytarget = "seer"
elsif bountycheck =~ /ithzir initiate/i
$bounty = true
$bountytarget = "initiate"
elsif bountycheck =~ /war griffin/i
$bounty = true
$bountytarget = "griffin"
else
$bounty = false
end
end
def signs
fput "sign of swords"
matchtimeout 1, "repeating the sign", "renewed vigor"
fput "sign of smiting"
matchtimeout 1, "repeating the sign", "renewed vigor"
fput "sign of striking"
matchtimeout 1, "repeating the sign", "renewed vigor"
fput "sign of shields"
matchtimeout 1, "repeating the sign", "web of protection"
fput "sign of defending"
matchtimeout 1, "repeating the sign", "web of protection"
fput "sign of warding"
matchtimeout 1, "repeating the sign", "web of protection"
fput "sign of staunching"
matchtimeout 1, "veins throb"
fput "sign of dissipation"
sleep 1
fput "sign of deflection"
sleep 1
end
def arrowmobs
fput "aim right eye"
aim = "right"
target_line = "null"
fighting = false
if checknpcs.length >= 1 && $target =~ /adept|griffin|initiate|seer|janissary/i && $invalidmob == false && checknpcs.length <= 2 && $return == false && percenthealth > 70
fighting = true
end
while checknpcs.length >= 1 && $target =~ /adept|griffin|initiate|seer|janissary/i && $invalidmob == false && checknpcs.length <= 2 && $return == false && percenthealth > 70
if stance != "offensive"
fput "stance offensive"
matchtimeout 2, "You are now in an offensive stance"
end
arrowcheck()
fput "fire " + $target
target_line = matchtimeout 2, "dies", "But it is dead!", "You are still stunned",
"Sorry, you can only have", "You have completed this portion", "Roundtime",
"falls prone to the ground, twitches one last time and dies." , "What were you referring to?",
"is already dead", "quite dead already", "leaving you firing at nothingness", "I could not find", "You cannot fire a bundle of arrows",
"crashes to the ground, motionless", "falls to the ground in a crumpled heap", "falls, the life fading from",
"vainly struggles to rise, then goes still.", "then collapses.", "You are too injured to fire that"
if target_line =~ /Roundtime/i
sleep 2
waitrt?
end
if target_line =~ /dies|But it is dead!|You have completed this portion of your|vainly struggles to rise, then goes still.|falls prone to the ground, twitches one last time and dies.|is already dead|quite dead already|crashes to the ground, motionless|falls to the ground in a crumpled heap|falls, the life fading from|then collapses./i
if target_line =~ /is already dead|quite dead already/
fput "put my arrow in my arrows in my backpack"
arrowd = matchtimeout 2, "I could not find", "You bundle", "You add an arrow"
if arrowd =~ /I could not find/
fput "put my arrow in my backpack"
end
end
waitrt?
loot()
gather()
if target_line =~ /You have completed this portion of your/i
$bounty = false
end
checkmobs()
end
if target_line =~ /You cannot fire a bundle of arrows/
fput "put my arrows in my backpack"
end
if target_line =~ /What were you referring to?|leaving you firing at nothingness|I could not find/i
gather()
$invalidmob = true
end
if target_line =~ /You are too injured to fire that/i
gather()
$return = true
fromotf()
end
while standing? == false
sleep 1
if stance != "defensive"
fput "stance defensive"
matchtimeout 2, "You are now in a defensive stance", "You are still stunned", "...wait"
end
fput "stand"
matchtimeout 2, "You stand back up", "You are still stunned", "You struggle", "...wait"
end
if aim == "right"
fput "aim left eye"
aim = "left"
else
fput "aim right eye"
aim = "right"
end
end
if fighting == true
gather()
end
end
def arrowcheck
fput "get 1 arrow from my backpack"
target_line = matchtimeout 2, "You remove", "light fades", "Get what?"
if target_line =~ /light fades/
fput "drop my arrow"
$return = true
fromotf()
end
if target_line =~ /Get what?/
fput "get my arrows from my cloak"
target_line = matchtimeout 2, "You remove", "Get what?"
if target_line =~ /You remove/
fput "put my arrows in my backpack"
arrowcheck()
else
$return = true
fromotf()
end
end
end
def gather
if stance != "defensive"
fput "stance defensive"
matchtimeout 1, "defensive stance"
end
fput "gather arrow"
target_line = matchtimeout 2, "You may only gather", "You pick up the arrow", "You gather", "You see nothing identical enough to the arrow to bundle with it"
if target_line =~ /You pick up the arrow|You gather|You see nothing identical enough to the arrow to bundle with it/
fput "put my arrow in my arrows in my backpack"
target_line = "I could not find", "You bundle some arrows together", "You cannot bundle", "You add an arrow"
if target_line =~ /I could not find/
fput "put my arrows in my backpack"
end
if target_line =~ /You cannot bundle/
fput "drop my arrow"
end
end
end
def huntotf
$i = 0
$movearray = [ne, ne, ne, n, n, n, n, e, e, e, e, ne, ne, ne, ne, n, sw, e, n, nw, w, w, e, s, s, s, se, w, w, sw, s, w, w, n, n, n, n, "go steps",
n, "go spear", w, w, w, "go foot", s, w, sw, ne, e, n, w, w, w, w, w, e, e, e, e, e, n, nw, n, ne, e, s, s, s, "go foot", e, e, e, "go spear",
n, n, e, e, e, s, ne, se, s, sw, nw, s, w, w, w, "go steps", s, s, s, s, s, s, s, s, sw, sw, sw]
while checkmind != "fried" && percenthealth >= 50 && $return == false
$invalidmob = false
move $movearray[$i]
$i = $i + 1
if $i == $movearray.length
$i = 0
end
matchtimeout 2, "Obvious paths", "Obvious exits"
checknpcs.length >= 1 && checknpcs.length <= 2 && !(checkpcs.length > 0) && checkmind != "must rest" && $invalidmob == false && $return == false
checkmobs()
if $invalidmob == false && $target != "none"
arrowmobs()
#echo "Target acquired."
#echo "Unpause the script to continue"
#pause_script "huntotf"
end
end
fromotf()
end
def checkmobs
#echo "checking mobs"
$target = "none"
$invalidmob = false
checknpcs.each do |mob|
if (mob == "griffin" || mob == "seer" || mob == "initiate" || mob == "adept" || mob == "janissary") && $target == "none" #&& $bounty == false
$target = mob
#echo "target is now " + mob
elsif (mob == $bountytarget && $bounty == true)
$target = mob
#echo "Bounty target sighted. Target is now " + mob
end
if (mob != "griffin" && mob != "seer" && mob != "initiate" && mob != "adept" && mob != "janissary") && checknpcs.length >= 1 #&& $bounty == false
$invalidmob = true
#echo "Invalid target found"
elsif (mob != $bountytarget && $bounty == true)
$invalidmob = true
#echo "Invalid target found"
end
end
#echo "mobcheck complete"
end
end
Huntotf.new.tablecheck()
[huntotf2]>north
>
[Old Ta'Faendryl, Basilica Plaza]
To the east a series of wide stone steps lead up the side of a pyramid. A palatial building awaits at the top of the stairs, towering above the ruins of the surrounding city. In the river to the west, partially submerged in the water, can be seen a carved obsidian statue fashioned in the image of a massive warrior. The tip of a thick obsidian spear rests among the bulrush growing along the edge of the river bank. You also see a war griffin that is flying around, some silver coins and a twisted crystal-tipped staff.
Also here: Great Lord Wecodean
Obvious paths: north, south
[huntotf2]>aim right eye
>
A wrathful crevasse spirit floats in, following Wecodean.
[huntotf2]>stance offensive
>
You're now aiming at the right eye of your target when using a ranged weapon, or while ambushing.
>
You are now in an offensive stance.
[huntotf2]>get 1 arrow from my backpack
>
Wecodean chants a reverent litany and clasps his hands while tightly focusing his thoughts...
Wecodean gestures at a war griffin.
A single dim, crystal green globe springs to life in Wecodean's left hand. The globe leaps from Wecodean's left hand and dances through the air toward a war griffin!
CS: +503 - TD: +403 + CvA: +25 + d100: +91 == +216
Warding failed!
The orb squarely impacts a war griffin, discharging the crystal green energy over its entire being for 85 points of damage!
The crystal green energy pulses for an additional 59 points of damage ...
The war griffin crashes to the ground, motionless.
... the remaining energy dissipates harmlessly from the griffin's corpse.
>
You remove a single arrow from a bundle of arrows.
[huntotf2]>fire griffin
>
A war griffin is quite dead already.
[huntotf2]>put my arrow in my arrows in my backpack
>
You add an arrow to your bundle.
[huntotf2]>loot
>
Here's the script. The problem likely lies in the huntotf2 subroutine. I made the script into a class because I'm probably going to optimize it so it's good by programming standards.
$i = 0
$return = false
class Huntotf
def initialize
end
load "scripts/lootfunc.lic"
def tablecheck
if checkroom =~ /Table/i
move "out"
move "out"
tootf()
end
if checkroom =~ /[Ta'Faendryl Approach]/i
bounty()
huntotf()
end
end
def tootf
fput "ready weapon"
fput "tootf"
matchwait "Cannot follow"
fput "go water"
fput "swim east"
sleep 6
signs()
bounty()
fput "tootf"
matchwait "Reached destination"
huntotf()
end
def fromotf
fput "tavern"
matchwait "Cannot follow"
fput "go water"
fput "swim west"
sleep 6
fput "tavern"
matchwait "Reached destination"
move "go tavern"
fput "go tiad table"
fput "go tiad table"
fput "tap tiad"
unbox()
exit
end
def bounty
fput "bounty"
bountycheck = matchtimeout 3, "ithzir adept", "ithzir janissary", "ithzir seer", "ithzir initiate", "war griffin"
if bountycheck =~ /ithzir adept/i
$bounty = true
$bountytarget = "adept"
elsif bountycheck =~ /ithzir janissary/i
$bounty = true
$bountytarget = "janissary"
elsif bountycheck =~ /ithzir seer/i
$bounty = true
$bountytarget = "seer"
elsif bountycheck =~ /ithzir initiate/i
$bounty = true
$bountytarget = "initiate"
elsif bountycheck =~ /war griffin/i
$bounty = true
$bountytarget = "griffin"
else
$bounty = false
end
end
def signs
fput "sign of swords"
matchtimeout 1, "repeating the sign", "renewed vigor"
fput "sign of smiting"
matchtimeout 1, "repeating the sign", "renewed vigor"
fput "sign of striking"
matchtimeout 1, "repeating the sign", "renewed vigor"
fput "sign of shields"
matchtimeout 1, "repeating the sign", "web of protection"
fput "sign of defending"
matchtimeout 1, "repeating the sign", "web of protection"
fput "sign of warding"
matchtimeout 1, "repeating the sign", "web of protection"
fput "sign of staunching"
matchtimeout 1, "veins throb"
fput "sign of dissipation"
sleep 1
fput "sign of deflection"
sleep 1
end
def arrowmobs
fput "aim right eye"
aim = "right"
target_line = "null"
fighting = false
if checknpcs.length >= 1 && $target =~ /adept|griffin|initiate|seer|janissary/i && $invalidmob == false && checknpcs.length <= 2 && $return == false && percenthealth > 70
fighting = true
end
while checknpcs.length >= 1 && $target =~ /adept|griffin|initiate|seer|janissary/i && $invalidmob == false && checknpcs.length <= 2 && $return == false && percenthealth > 70
if stance != "offensive"
fput "stance offensive"
matchtimeout 2, "You are now in an offensive stance"
end
arrowcheck()
fput "fire " + $target
target_line = matchtimeout 2, "dies", "But it is dead!", "You are still stunned",
"Sorry, you can only have", "You have completed this portion", "Roundtime",
"falls prone to the ground, twitches one last time and dies." , "What were you referring to?",
"is already dead", "quite dead already", "leaving you firing at nothingness", "I could not find", "You cannot fire a bundle of arrows",
"crashes to the ground, motionless", "falls to the ground in a crumpled heap", "falls, the life fading from",
"vainly struggles to rise, then goes still.", "then collapses.", "You are too injured to fire that"
if target_line =~ /Roundtime/i
sleep 2
waitrt?
end
if target_line =~ /dies|But it is dead!|You have completed this portion of your|vainly struggles to rise, then goes still.|falls prone to the ground, twitches one last time and dies.|is already dead|quite dead already|crashes to the ground, motionless|falls to the ground in a crumpled heap|falls, the life fading from|then collapses./i
if target_line =~ /is already dead|quite dead already/
fput "put my arrow in my arrows in my backpack"
arrowd = matchtimeout 2, "I could not find", "You bundle", "You add an arrow"
if arrowd =~ /I could not find/
fput "put my arrow in my backpack"
end
end
waitrt?
loot()
gather()
if target_line =~ /You have completed this portion of your/i
$bounty = false
end
checkmobs()
end
if target_line =~ /You cannot fire a bundle of arrows/
fput "put my arrows in my backpack"
end
if target_line =~ /What were you referring to?|leaving you firing at nothingness|I could not find/i
gather()
$invalidmob = true
end
if target_line =~ /You are too injured to fire that/i
gather()
$return = true
fromotf()
end
while standing? == false
sleep 1
if stance != "defensive"
fput "stance defensive"
matchtimeout 2, "You are now in a defensive stance", "You are still stunned", "...wait"
end
fput "stand"
matchtimeout 2, "You stand back up", "You are still stunned", "You struggle", "...wait"
end
if aim == "right"
fput "aim left eye"
aim = "left"
else
fput "aim right eye"
aim = "right"
end
end
if fighting == true
gather()
end
end
def arrowcheck
fput "get 1 arrow from my backpack"
target_line = matchtimeout 2, "You remove", "light fades", "Get what?"
if target_line =~ /light fades/
fput "drop my arrow"
$return = true
fromotf()
end
if target_line =~ /Get what?/
fput "get my arrows from my cloak"
target_line = matchtimeout 2, "You remove", "Get what?"
if target_line =~ /You remove/
fput "put my arrows in my backpack"
arrowcheck()
else
$return = true
fromotf()
end
end
end
def gather
if stance != "defensive"
fput "stance defensive"
matchtimeout 1, "defensive stance"
end
fput "gather arrow"
target_line = matchtimeout 2, "You may only gather", "You pick up the arrow", "You gather", "You see nothing identical enough to the arrow to bundle with it"
if target_line =~ /You pick up the arrow|You gather|You see nothing identical enough to the arrow to bundle with it/
fput "put my arrow in my arrows in my backpack"
target_line = "I could not find", "You bundle some arrows together", "You cannot bundle", "You add an arrow"
if target_line =~ /I could not find/
fput "put my arrows in my backpack"
end
if target_line =~ /You cannot bundle/
fput "drop my arrow"
end
end
end
def huntotf
$i = 0
$movearray = [ne, ne, ne, n, n, n, n, e, e, e, e, ne, ne, ne, ne, n, sw, e, n, nw, w, w, e, s, s, s, se, w, w, sw, s, w, w, n, n, n, n, "go steps",
n, "go spear", w, w, w, "go foot", s, w, sw, ne, e, n, w, w, w, w, w, e, e, e, e, e, n, nw, n, ne, e, s, s, s, "go foot", e, e, e, "go spear",
n, n, e, e, e, s, ne, se, s, sw, nw, s, w, w, w, "go steps", s, s, s, s, s, s, s, s, sw, sw, sw]
while checkmind != "fried" && percenthealth >= 50 && $return == false
$invalidmob = false
move $movearray[$i]
$i = $i + 1
if $i == $movearray.length
$i = 0
end
matchtimeout 2, "Obvious paths", "Obvious exits"
checknpcs.length >= 1 && checknpcs.length <= 2 && !(checkpcs.length > 0) && checkmind != "must rest" && $invalidmob == false && $return == false
checkmobs()
if $invalidmob == false && $target != "none"
arrowmobs()
#echo "Target acquired."
#echo "Unpause the script to continue"
#pause_script "huntotf"
end
end
fromotf()
end
def checkmobs
#echo "checking mobs"
$target = "none"
$invalidmob = false
checknpcs.each do |mob|
if (mob == "griffin" || mob == "seer" || mob == "initiate" || mob == "adept" || mob == "janissary") && $target == "none" #&& $bounty == false
$target = mob
#echo "target is now " + mob
elsif (mob == $bountytarget && $bounty == true)
$target = mob
#echo "Bounty target sighted. Target is now " + mob
end
if (mob != "griffin" && mob != "seer" && mob != "initiate" && mob != "adept" && mob != "janissary") && checknpcs.length >= 1 #&& $bounty == false
$invalidmob = true
#echo "Invalid target found"
elsif (mob != $bountytarget && $bounty == true)
$invalidmob = true
#echo "Invalid target found"
end
end
#echo "mobcheck complete"
end
end
Huntotf.new.tablecheck()