Saurven
09-10-2014, 10:13 PM
I'm missing something.
I'm trying to get this script to pick a target, hold it until it's killed, and exit. The problem is that this script performs perfectly, except for the exiting.
If no NPC is in the room, it'll instantly exit. No trying to hide or anything. If there is an NPC, it performs the brawling section flawlessly. Once the critter is dead, even if there's only 1 critter in the room, it hides again and attempts to punch.
I added the command to exit - if /^You currently have no valid target/ - because my ongoing .status check is FUBAR.
What am I screwing up in this?
I tried making it just one def, with:
def vstrike
If GameObj.npc.find { |thing| thing.status !~ /dead/}
**the rest of the def, after the $vtarg line**
else
exit
That didn't work, so I came up with the complicated crap that still isn't working.
$vpunch = "Strike leaves foe vulnerable to a followup punch"
$vkick = "Strike leaves foe vulnerable to a followup kick"
$vgrapple = "Strike leaves foe vulnerable to a followup grapple"
$vjab = "Strike leaves foe vulnerable to a followup jab"
$currentattack = "punch"
$vtarg = []
def martial_start
mytargs = GameObj.npcs.find_all{ |jackals| jackals.status !~ /dead|gone/ }
if mytargs.size > 0
$targ.push(mytargs.last)
vstrike
else
exit
end
end
def vstrike
if $vtarg.status !~ /dead|gone/
waitrt?
fput "stance def"
fput "hide"
waitrt?
fput "stance off"
result = dothistimeout "#{$currentattack}", 5, /#{$vpunch}|#{$vkick}|#{$vgrapple}|#{$vjab}|^Roundt ime|^You currently have no valid target/
if result =~ /#{$vpunch}/
waitrt?
$currentattack = "punch"
vstrike
elsif result =~ /#{$vkick}/
waitrt?
$currentattack = "kick"
vstrike
elsif result =~ /#{$vgrapple}/
waitrt?
$currentattack = "grapple"
vstrike
elsif result =~ /#{$vjab}/
waitrt?
$currentattack = "jab"
vstrike
elsif result =~ /^Roundtime/
$currentattack = "punch"
vstrike
elsif result =~ /^You currently have no valid target/
exit
end
elsif $vtarg.status =~ /^dead|gone/
exit
end
end
martial_start
I'm trying to get this script to pick a target, hold it until it's killed, and exit. The problem is that this script performs perfectly, except for the exiting.
If no NPC is in the room, it'll instantly exit. No trying to hide or anything. If there is an NPC, it performs the brawling section flawlessly. Once the critter is dead, even if there's only 1 critter in the room, it hides again and attempts to punch.
I added the command to exit - if /^You currently have no valid target/ - because my ongoing .status check is FUBAR.
What am I screwing up in this?
I tried making it just one def, with:
def vstrike
If GameObj.npc.find { |thing| thing.status !~ /dead/}
**the rest of the def, after the $vtarg line**
else
exit
That didn't work, so I came up with the complicated crap that still isn't working.
$vpunch = "Strike leaves foe vulnerable to a followup punch"
$vkick = "Strike leaves foe vulnerable to a followup kick"
$vgrapple = "Strike leaves foe vulnerable to a followup grapple"
$vjab = "Strike leaves foe vulnerable to a followup jab"
$currentattack = "punch"
$vtarg = []
def martial_start
mytargs = GameObj.npcs.find_all{ |jackals| jackals.status !~ /dead|gone/ }
if mytargs.size > 0
$targ.push(mytargs.last)
vstrike
else
exit
end
end
def vstrike
if $vtarg.status !~ /dead|gone/
waitrt?
fput "stance def"
fput "hide"
waitrt?
fput "stance off"
result = dothistimeout "#{$currentattack}", 5, /#{$vpunch}|#{$vkick}|#{$vgrapple}|#{$vjab}|^Roundt ime|^You currently have no valid target/
if result =~ /#{$vpunch}/
waitrt?
$currentattack = "punch"
vstrike
elsif result =~ /#{$vkick}/
waitrt?
$currentattack = "kick"
vstrike
elsif result =~ /#{$vgrapple}/
waitrt?
$currentattack = "grapple"
vstrike
elsif result =~ /#{$vjab}/
waitrt?
$currentattack = "jab"
vstrike
elsif result =~ /^Roundtime/
$currentattack = "punch"
vstrike
elsif result =~ /^You currently have no valid target/
exit
end
elsif $vtarg.status =~ /^dead|gone/
exit
end
end
martial_start