I spent some time trying to understand the logic of the sbounty script and I think I found a few issues in the work flow. Here are my suggestions:
Issue: Will not talk_to_npc after being assigned a bounty if you have just turned in a bounty and need to rest.
Code:
[sbounty]>ask guardsman about bounty
The guardsman says, "Ah, so you have returned. I take it you were successful? Good. The town of Ta'Illistim thanks you for your help. I shall inform the Adventurer's Guild that you successfully completed your task. You may pick up your reward there, Alastir."
[sbounty]>urch guide bounty
You flag down a nearby urchin and indicate your desired destination.
The urchin nods to you and rapidly guides you through a series of back alleys, side streets, and little-used shortcuts until you reach your destination in mere seconds.
[Ta'Illistim, Alearyl Hall]
You notice Guild Taskmaster Jarivyth.
Obvious exits: east, west, out
[sbounty]>ask Jarivyth about bounty
Jarivyth says, "All done with that assignment? Good job, Alastir!"
[You have earned 925 bounty points, 1000 experience points, and 9250 silver.]
[sbounty: -- finished task (925 points, 1000 exp, 9250 silver)]
Jarivyth nods to you and says, "Looking for something to do, Alastir? I've got just the thing for you. If you want to know more, simply ask me about BOUNTIES."
[sbounty]>ask #17328060 for bounty
Jarivyth says, "Hmm, I've got a task here from the town of Ta'Illistim. It appears they have a creature problem they'd like you to solve. Go report to one of the guardsmen just inside the Ta'Illistim City Gate to find out more. Be sure to ASK about BOUNTIES."
[ Next Bounty: +0:15:00, 0:15:00 remaining. ]
Jarivyth adds, "I encourage you to work with other adventurers who are also around your level of experience. If you wish for them to formally aid you in this task, simply bring them before me and ASK me to ADD them to your task."
Goes to REST here instead of finishing the task assignment.
FIX: Testing in progress
Code:
while true
talk_to_npc.call
if can_do_bounty.call and not CharSettings[:should_rest_wounded].call
if is_bounty.call 'task_search'
task_search.call
elsif is_bounty.call 'task_forage' and Time.now.to_i >= last_forage_attempt + last_forage_delay
task_forage.call
end
elsif Spell['Next Bounty'].active? and (expedite_left and not is_bounty.call 'none' and not can_do_bounty.call and CharSettings[:enable_expedite])
expedite_bounty.call
next
end
if is_bounty.call 'task_escort' and GameObj.npcs.find { |npc| npc.name =~ /child/ }
task_escort.call 'advguard'
elsif is_bounty.call 'task_fail'
can_do_bounty_cache = nil
elsif is_bounty.call 'success_heirloom'
success_heirloom.call
end
exit if dead?
if can_turn_in.call
turn_in.call
resting = false
else
if not can_do_bounty.call and not Spell['Next Bounty'].active?
remove_bounty.call
get_bounty.call
#ADDED-HACK-BEGIN
if is_bounty.call ['help_creature', 'help_resident', 'help_heirloom', 'help_gemdealer', 'help_herbalist', 'help_furrier']
talk_to_npc.call
end
#ADDED-HACK-END
Issue: Sometimes you will forage an extra herb for your herb task, when you turn them in, you'll be left with an extra herb in your hand and it doesn't put it away.
FIX:
Code:
talk_to_herbalist = proc {
go2_nearest.call([ 3824, 1851, 10396, 640, 5722, 2406, 11002, 9505 ]) unless Room.current.id == 640
if Room.current.id == 10396
npc = 'maraene'
else
npc = GameObj.npcs.find { |t| t.name =~ /brother Barnstel|scarred Agarnil kris|healer|herbalist|merchant Kelph|famed baker Leaftoe|Akrash|old Mistress Lomara/i }
end
if is_bounty.call 'help_herbalist'
res = dothistimeout "ask #{npc} about bounty", 5, /Yes, I do have a task for you/
if res =~ /I've recently received an order for ([0-9]+) (.*?)\./
print.call "received bounty from herbalist [#{$1} #{$2}]"
end
elsif bounty? =~ /#{bounty_patterns['task_forage']}/
herb_name = $1.gsub(/s?$/,'')
herbs = lootsack.contents.find_all { |item| item.name =~ /#{herb_name}/ }
if herbs.empty?
error.call 'no herbs to turn in, why are you here?'
end
prev_item = nil
if GameObj.right_hand
prev_item = GameObj.right_hand
fput 'store right' if checkright
fput 'stow right' if checkright
end
herbs.each { |herb|
fput "get ##{herb.id} from ##{lootsack.id}"
result = dothistimeout "give ##{herb.id} to #{npc}", 3, /This looks perfect|That looks like it has been partially used up/
if result !~ /perfect/
fput "drop ##{herb.id}"
#ADDED-HERBALIST-START
elsif result =~ /You've collected all the samples I asked for/
fput "stow all"
#ADDED-HERBALIST-END
end
}
if prev_item
fput "get ##{prev_item.id}"
end
else
error.call 'why are you at the herbalist?'
end
}