Скрипт на копанье вдоль скалы:
При первом использовании нуна fileread поставить на 0 чтоб задать координаты по которым он ходить должен, тока он после окапывания
выдает ошибку
Помогите пожалуйста найти ошибку.
(скрипт етот-потомок Ветерановских скриптов на мининг и лимберджакинг )
Code: ########################################################## ### Øàðä Dragon World / www.drw.ru ### ########################################################## # ################## # # ### Ïåðåìåííûå ### # # ################## # ########################################################## var F=file('C:\MiningLog.dat') var FileRead=1 var MaxWeight=680 var Hiding=1 var RuneToHome=1 var RuneToMine=8 var chest=0x4030b84f var OldX,OldY,time ########################################################## # ################## # # ### Ñêðèïò ### # # ################## # ##########################################################
sub Mining() var q=0,w,e,r,t,y dim mineX[50], mineY[50], mineZ[50] var mineCount=0, click=0, flag=0
uo.Print('Âûáåðè Ëîïàòó: ') uo.Exec('addobject Shovel') while uo.Targeting() wait(100) wend
uo.Print('Âûáåðè PóíÁóê: ') uo.Exec('addobject Runebook') while uo.Targeting() wait(100) wend end if
########################################################## # ########################## # # ### Çàãðóçêà êîîðäèíàò ### # # ########################## # ##########################################################
if FileRead==1 then uo.Print('Çàãðóæàåì êîîðäèíàòû èç ôàéëà...') F.open() mineCount=safe call f.ReadNumber() for w=1 to mineCount mineZ[w]=safe call f.ReadNumber() mineX[w]=safe call f.ReadNumber() mineY[w]=safe call f.ReadNumber() next F.close() else
########################################################## # ########################## # # ### Ââîä êîîðäèíàò ### # # ########################## # ##########################################################
uo.Print('Ñîáèðàåì êîîðäèíàòû...') repeat click=0 flag=0 uo.DeleteJournal() repeat uo.UseObject('Shovel') WaitForTarget() uo.DeleteJournal() WaitForTryRock() if uo.Lasttile(1)==uo.GetX() and uo.Lasttile(2)==uo.GetY() then flag=3 end if mineCount=mineCount+1 mineX[mineCount]=uo.LastTile(1) mineY[mineCount]=uo.LastTile(2) mineZ[mineCount]=uo.LastTile(0) uo.print('Óêàçàíà êîîðäèíàòà íîìåð '+str(mineCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))) until (mineCount==50) or (flag==3) uo.Print('Àíàëèç çàêîí÷åí, êîîðäèíàòû ìåñòíîñòè çàïèñàíû â ôàéë C:\MiningLog.dat') SaveToFile(mineCount,mineX,mineY,mineZ) wait(2000) end if
########################################################## # ########################## # # ### Õîäèì ïî ìåñíîñòè ### # # ########################## # ########################################################## repeat if mineCount>0 then for q=1 to mineCount if uo.Weight>MaxWeight then RecallHome() end if uo.Print('Èäåì íà ïîçèöèþ íîìåð '+str(q)+': x='+str(mineX[q])+' y='+str(mineY[q])) flag=GotoXY(mineX[q],mineY[q]) ;Hide() GetMine(str(mineZ[q]),str(mineX[q]),str(mineY[q]),str(uo.GetZ())) next wend end if end sub
sub GetMine(Type,X,Y,Z) var mX, mY, mZ, k=0, i=0, mX1, mY1, jor, ser, noto if uo.Warmode()==1 then return 0 end if wait(200)
beginning: mX = uo.getX("self") mY = uo.getY("self") mZ = uo.GetZ("self") uo.DeleteJournal() for i = mX-1 to mX+1 for k = mY-1 to mY+1
uo.Print("Êîïàåì â êîîðäèíàòàõ: "+str(mX-i)+" "+str(mY-k)) while not uo.InJournal("no ore here") and not uo.InJournal("location") and not uo.InJournal("far away") and not uo.InJournal("in rock") uo.DeleteJournal() if uo.Waiting() then uo.Canceltarget() end if uo.Waittargettile("1341", str(i), str(k), str(mZ)) uo.Useobject("Shovel") while not uo.InJournal("You put") and not uo.InJournal("heavy") and not uo.InJournal("location") and not uo.InJournal("no ore") and not uo.InJournal("but fail") and not uo.InJournal("far away") and not uo.InJournal("in rock") wait(500) mX1=mX-i mY1=mY-k if uo.Weight>MaxWeight then goto end end if next next wend wend if mX1>-1 and mY1>-1 then goto beginning end if end:
if WaitForChange()==1 then return 1 end if next return 0 end sub
sub RecallHome() RecallToHome() DropOres() RecallToMine() end sub
sub RecallToHome() uo.Print('Ïðûãàåì Äîìîé.') RunebookRecall(RuneToHome) end sub
sub RecallToMine() uo.Print('Ïðûãàåì ê ñêàëå.') RunebookRecall(RuneToMine) end sub
sub Hide() while not uo.Hidden() uo.UseSkill('Spirit Speak') wait(3000) uo.Print('Ïûòàåìñÿ óéòè â õàéä...') uo.DeleteJournal() uo.UseSkill('Stealth') wait(4100) wend wait(100) end sub
sub WaitForChange() var Text1='That is too far away.' var Text2='Try mining in rock.' var Text3='There is no ore here to mine.' var Text4='You have no line of sight to that location' var Text5="You can't see the target" var mess for var i=0 to 200 mess=uo.Journal(0) if uo.Journal(0)==Text1 or uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 then return 1 end if if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' and mess[4]=='p' and mess[5]=='u' and mess[6]=='t' then return 0 end if wait(50) next return 0 end sub
sub WaitForTryRock() var Text1='That is too far away.' var Text2='Try mining in rock.' var Text3='There is no ore here to mine.' var Text4='You have no line of sight to that location' var Text5="You can't see the target" for var i=0 to 50 if uo.Journal(0)==Text1 or uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text5 then return 1 end if wait(200) next return 0 end sub
sub WaitForTarget() for var i=0 to 50 if uo.Targeting()==1 then return 1 end if wait(200) next return 0 end sub
sub WaitForChangeXY(myX,myY,LastX,LastY) for var i=1 to 50 if LastX<>myX or LastY<>myY then return 1 end if wait(200) next return 0 end sub
sub GotoXY(x,y) var myX,myY,LastX=0,LastY=0,i,halt=0,z,r=0 for i=1 to 60 myX=uo.GetX() myY=uo.GetY() if LastX==myX and LastY==myY then halt=halt+1 else halt=0 end if if halt>=10 then if uo.GetDir()==1 then for z=0 to 8 uo.Press(40) next end if if uo.GetDir()==3 then for z=0 to 8 uo.Press(37) next end if if uo.GetDir()==5 then for z=0 to 8 uo.Press(38) next end if if uo.GetDir()==7 then for z=0 to 8 uo.Press(39) next end if halt=15 end if if Numb(x-myX)<=1 and Numb(y-myY)<=1 then return 1 end if if x<=myX then if y<=myY then for z=0 to 3 uo.Press(38) next else for z=0 to 3 uo.Press(37) next end if else if y<=myY then for z=0 to 3 uo.Press(39) next else for z=0 to 3 uo.Press(40) next end if end if LastX=myX LastY=myY wait(200) next return 0 end sub
sub Numb(num) if num>=0 then return num else return num*(-1) end if end sub
sub SaveToFile(mineCount,mineX,mineY,mineZ) var f=file("C:\MiningLog.dat") var s=0,i=0 f.open() f.create() s=safe call f.writeln(mineCount) for i=1 to mineCount s=safe call f.writeln(str(mineZ[i])+' '+str(mineX[i])+' '+str(mineY[i])) next f.close() end sub
sub DropOres() if uo.Waiting() then uo.CancelTarget() end if var a, Exit var UnloadChest=chest ## - ID ñóíäóêà äëÿ ñáðîñà ðóäû. DIM Ore[5] Ore[0]=0x19B9 ## - 4 and more ore Ore[1]=0x19B7 ## - 1 ore Ore[2]=0x19BA ## - 2 ore Ore[3]=0x19B8 ## - 3 ore uo.SetReceivingContainer(UnloadChest) wait(500) for a=0 to 3 exit=0 repeat uo.FindType(Ore[a]) if uo.GetQuantity('finditem')>0 then uo.Grab('0','finditem') wait(1500) else exit=1 end if until Exit==1 next uo.UnSetReceivingContainer() end sub
sub RunebookRecall(n) OldX=uo.GetX() OldY=uo.GetY() repeat uo.Exec('warmode 0') uo.UseObject('Runebook') CheckLag() uo.LClick(135, n*15+55) CheckLag() time=uo.Timer() repeat wait(500) until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs') or uo.InJournal('fizzles') or time+200<uo.Timer() until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs') end sub
sub Open(Container) uo.DeleteJournal() uo.UseObject(Container) repeat wait(500) until uo.InJournal('Contains') end sub
sub Reconnect() var ReconnectTime,rFlag ReconnectTime='0' rFlag=1 repeat while (uo.ObjAtLayer('Bpack')=='') if rFlag then ReconnectTime=MakeTime() rFlag=0 end if wait(20000) uo.Say('') wait(3000) uo.Say('') wait(3000) uo.Say('') wait(3000) uo.LdblClick(357,164) uo.Lclick(616,459) wait(3000) wend wait(3000) if (rFlag==0) and (ReconnectTime<>'0') then uo.TextOpen() uo.TextPrint('Disconnected & Reconnected @ '+ReconnectTime) rFlag=1 ReconnectTime='0' end if until false end sub
sub MakeTime() var d,t,ret,i ret=str(uo.Time()) t="" for i=0 to Len(ret) t=ret[Len(ret)-i]+t if (i==2) or (i==4) then t=":"+t end if next ret=str(uo.Date()) d="" for i=0 to Len(ret) d=ret[Len(ret)-i] + d if (i==2) or (i==4) then d="."+d end if next ret=t+" @ "+d return ret end sub
sub Time() var hh,mm,ss,hms,t=str(uo.Time()) if len(t)<=2 then hh="0" mm="0" ss=t endif if len(t)==3 then hh="0" mm=left(t,len(t)-2) ss=right(t,len(t)-1) endif if len(t)==4 then hh="0" mm=left(t,len(t)-2) ss=right(t,len(t)-2) endif if len(t)==5 then hh=left(t,len(t)-4) hms=left(t,len(t)-2) mm=right(hms,len(hms)-1) ss=right(t,len(t)-3) endif if len(t)==6 then hh=left(t,len(t)-4) hms=left(t,len(t)-2) mm=right(hms,len(hms)-2) ss=right(t,len(t)-4) endif return hh+":"+mm+":"+ss end sub
sub Terminate() uo.Print('Ñêðèïò è âñå åãî ôóíêöèè âûêëþ÷åíû!') uo.DeleteJournal() uo.Exec('terminate all') wait(100) uo.Exec('terminate all') wait(100) uo.Exec('terminate all') wait(100) end sub
sub CheckLag() if uo.Waiting()>0 then uo.Exec('canceltarget') end if uo.DeleteJournal() uo.Click('backpack') repeat wait(50) until uo.InJournal('backpack') end sub
|