Fikes
11-20-2013, 01:39 AM
After dealing with highlights and various other half successful means for keeping track of my arrows during combat, I finally decided to put together a script to do it automatically.
This script is made to run in the background and wait until you start a lich combat script. Once it sees that script start it will look for the results of your shots, than tally how many arrows are in the room, how many are hidden, how many are lost forever, and how many have left the room (and their direction).
To make the script work, you would change the two variables at the very top, Type and Script. Script is your combat script's name and "type" is the name of what you are firing. I haven't tested this script with anything other than arrows so I'd be very interested to hear results. Also, because my arrows are fletched by me, they are just called "arrow." If you are using store bought it may take more fiddiling since the script looks for strings like this:
"The #{type} flips over"
If when you shoot it says "The purple and green bone fangled arrow flips over" you would want to set type="purple and green bone fangled arrow"
Anyways, if you have any questions post here. Please, please test it and post any issues.
Below is all the code:
type = "arrow"
script = "ranger2"
waitforcombat:
inroom = 0
hidden = 0
tonorth = 0
tone = 0
toeast = 0
tose = 0
tosouth = 0
tosw = 0
towest = 0
tonw = 0
toother = 0
lost = 0
#fput "l at my arrow"
#str = (matchtimeout 2, "You carefully" )
#strarr = str.split('find')
#scount = strarr[1].split('in')
echo "--Waiting for combat--"
wait_until {running? (script)}
echo "--Combat started--"
goto "watchshots"
watchshots:
unless running? ('ranger2')
goto "displaytotals"
end
result = (matchtimeout 2, "The #{type} flips over", "The #{type} fails to stick", "The #{type} is deflected to one side", "The #{type} ricochets away from", "the #{type} simply falls", "The #{type} sticks in", "The #{type} disappears into the local", "The #{type} flies off", "The #{type} streaks off", "--- Lich: ranger2 has exited.")
if result =~ /The #{type} flips over|The #{type} fails to stick|The #{type} is deflected to one side|The #{type} ricochets away from|the #{type} simply falls|The #{type} sticks in/
inroom = inroom + 1
elsif result =~ /The #{type} disappears into the local/
hidden = hidden + 1
elsif result =~ /The #{type} flies off/
straar = result.split(' the ')
echo "part 1 #{straar[0]}, part 2 #{straar[1]}, part 3 #{straar[3]}, part 4 #{straar[4]}"
direction = straar[1]
echo "DIRECTION : #{direction}"
if direction =~ /north!/
tonorth = tonorth + 1
elsif direction =~ /northeast/
tone = tone + 1
elsif direction =~ /east!/
east = east + 1
elsif direction =~ /southeast/
tose = tose + 1
elsif direction =~ /south!/
tosouth = tosouth + 1
elsif direction =~ /southwest/
tosw = tosw + 1
elsif direction =~ /west!/
towest = towest + 1
elsif direction =~ /northwest/
tonw = tonw + 1
else
toother = toother + 1
end
elsif result =~ /The #{type} streaks off/
lost = lost + 1
else
#echo "unknown result"
end
goto "watchshots"
displaytotals:
#echo "You started with #{scount} arrows."
if inroom > 0
echo "Arrows in room: #{inroom}"
end
if hidden > 0
echo "Arrows hidden in room: #{hidden}"
end
if tonorth > 0
echo "Arrows to the north: #{tonorth}"
end
if tone > 0
echo "Arrows to the NE: #{tone}"
end
if toeast > 0
echo "Arrows to the east: #{toeast}"
end
if tose > 0
echo "Arrows to the SE: #{tose}"
end
if tosouth > 0
echo "Arrows to the south: #{tosouth}"
end
if tosw > 0
echo "Arrows to the SW: #{tosw}"
end
if towest > 0
echo "Arrows to the south: #{towest}"
end
if tonw > 0
echo "Arrows to the south: #{tonw}"
end
if toother > 0
echo "Arrows that went an unknown direction: #{toother}"
end
if lost >0
echo "Arrows lost for ever: #{lost}"
end
#fput "l at my arrow"
#str = (matchtimeout 2, "You carefully" )
#strarr = str.split('find')
#ecount = strarr[1].split('in')
#echo "You now have #{ecount[0]} arrows."
goto "waitforcombat"
This script is made to run in the background and wait until you start a lich combat script. Once it sees that script start it will look for the results of your shots, than tally how many arrows are in the room, how many are hidden, how many are lost forever, and how many have left the room (and their direction).
To make the script work, you would change the two variables at the very top, Type and Script. Script is your combat script's name and "type" is the name of what you are firing. I haven't tested this script with anything other than arrows so I'd be very interested to hear results. Also, because my arrows are fletched by me, they are just called "arrow." If you are using store bought it may take more fiddiling since the script looks for strings like this:
"The #{type} flips over"
If when you shoot it says "The purple and green bone fangled arrow flips over" you would want to set type="purple and green bone fangled arrow"
Anyways, if you have any questions post here. Please, please test it and post any issues.
Below is all the code:
type = "arrow"
script = "ranger2"
waitforcombat:
inroom = 0
hidden = 0
tonorth = 0
tone = 0
toeast = 0
tose = 0
tosouth = 0
tosw = 0
towest = 0
tonw = 0
toother = 0
lost = 0
#fput "l at my arrow"
#str = (matchtimeout 2, "You carefully" )
#strarr = str.split('find')
#scount = strarr[1].split('in')
echo "--Waiting for combat--"
wait_until {running? (script)}
echo "--Combat started--"
goto "watchshots"
watchshots:
unless running? ('ranger2')
goto "displaytotals"
end
result = (matchtimeout 2, "The #{type} flips over", "The #{type} fails to stick", "The #{type} is deflected to one side", "The #{type} ricochets away from", "the #{type} simply falls", "The #{type} sticks in", "The #{type} disappears into the local", "The #{type} flies off", "The #{type} streaks off", "--- Lich: ranger2 has exited.")
if result =~ /The #{type} flips over|The #{type} fails to stick|The #{type} is deflected to one side|The #{type} ricochets away from|the #{type} simply falls|The #{type} sticks in/
inroom = inroom + 1
elsif result =~ /The #{type} disappears into the local/
hidden = hidden + 1
elsif result =~ /The #{type} flies off/
straar = result.split(' the ')
echo "part 1 #{straar[0]}, part 2 #{straar[1]}, part 3 #{straar[3]}, part 4 #{straar[4]}"
direction = straar[1]
echo "DIRECTION : #{direction}"
if direction =~ /north!/
tonorth = tonorth + 1
elsif direction =~ /northeast/
tone = tone + 1
elsif direction =~ /east!/
east = east + 1
elsif direction =~ /southeast/
tose = tose + 1
elsif direction =~ /south!/
tosouth = tosouth + 1
elsif direction =~ /southwest/
tosw = tosw + 1
elsif direction =~ /west!/
towest = towest + 1
elsif direction =~ /northwest/
tonw = tonw + 1
else
toother = toother + 1
end
elsif result =~ /The #{type} streaks off/
lost = lost + 1
else
#echo "unknown result"
end
goto "watchshots"
displaytotals:
#echo "You started with #{scount} arrows."
if inroom > 0
echo "Arrows in room: #{inroom}"
end
if hidden > 0
echo "Arrows hidden in room: #{hidden}"
end
if tonorth > 0
echo "Arrows to the north: #{tonorth}"
end
if tone > 0
echo "Arrows to the NE: #{tone}"
end
if toeast > 0
echo "Arrows to the east: #{toeast}"
end
if tose > 0
echo "Arrows to the SE: #{tose}"
end
if tosouth > 0
echo "Arrows to the south: #{tosouth}"
end
if tosw > 0
echo "Arrows to the SW: #{tosw}"
end
if towest > 0
echo "Arrows to the south: #{towest}"
end
if tonw > 0
echo "Arrows to the south: #{tonw}"
end
if toother > 0
echo "Arrows that went an unknown direction: #{toother}"
end
if lost >0
echo "Arrows lost for ever: #{lost}"
end
#fput "l at my arrow"
#str = (matchtimeout 2, "You carefully" )
#strarr = str.split('find')
#ecount = strarr[1].split('in')
#echo "You now have #{ecount[0]} arrows."
goto "waitforcombat"