Code: sub mine_always() Uo.Disarm() UO.set("finddistance","2") while 1 hungry() go_mining("8ol8ki")
UO.Print("Again") wend end sub
############################################################ # Main Mining Function! Conf. Needed (look above) ############################################################ sub go_mining(path) var cycle=1 # var path="8ol8ki" var test=0 var i=0 var j UO.DeleteJournal()
While i<LEN(path) if VAL(path[i]) then j=VAL(path[i]) i=i+1 else j=1 endif
Repeat if test<>1 then UO.DeleteJournal() mine_spot() gogo() end if
UO.Print("New Location!") if not make_step(path[i]) then UO.Print("Probably Stuck!") UO.Print("Hope it is a Worldsave") endif j=j-1 Until j==0
i = i + 1 if cycle && i==LEN(path) then i=0 endif Wend end sub
sub Mine_Spot() var mineTime=0
hungry()
if UO.Count("0x0e85") then UO.DeleteJournal() UO.waittargettile(1339,UO.GetX(),UO.GetY(),0) UO.usetype("0x0e85") repeat mineTime = mineTime + 1 wait(1000) until UO.injournal('there is no more') or UO.injournal('You cannot') or UO.injournal('tool broke') or UO.injournal('stop mining') or UO.injournal('must wait') or UO.injournal('already doing') or UO.injournal('no sand') or UO.journal('fail') or (mineTime>120) UO.DeleteJournal() end if UO.Print("Finished") ore() endif return 0 end sub
############################################################ # Main Path-Recording function! ############################################################ sub record_path() var x var y var path="" UO.DeleteJournal() Repeat x=UO.GetX() y=UO.GetY() if waitNewPos(x,y) then path=path+extract_dir(x,y,UO.GetX(),UO.GetY()) endif Until UO.InJournal("stop") path = compressPath(path) UO.TextClear() UO.TextOpen() UO.TextPrint("Your path is:") UO.TextPrint(path) end sub
############################################################ # Auxilliar sub. ############################################################ sub send_step(keycode,dir) var x = UO.GetX() var y = UO.GetY()
while (UO.Stamina<7) AND (x==UO.GetX()) AND (y==UO.GetY()) UO.useobject("Music") wait(2100) wend
var timeout = 0
while (UO.GetDir()<>dir) AND (x==UO.GetX() ) AND (y==UO.GetY() ) timeout = 0 UO.Press(keycode) Repeat timeout=timeout+50 wait(50) Until (UO.GetDir()==dir) || (timeout>10000) wend
while (x==UO.GetX() ) AND (y==UO.GetY() ) timeout = 0 UO.Press(keycode) Repeat timeout=timeout+50 wait(50) Until x<>UO.GetX() || y<>UO.GetY() || (timeout>10000) wend
return 1 end sub
############################################################ # Bunch of auxilliar subs. No need to change anything! ############################################################ sub waitNewPos(x,y) while x==UO.GetX() && y==UO.GetY() if UO.InJournal("stop") then return 0 endif wend return 1 end sub
sub compressPath(path) Var i=0 Var j=0 Var newPath="" while i<LEN(path) j=1 while path[i]==path[i+1] AND j<9 i=i+1 j=j+1 wend if j==1 then newPath=newPath+path[i] else newPath=newPath+STR(j)+path[i] endif i=i+1 wend return newPath end sub
sub extract_dir(x,y,a,b) if x>a then if y==b then return "i" else if y>b then return "n" else return "w" endif endif else if x<a then if y==b then return "l" else if y>b then return "e" else return "s" endif endif else if y>b then return "o" else return "k" endif endif endif end sub
sub make_step(dir) if dir=="e" then send_step(39,1) return 1 gogo() endif if dir=="l" then send_step(34,2) return 1 gogo() endif if dir=="s" then send_step(40,3) return 1 gogo() endif if dir=="k" then send_step(35,4) return 1 gogo() endif if dir=="w" then send_step(37,5) return 1 gogo() endif if dir=="i" then send_step(36,6) return 1 gogo() endif if dir=="n" then send_step(38,7) return 1 gogo() endif if dir=="o" then send_step(33,0) return 1 gogo() endif if dir=="d" then While UO.Count("0x0eed") UO.Drop("0x0eed") wait(1000) Wend wait(200) return 1 endif UO.Print("Recall Time!") return 0 end sub
sub ore() if (UO.Weight>0) then uo.ignorereset() uo.findtype("0x0eed",-1,"ground") #ore while (Uo.FindCount()>0) if (uo.GetX("finditem")<>uo.GetX()) OR (uo.GetY("finditem")<>uo.GetY()) then Uo.Grab(0,"finditem") endif uo.ignore("finditem","on") wait(300) uo.findtype("0x0eed",-1,"ground") #ore wend uo.ignorereset() endif end sub
sub hungry() var hungry=1 while hungry==1 UO.DeleteJournal() UO.ServerPrint(".hungry") while not UO.InJournal("You") wait(50) wend if not UO.InJournal("stuffed") then if UO.Count(0x097B)>0 then UO.UseType(0x097B) wait(2000) else UO.Exec("findtype 0x097B -1 ground") Wait(500) if UO.FindCount()>0 then UO.Grab("20","finditem") Wait(500) else hungry=0 endif hungry=0 endif else hungry=0 endif wend endsub
sub gogo() if UO.Weight >400 then UO.Exec("waittargettype 0x0eed") UO.Exec("drophere") wait (500) endif if UO.Weight >400 then UO.Exec("waittargettype 0x19b8") UO.Exec("drophere") wait (500) endif endsub
долго и нудно искал в чем подвох так и не нашел...
|