/require alias.tf /loaded hannhunt.tf /load huntprac.tf /set autohunt=0 /set autohuntmob="" /alias ahunt \ /if ({*}=/{}) \ /echo First I need mobname to hunt.%; \ /else \ /set autohunt=1%; \ /set autohuntmob=%*%; \ /do_ahunt1 %; \ /do_ahunt2 %; \ /send hunt %autohuntmob %; \ /endif ; original code ;/def -mregexp -p1 -t"is ([a-z]+) from here\\.$" do_follow = \ ; /if (autohunt=1) %P1 %; hunt %autohuntmob %; /endif ; ;/def -mregexp -F -t"is here!" do_follow1 = \ ; /set autohunt=0 %; /set autohuntmob="" %; \ ; /echo Autohunt Completed. /def -mregexp -F -t'^[{]skillgain[}]301,([0-9]+)$' hunt_gotbetter = \ /set huntprac=%P1 %; \ /listvar huntprac %| /writefile huntprac.tf %; \ /load hannhunt.tf ; It will notice when you get better at hunt, and load the next-higher trig ; You'll have to re-ahunt if it's in the middle of an ahunt, as it reloading ; itself will cause it to forget what it was doing. This will only work if you ; have "tags skillgains on" set on Aard. It does this by noticing text of the ; form {skillgain}301,100, where the 100 is your new prac %. It will save the ; value across tinyfugue restarts, but you'll need to set it once manually to ; initialize (unless your hunt is 1-25, which is the script default). ; I do this using "/echo {skillgain}301,100", substituting your current prac %. ;1% - 25% /if (huntprac < 26) \ /echo Huntprac was under 26 %; \ /def do_ahunt1 = /def -mregexp -p1 -t"^You have no idea what you're doing, but maybe (.*?) left (north|south|east|west|up|down)?" hunt_do_follow = \ /set hunt_direction=%%%{P2} %%%; /follow_it %%%{P2} %; \ /endif ;26% - 50% /if ((huntprac > 25) & (huntprac < 51)) \ /echo Huntprac was under 51 %; \ /def do_ahunt1 = /def -mregexp -p1 -t"^There are traces of (.*?) having been here. Perhaps they lead (north|south|east|west|up|down)?" hunt_do_follow = \ /set hunt_direction=%%%{P2} %%%; /follow_it %%%{P2} %; \ /endif ;51% - 75% /if ((huntprac > 50) & (huntprac < 76)) \ /echo Huntprac was under 76 %; \ /def do_ahunt1 = /def -mregexp -p1 -t"^The trail of (.*?) is confusing, but you're reasonably sure (s?he|it) headed (north|south|east|west|up|down)[.]" hunt_do_follow = \ /set hunt_direction=%%%{P3} %%%; /follow_it %%%{P3} %; \ /endif ; 76% - 99% /if ((huntprac > 75) & (huntprac < 100)) \ /echo Huntprac was under 100 %; \ /def do_ahunt1 = /def -mregexp -p1 -t"^You are confident that (.*?) passed through here, heading (north|south|east|west|up|down)[.]" hunt_do_follow = \ /set hunt_direction=%%%{P2} %%%; /follow_it %%%{P2} %; \ /endif ; 100% /if (huntprac = 100) \ /echo Huntprac was 100 %; \ /def do_ahunt1 = /def -mregexp -p1 -t"You are certain that (.*?) is (north|south|east|west|up|down) from here[.]" hunt_do_follow = \ /set hunt_direction=%%%{P2} %%%; /follow_it %%%{P2} %; \ /endif /def do_ahunt2 = /do_ahunt_trig1 %; /do_ahunt_trig2 %; /do_ahunt_trig3 %; /do_ahunt_trig4 %; /do_ahunt_trig5 ; I got lazy, this is non-stateful. If you encounter a door, it'll try to open ; it using various means and will then proceed to try going through it again. ; The non-stateness of this means that "the east door is closed" will then try ; open, and will immediately go east again, before any other triggers hit. ; If the door is locked, you'd then get "The door is locked" followed the the ; east's attempt of "The east door is closed", which will hit both the try_open ; and the try_knock trigs, so you'll try multiple things next time. It'll ; eventually succeed or stop the autohunt. Neither elegant nor efficiant, but ; functional and easy. Some day it'll annoy me enough to correct, but not today :P /def do_ahunt_trig1 = \ /def -mglob -F -t"* is here!" hunt_do_follow1 = /done_ahunt /def do_ahunt_trig2 = \ /def -mregexp -F -t"The ([a-zA-Z_]+) is closed[.]" hunt_pass_off = /try_open /def do_ahunt_trig3 = \ /def -mregexp -F -t"The ([a-zA-Z_]+) is locked and you lack the key[.]" hunt_locked = /try_knock /def do_ahunt_trig4 = \ /def -mregexp -F -t"Magical wards around the ([a-zA-Z_]+) bounce you back[.]" hunt_no_pass = /try_pick /def do_ahunt_trig5 = \ /def -mglob -F -t"The locking mechanism is too complex for you." hunt_no_pick = /fail_hunt /def done_ahunt = /set autohunt=0 %; /set autohuntmob="" %; \ /echo Autohunt Completed %; \ /quote -S /do_end_hunt_trigs `"/list -s hunt_*" /def follow_it = /if (autohunt=1) %1 %; hunt %autohuntmob %; /endif /def fail_hunt = /echo Hunt Failed...need key for door (nopass/nopick or you don't have required abilities) %; /done_ahunt /def try_open = open %{hunt_direction} %; %{hunt_direction} /def try_knock = \ /if (((is_mage=~"Y")&(121<=effective_level & my_level<141))|((is_psi=~"Y")&(effective_level>=127))) c 411 %{hunt_direction} %; o %{hunt_direction} %; %{hunt_direction} %; \ /else /try_pass %; \ /endif /def try_pass = \ /if ((natural_pass_door=~"Y")|(has_pass_wish=~"Y")) nopassdoor %; \ /elseif ((is_mage=~"Y")&(my_level>=141)) c 180 %; \ /elseif ((is_thief=~"Y")&(effective_level>=48)) c 64 %; \ /elseif ((is_psi=~"Y")&(effective_level>=50)) c 114 %; \ /elseif (((is_mage=~"Y")|(is_cleric=~"Y")|(is_ranger=~"Y"))&(effective_level>=50)) /passdoor %; \ /elseif (((is_warrior=~"Y")|(is_paladin=~"Y"))&(effective_level>=201)) /passdoor %; \ /else /try_pick %; \ /endif /def try_pick = \ /if ((is_thief=~"Y")&(effective_level>=12)) pick %{hunt_direction} %; open %{hunt_direction} %; %{hunt_direction} %; \ /elseif ((is_warrior=~"Y")&(effective_level>=130)) bash %{hunt_direction} %; o %{hunt_direction} %; %{hunt_direction} %; \ /else /fail_hunt %; \ /endif /def do_end_hunt_trigs = /undef %{L1}