Code: ######################################################### ### #Авторы: ### -Автор скрипта:"Аskaneli". ### -Редактировал и дополнял:"BETEPAH". ### -Идеи и редкатирование скрипта:"cOoler". ### -За помощь в доработке скрипта спасибо:"Legio". ### Спасибо всем кто каким либо образом помогал в ### разработке этого скрипта. ######################################################### var FileName=('C:\mining.dat') ## ### var TryHiding=1 ## 1 - Ïåðåä òåì êàê êîïàòü ðóäó, áóäåò ïûòàòüñÿ óéòè â õàéä, ### 0 - íå áóäåò . ### var TryRecall=1 ## 1 - Ïîñëå òîãî êàê ñîáåðåò äîñòàòî÷íûé âåñ, áóäåò ïûòàòüñÿ ### ðåêîëèòüñÿ äîìîé, ### ñêëàäûâàòü ðóäó â ñóíäóê è ðåêîëèòüñÿ îáðàòíî , 0 - íå áóäåò.(DropOnVip ### äîëæíî áûòü 0) var OreQty=440 ## - Ìàêñèìàëüíûé âåñ, äîáûâ êîòîðûé íàäî ðåêîëèòüñÿ äîìîé. ### (ñåé÷àñ 600 ñòîóíîâ) var DangerousTime=50000 ## - Âðåìÿ â ñåêóíäàõ êîòîðîå ÷àð áóäåò æäàòü(ïîñëå ### ðåêîëà) ïîêà óéäåò ÏÊ èëè Ýëåìåíò.(ñåé÷àñ 50 ñåêóíä) ### var CycleScript=0 ## 1 - Ñêðèïò íå îòêëþ÷àåòñÿ ïîñëå ðåêîëà îò àòàêóþùåãî, 0 - ### îòêëþ÷àåòñÿè çàêðûâàåò UO. ### var DropX=1815 ## - Êîîðäèíàòà ïåðåä ñóíäóêîì ïî X. ### var DropY=849 ## - Êîîðäèíàòà ïåðåä ñóíäóêîì ïî Y. ################################################################################ var Pickaxe = 0x0e86 var Chest = 0x40036042 sub GoMining() RecallToOre() uo.Exec('exec Mining') end sub sub Mining() var i=0,j=0,k=0,r=0,q=0,ii,jj,f var TopX=324,TopY=65 dim OreX[5000],OreY[5000],OreT[5000] dim OreTile[22] var flag=0,OreCount=0,clicks=0,flag2=0 #################### ### Ãðàôèêà ðóäû ### #################### OreTile[0]=1340 OreTile[1]=1343 OreTile[2]=1354 OreTile[3]=1359 OreTile[4]=1358 OreTile[5]=1357 OreTile[6]=1352 OreTile[7]=1341 OreTile[8]=1363 OreTile[9]=1359 OreTile[10]=1339 OreTile[11]=1354 OreTile[12]=1386 OreTile[13]=1353 OreTile[14]=1342 OreTile[15]=1347 OreTile[16]=1344 OreTile[17]=1349 OreTile[18]=2278 OreTile[19]=2275 OreTile[20]=1351 OreTile[21]=0
uo.FilterSpeech('on') uo.FilterSpeech('add', 'Where do you want to use the pickaxe?')
##################################### ### Çàãðóæàåì êîîðäèíàòû èç ôàéëà ### ##################################### uo.Print('Zagrugaem koordinati...') f=file(FileName) f.Open() OreCount=safe call f.ReadNumber() for i=1 to OreCount OreT[i]=safe call f.ReadNumber() OreX[i]=safe call f.ReadNumber() OreY[i]=safe call f.ReadNumber() next f.Close() ###################################### ### Õîäèì ïî ñîáðàííûì êîîðäèíàòàì ### ###################################### while 1==1 if OreCount>0 then for i=1 to OreCount
if TryRecall==1 and uo.Weight>OreQty then ToRecall() i=1 end if
j=i*2-1 if j>OreCount then j=2*(OreCount-i+1) end if flag=GotoXY(OreX[j],OreY[j],1) if TryHiding==1 then ToHide() end if if flag==1 then GetOre(str(OreT[j]),str(OreX[j]),str(OreY[j]),str(uo.GetZ())) end if next end if wend end sub
sub GetOre(Type,X,Y,Z) var i uo.Print('kopaem...') for i=1 to 20 wait(200) uo.DeleteJournal() CheckLag() wait(100) uo.WaitTargetTile(Type,X,Y,Z) uo.Usetype(Pickaxe) wait(500) if WaitForChange()==1 then return 1 end if next return 0 end sub
sub WaitForChange() var Text1='cliloc# 0xAD03' var Text2='cliloc# 0xAD00' var Text3="You can't reach this." var Text4="cliloc# 0xA2DE" var Text5="You can't do much in your current state." var Text6="You have no line of sight to that location" var Text7="You can't see the target" var Text8="Try mining in rock." var mess for var i=0 to 200 mess=uo.Journal(0) if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text6 or uo.Journal(0)==Text7 or uo.Journal(0)==Text8 then return 1 end if if uo.Journal(0)==Text1 then wait(1000) return 0 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 Open(Container) uo.DeleteJournal() uo.UseObject(Container) repeat wait(500) until uo.InJournal('Contains') end sub
sub GotoXY(x,y,r) var lastX=0,lastY=0,i=0 while Numb(y-uo.GetY())>r if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if if (y-uo.GetY())>r then LastX=uo.GetX() LastY=uo.GetY() for i=0 to 2 uo.Press(35) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next if LastY==uo.GetY() then for i=0 to 2 uo.Press(37) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastY==uo.GetY() then for i=0 to 2 uo.Press(40) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastX==uo.GetX() and LastY==uo.GetY() then for i=0 to 5 uo.Press(38) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if end if if (uo.GetY()-y)>r then LastY=uo.GetY() for i=0 to 2 uo.Press(33) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next if LastY==uo.GetY() then for i=0 to 2 uo.Press(39) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastY==uo.GetY() then for i=0 to 2 uo.Press(38) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastX==uo.GetX() and LastY==uo.GetY() then for i=0 to 5 uo.Press(40) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if end if wend while Numb(x-uo.GetX())>r if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if if (x-uo.GetX())>r then LastX=uo.GetX() LastY=uo.GetY() for i=0 to 2 uo.Press(34) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next if LastX==uo.GetX() then for i=0 to 2 uo.Press(40) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastX==uo.GetX() then for i=0 to 2 uo.Press(39) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastX==uo.GetX() and LastY==uo.GetY() then for i=0 to 5 uo.Press(37) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if end if if (uo.GetX()-x)>r then LastX=uo.GetX() for i=0 to 2 uo.Press(36) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next if LastX==uo.GetX() then for i=0 to 2 uo.Press(38) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastX==uo.GetX() then for i=0 to 2 uo.Press(37) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if if LastX==uo.GetX() and LastY==uo.GetY() then for i=0 to 5 uo.Press(39) if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 end if next end if end if wend if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then return 1 else return 0 end if return 0 end sub
sub Numb(num) if num>=0 then return num else return num*(-1) end if end sub
sub ToHide() if not uo.Hidden() then uo.Print('Hide..') uo.useskill('Hiding') endif end sub
sub ToRecall() RecallToHome() DropOre() RecallToOre() end sub
sub RecallToHome() GotoXY(1810,850,0) GotoXY(1815,849,0) end sub
sub RecallToOre() GotoXY(1810,850,0) GotoXY(1807,851,0) end sub
sub DropOre() uo.useobject(Chest) CheckLag() repeat wait(500) uo.findtype('0x19b9') uo.moveitem('finditem','0',Chest) wait(700) until not uo.count('0x19b9') end sub
sub DropOnVip() Walk(DropX,DropY,'') DropOre() end sub sub Go(dir,key,walkwait) var X,Y,OldDir X=uo.GetX() Y=uo.GetY() OldDir=uo.GetDir() if uo.GetDir()<>dir then uo.Press(key) wait(walkwait) if uo.GetDir()<>dir then end if end if uo.Press(key) wait(walkwait) if X==uo.GetX() and Y==uo.GetY() then end if if X==uo.GetX() and Y==uo.GetY() and OldDir<>uo.GetDir() then uo.Press(key) wait(walkwait) end if if X==uo.GetX() and Y==uo.GetY() then end if if X==uo.GetX() and Y==uo.GetY() then return -1 else return 1 end if end sub
sub Time() var Date,nTime,uTime,i uTime=str(uo.Time()) nTime='' for i=0 to Len(uTime) nTime=uTime[Len(uTime)-i]+nTime if (i==2) or (i==4) then nTime=':'+nTime end if next uTime=str(uo.Date()) Date='' for i=0 to Len(uTime) Date=uTime[Len(uTime)-i]+Date if (i==2) or (i==4) then Date='.'+Date end if next uTime=nTime+' @ '+Date return uTime end sub
sub Terminate() uo.Exec('terminate Mining') end sub
sub TerminateAll() uo.Exec('terminate Mining') uo.Exec('terminate ControlOfDanger') uo.Exec('terminate Reconnect') uo.Exec('terminate RecallRune') uo.Exec('terminate DropOre') uo.Exec('terminate DangerWait') uo.Exec('terminate DangerWait') end sub
Sub CheckLag() UO.DeleteJournal() UO.Click('backpack') repeat wait(500) until UO.InJournal('cliloc# 0x9ED5') end sub
sub GoCorpse() var Elemental='0x4000466F' Walk(0,0,Elemental) end sub
sub Walk(X,Y,Target) var Targeting='' var Result var DX,DY,GLX,GLY var DirW=0 var exit=0 while exit<>1 if Target<>'' then Targeting=Target DX=uo.GetX(Target)-uo.GetX() DY=uo.GetY(Target)-uo.GetY() if uo.GetDistance(Target)<2 then exit=1 end if else DX=X-uo.GetX() DY=Y-uo.GetY() GLX=DX GLY=DY if DX==0 and DY==0 then exit=1 end if end if if exit==0 then if DX>0 and DY>0 then DirW=9 end if if DX>0 and DY<0 then DirW=7 end if if DX<0 and DY>0 then DirW=3 end if if DX<0 and DY<0 then DirW=5 end if if DX<>0 and DY==0 then if DX>0 then DirW=8 else DirW=4 end if end if if DX==0 and DY<>0 then if DY>0 then DirW=2 else DirW=6 end if end if Result=Go(DirW) if Result==0 then Result=Go(DirW-2) if Result==0 then Result=Go(DirW+2) end if end if end if wend end sub
sub Go(dir) var WalkWait=100 var Targeting='' var X,Y,GLX,GLY var check=1 var StartingDir=uo.GetDir() X=uo.GetX() Y=uo.GetY() dim MoveKey[12] MoveKey[0]=34 MoveKey[1]=40 MoveKey[2]=35 MoveKey[3]=37 MoveKey[4]=36 MoveKey[5]=38 MoveKey[6]=33 MoveKey[7]=39 MoveKey[8]=34 MoveKey[9]=40 MoveKey[10]=35 MoveKey[11]=37 dim StartDir[12] StartDir[0]=2 StartDir[1]=3 StartDir[2]=4 StartDir[3]=5 StartDir[4]=6 StartDir[5]=7 StartDir[6]=0 StartDir[7]=1 StartDir[8]=2 StartDir[9]=3 StartDir[10]=4 StartDir[11]=5 while uo.GetDir()<>StartDir[dir] uo.Press(MoveKey[dir]) wait(WalkWait) if uo.GetDir()==StartingDir then CheckLag() end if if (Targeting<>'' and uo.GetDistance(Targeting)<2) or (GLX==0 and GLY==0) then return 1 end if wend uo.Press(MoveKey[dir]) wait(WalkWait) if X==uo.GetX() and Y==uo.GetY() then CheckLag() uo.Press(MoveKey[dir]) wait(WalkWait) end if if X==uo.GetX() and Y==uo.GetY() then return 0 else return 1 end if end sub
Вобщем макр запускается, идет к точнке копания и пишет типо "Где копать?". На этом он запинается и ничего дальше не делатет. В чем может быть проблема?
Сервер на RunUO. Вроде бы все, что нужно заменил...
|