канешна я знаю что не кто в таком большом коде не будет разбираться но все таки... может кому нибудь будет не лень...
крашит клиент сцука и все... через не определенное время...
вроде и задержки везде и все... но факт..
это переделаный скрипт ветерана на мининг...
посмотрите плиз...
Code: var f=file("d:\trees3.dat") var GetFromFile=0
########### ### Код ### ########### sub Mining() var i=0,j=0,k=0,r=0,q=0,ii,jj,mx,my,mz, ruda var TopX=324,TopY=65 dim TreeX[5000], TreeY[5000],TreeT[5000] var flag=0,treeCount=0,clicks=0,flag2=0
var Ruda1=0x19B9 ; 4 and more ore var Ruda2=0x19B7 ; 1 ore var Ruda3=0x19BA ; 2 ore var Ruda4=0x19B8 ; 3 ore
uo.Exec("filterspeech on") uo.Exec("filterspeech add 'Where do you want to use the pickaxe?'")
##################################### ### Загружаем координаты из файла ### ##################################### if GetFromFile==1 then uo.Print('Загружаем координаты из файла...') f.open() treeCount=safe call f.ReadNumber() for i=1 to treeCount TreeT[i]=safe call f.ReadNumber() TreeX[i]=safe call f.ReadNumber() TreeY[i]=safe call f.ReadNumber() next f.close() else ###################################### ### Собираем координаты из клиента ### ######################################
uo.Print('Собираем координаты деревьев в округе...') repeat clicks=0 flag=0 uo.DeleteJournal() ####################### ### Кликаем на тайл ### ####################### uo.usetype('0x0E85') waitForTarget() uo.DeleteJournal() WaitForTryRock() ############################### ### Проверяем дерево ли это ### ###############################
######################### ### Кликнули на ствол ### #########################
treeCount=treeCount+1 TreeX[treeCount]=uo.LastTile(1) TreeY[treeCount]=uo.LastTile(2) TreeT[treeCount]=uo.LastTile(0) uo.Print('Найдено дерево '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))+' '+str(treeCount))
until treeCount==8 uo.Exec("filterspeech off") uo.Print('Анализ закончен, координаты деревьев записаны в файл C:\trees3.dat') SaveToFile(treeCount,TreeX,TreeY,TreeT) end if uo.Print('Деревьев найдено: '+str(treeCount)) wait(2000) ###################################### ### Ходим по собранным координатам ### ###################################### while 1==1 if treeCount>0 then for i=1 to treeCount end if if uo.weight>200 then GotoXY(2568, 475) wait(5000) uo.useobject('0x4001CCDE') wait(1000) repeat UO.Findtype( Ruda1, -1, -1 ) uo.moveitem('finditem', -1, uo.ObjAtLayer('Bank')) wait(1000) until uo.count(Ruda1)==0 end if uo.Print('Идем к тайлу '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
GotoXY(TreeX[i],TreeY[i]) wait(2000) uo.exec('exec obkopka') while not uo.injournal("+") wait(2000) wend uo.deletejournal() next end if wend end sub ########################################################################### sub hidding() while not uo.Hidden() uo.WarMode("0") uo.print('Прячемся') uo.UseSkill("Hiding") wait(3500) wend next end if wend end sub
sub SaveToFile(treeCount,TreeX,TreeY,TreeT) var f=file("C:\trees3.dat") var s=0,i=0 f.open() f.create() s=safe call f.writeln(treeCount) for i=1 to treeCount s=safe call f.writeln(str(TreeT[i])+' '+str(TreeX[i])+' '+str(TreeY[i])) next f.close() end sub
sub Numb(num) if num>=0 then return num else return num*(-1) end if 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)<=2 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 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 obkopka() var mx, my, mz, i, j
mx = UO.GetX("self") my = UO.GetY("self") mz = UO.GetZ("self") for i = mx-2 to mx+2 for j = my-2 to my+2 UO.Print("Копаем в координатах: "+str(mx-i)+" "+str(my-j)) while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock") and not UO.InJournal("Iron Ore") and not UO.InJournal("Copper") and not UO.InJournal("Rusty Ore") UO.DeleteJournal() if uo.waiting() then uo.canceltarget() endif uo.deletejournal() if uo.injournal('GM') or uo.injournal('Admin') or uo.injournal('Seer') or uo.injournal('Counselor') or uo.injournal('Developer') then uo.deletejournal() wait(240000) endif
UO.Waittargettile("1341", str(i), str(j), str(mz)) uo.usetype('0x0E85') 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") and AntiMacro() if uo.injournal('GM') or uo.injournal('Admin') or uo.injournal('Seer') or uo.injournal('Counselor') or uo.injournal('Developer') then uo.deletejournal() wait(240000) else if uo.journal("You broke the pickaxe.") uo.findtype('0x0E85') uo.usetype('0x0E85') uo.deletejournal() endif wait (1000) wend wend UO.DeleteJournal() next if uo.injournal('GM') or uo.injournal('Admin') or uo.injournal('Seer') or uo.injournal('Counselor') or uo.injournal('Developer') then uo.deletejournal() wait(240000) endif next if uo.injournal('GM') or uo.injournal('Admin') or uo.injournal('Seer') or uo.injournal('Counselor') or uo.injournal('Developer') then uo.deletejournal() wait(240000) endif wait(200) uo.say("+") end sub
#################################################################################################################### sub DoubleCheck()
dim reindex[8] reindex[0] = 11 reindex[1] = 12 reindex[2] = 13 reindex[3] = 10 reindex[4] = 16 reindex[5] = 14 reindex[6] = 17 reindex[7] = 15
var GumpID = 0 var ButtonID = 0 var ButtonText
for var i = 18 to 19 GumpID = val(Mid(uo.LastGump('command', i), 16, 4)) ButtonID = reindex[GumpID-2225] ButtonText = uo.LastGump('command', ButtonID) uo.LClick(Val(Mid(ButtonText, 7, 3)), Val(Mid(ButtonText, 11, 3))) repeat wait(500) until uo.LastGump('text', 4) <> "0" next
end sub
sub AntiMacro()
if not uo.LastGump('replyed') then if uo.LastGump('text', 0) == 'Antimacros System' then DoubleCheck() return 0 end if end if return 1
end sub
|