Lumberjacking
Code: ################## ### Переменные ### ################## ################################################################################ var f=file("D:\trees3.dat") ## - Путь к файлу в котором будут хранится координаты деревьев. ### var LogsQty=350 ## - Количество логов, добыв которое надо идти к сундуку. ### var GetFromFile=1 ## 1 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента ### (сначала соберите а потом считывайте из файла). ### var EatingFood=0 ## 1 - Будем есть, 0 - нет. ### var TypeFood='0x097B' ## - Тип еды которую будем кушать.(сейчас фиштейки) ### var Chest='0x401B9AB0' ## - ID сундука куда будут выгружаться логи. ### var Trytodrop=1 ## Будем пытатся подходить к сундуку или нет. ### var ContX=3373 ##Координаты X у сундука ### var ContY=595 ##Координаты Y у сундука ### var oldX,oldY,time ## - Для рекола. ### ###var Axe='0x404C2067' ## - ID топора которым будем рубить, если выбирать таргетом, то пред ним ### поставите ### - эти три знака. ### var Axe = 'Axe' ## - Выбор топора таргетом. ### var Pickaxe = '0x4045737B' ## - ID кирки для выбора деревье в фаил trees3.dat, если выбирать таргетом, то ### перд ним поставте ### - эти три знака. ### ###var Pickaxe = 'Pickaxe' ## - Выбор кирки таргетом. ### ###var Igrok = '0x4045737B' ## - ID игрока для скирпта банд, если выбирать таргетом, то перд ним поставте ### ### - эти три знака. ### var Igrok = 'Igrok' ## - Выбор игрока таргетом. ### var LumberSound=('C:Warning.wav') ## ### ################################################################################ ###################### ### Запуск скрипта ### ######################
sub main() uo.Print('Выберите Топор!') uo.Exec('addobject Axe') while uo.Targeting() wait(100) wend uo.Print('Выберите Лесоруба!') uo.Exec('addobject Igrok') while uo.Targeting() wait(100) wend #uo.Print('Выберите Кирку!') #uo.Exec('addobject Pickaxe') #while uo.Targeting() #wait(100) #wend uo.Exec('exec Lumberjacking') uo.Exec('exec ControlOfHeal') uo.Exec('exec ToHideAlways') end sub sub Lumberjacking() var i=0,j=0,k=0,r=0,q=0,ii,jj var TopX=324,TopY=65 dim TreeX[5000], TreeY[5000],TreeT[5000] dim TreeTile[29] var flag=0,treeCount=0,clicks=0,flag2=0 TreeTile[0]=3277 TreeTile[1]=3280 TreeTile[2]=3283 TreeTile[3]=3286 TreeTile[4]=3289 TreeTile[5]=3291 TreeTile[6]=3294 TreeTile[7]=3296 TreeTile[8]=3299 TreeTile[9]=3302 TreeTile[10]=3393 TreeTile[11]=3394 TreeTile[12]=3395 TreeTile[13]=3396 TreeTile[14]=3415 TreeTile[15]=3416 TreeTile[16]=3417 TreeTile[17]=3418 TreeTile[18]=3419 TreeTile[19]=3438 TreeTile[20]=3439 TreeTile[21]=3440 TreeTile[22]=3441 TreeTile[23]=3442 TreeTile[24]=3460 TreeTile[25]=3461 TreeTile[26]=3462 TreeTile[27]=3290 TreeTile[28]=3288 UO.Exec('terminate Reconnector') wait(1000) UO.Exec('exec Reconnector') wait(1000) 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.UseObject('Pickaxe') waitForTarget() uo.DeleteJournal() WaitForTryRock() flag=0 for k=0 to 28 if uo.LastTile(0)==TreeTile[k]+1 then flag=2 end if next if flag==0 then for k=0 to 28 if uo.LastTile(0)==TreeTile[k] then flag=1 ;end if next end if if uo.Lasttile(1)==uo.GetX() and uo.Lasttile(2)==uo.GetY() then flag=3 end if if flag==1 then flag2=0 if treeCount>0 then for ii=1 to treeCount if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then flag2=1 end if next end if if flag2==0 then 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))) end if end if if flag==2 then flag2=0 if treeCount>0 then for ii=1 to treeCount if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then flag2=1 end if next end if if flag2==0 then treeCount=treeCount+1 TreeX[treeCount]=uo.LastTile(1) TreeY[treeCount]=uo.LastTile(2) TreeT[treeCount]=uo.LastTile(0)-1 uo.print('Найдено дерево номер '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))) end if end if until (flag==3) or (treeCount==5000) uo.Exec("filterspeech off") uo.Print('Анализ закончен, координаты деревьев записанны в файл 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 if Trytodrop==1 and uo.Count('ZLK')>=LogsQty then uo.print('Идём выкладывать логи') GotoXY(uo.getx(Chest),uo.gety(Chest)) DropLogs() end if uo.Print('Идём к дереву номер '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i])) InfoLogs() flag=GotoXY(TreeX[i],TreeY[i]) if flag==1 then GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ())) end if next end if wend end sub sub GetTree(Type,X,Y,Z) var i uo.Print('Начинаем рубку дерева...') for i=0 to 30 if uo.Warmode()==1 then return 0 end if uo.DeleteJournal() If not uo.hidden() then ToHide() End if uo.WaitTargetTile(Type,X,Y,Z) uo.UseObject(Axe) if WaitForChange()==1 then return 1 end if next return 0 end sub sub ToHideAlways() var Time,Space Repeat If not uo.Hidden() then uo.UseSkill('Hiding') WaitForHide() End if wait(100) Until uo.dead() Time=Time() Space=' ' uo.TextOpen() uo.TextPrint("Время смерти - " +Space +Time) end sub sub ToHide() while not uo.Hidden() uo.warmode(0) uo.Print('Пытаемся уйти в хайд...') uo.UseSkill('Hiding') wait(4000) wend end sub sub WaitForHide() var Text1=uo.GetName()+': You have hidden yourself well' var Text2=uo.GetName()+": You can't seem to hide here." var mess for var i=0 to 200 mess=uo.Journal(0) if uo.Journal(0)==Text1 then return 1 end if if uo.Journal(0)==Text2 then return 0 end if wait(50) next return 0 end sub sub WaitForChange() var Text1=uo.GetName()+': You hack at the tree for a while, but fail to produce any useable wood.' var Text2='There are no logs here to chop.' var Text3="You can't reach this." var Text4='That is too far away.' var Text5="You can't do much in your current state." 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 then return 1 end if if uo.Journal(0)==Text1 then 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 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)<=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(300) next return 0 end sub sub Numb(num) if num>=0 then return num else return num*(-1) end if 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 DropLogs() uo.msg('Выкладываем логи!!!') if uo.Waiting() then uo.CancelTarget() end if var a,Exit dim Logs[1] Logs[0]=0x1BDD uo.Print('Выкладываем логи.') uo.SetReceivingContainer(Chest) wait(500) for a=0 to 0 Exit=0 repeat uo.FindType(Logs[a]) if uo.GetQuantity('finditem')>0 then uo.Grab('0','finditem') wait(1500) GotoXY(ContX,ContY) else Exit=1 end if until Exit==1 next if EatingFood==1 then EatingFood() end if uo.UnSetReceivingContainer(Chest) uo.Print('???? ????????.') end sub sub InfoLogs() uo.Print('У вас всего '+str(uo.Count('0x1BDD'))+' логов в сумке') uo.Print('Из них '+str(uo.Count('0x1BDD','0x0000'))+' простых и ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' цветных') end sub sub Open(Container) uo.DeleteJournal() uo.UseObject(Container) repeat wait(500) until uo.InJournal('Contains') end sub sub MovingItems(tItem,cItem,qItem,FromBackPack) var idResivCont var idSendCont if FromBackPack==1 then idResivCont=uo.GetSerial('backpack') idSendCont=Chest else idSendCont=uo.GetSerial('backpack') idResivCont=Chest end if CheckLag() uo.FindType(tItem,cItem,idSendCont) while uo.GetQuantity('finditem')>0 uo.MoveItem('finditem',qItem,idResivCont) wait(1000) CheckLag() if qItem>0 then return end if uo.FindType(tItem,cItem,idSendCont) wend end sub sub EatingFood() var Time,Space Time=Time() Space=' ' uo.TextOpen() uo.TextPrint("Кушаем - " +Space +Time) MovingItems(TypeFood,'-1',20,1) repeat CheckLag() uo.UseType(TypeFood) while not uo.InJournal('full') and not uo.InJournal('stuffed') and not uo.InJournal('hungry') and not uo.InJournal('satiated') and not uo.Dead() wait(100) wend until uo.InJournal('too full') or uo.Dead() MovingItems(TypeFood,'-1',-1,0) end sub sub ControlOfHeal() repeat if uo.life < 140 then uo.msg('\w Kot: R ATAKOBAH!!!') uo.msg('\w Rekoshet: R ATAKOBAH!!!') uo.exec('exec goportal') uo.exec('exec controlgoportal') uo.exec('terminate Lumberjacking') wait(350) uo.exec('terminate Lumberjacking') wait(10000) uo.exec('terminate controlgoportal') if uo.dead() then uo.msg('\w Kot: Я мёртв!') uo.exec('terminate Lumberjacking') end if if uo.GetHp('self') <> uo.GetMaxHp('self') then uo.WarMode(false) while uo.life < uo.str band() uo.WaitTargetObject('self') uo.UseType('0x0E21') wait(3500) wend end if if uo.count('0x0E20')>0 then uo.WaitTargettype('0x1008') uo.UseType('0x0E20') uo.say('Guards') uo.WarMode(false) end if next end if wait(500) until uo.dead() end sub sub goportal() go(0,0, 0) end sub sub controlgoportal() repeat wait(500) until uo.life > 140 uo.exec('terminate goportal') wait(100) uo.exec('exec Lumberjacking') end sub sub band() if uo.count('0x0E21')<5 then uo.findtype('0x0E21',-1,Igrok) if uo.findcount() then uo.moveitem('finditem','50','backpack') checklag() wait(1000) endif endif endsub Sub Reconnector() 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 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
sub go(x,y,k) VAR i VAR dir,ldir,rdir,key,olddir VAR dx,dy,Exit=0 VAR CacheLimit=9,CacheIndex="Text" DIM CacheX[10], CacheY[10] CacheX[0]="Test" While Exit<>1 dx=x-UO.GetX() dy=y-UO.GetY() If dx==0 AND dy==0 Then Exit=1 Endif If dx<>0 AND dy<>0 Then If dx>0 AND dy>0 Then ; GoSE dir=3 ldir=2 rdir=4 key=40 ; DownArrow olddir=UO.GetDir() If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then If olddir==2 Then ; GoNE dir=1 ldir=0 rdir=1 key=39 ; RightArrow While UO.GetDir()<>1 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoSW dir=5 ldir=5 rdir=6 key=37 ; LeftArrow While UO.GetDir()<>5 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif If dx>0 AND dy<0 Then ; GoNE dir=1 ldir=0 rdir=2 key=39 ; RightArrow olddir=UO.GetDir() If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then If olddir==0 Then ; GoWN dir=7 ldir=6 rdir=7 key=38 ; UpArrow While UO.GetDir()<>7 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoSE dir=3 ldir=3 rdir=4 key=40 ; DownArrow While UO.GetDir()<>3 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif If dx<0 AND dy>0 Then ; GoSW dir=5 ldir=4 rdir=6 key=37 ; LeftArrow olddir=UO.GetDir() If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then If olddir==6 Then ; GoWN dir=7 ldir=7 rdir=0 key=38 ; UpArrow While UO.GetDir()<>7 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoSE dir=3 ldir=2 rdir=3 key=40 ; DownArrow While UO.GetDir()<>3 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif If dx<0 AND dy<0 Then ; GoWN dir=7 ldir=6 rdir=0 key=38 ; UpArrow olddir=UO.GetDir() If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then If olddir==0 Then ; GoNE dir=1 ldir=1 rdir=2 key=39 ; RightArrow While UO.GetDir()<>1 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoSW dir=5 ldir=4 rdir=5 key=37 ; LeftArrow While UO.GetDir()<>5 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif Endif If dx<>0 AND dy==0 Then If dx>0 Then ; GoE dir=2 key=34 ; PgDown olddir=UO.GetDir() If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then If olddir==2 Then ; GoSE dir=3 ldir=3 rdir=4 key=40 ; DownArrow While UO.GetDir()<>3 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoNE dir=1 ldir=1 rdir=0 key=39 ; RightArrow While UO.GetDir()<>1 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif If dx<0 Then ; GoW dir=6 key=36 ; Home key olddir=UO.GetDir() If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then If olddir==0 Then ; GoWN dir=7 ldir=7 rdir=0 key=38 ; UpArrow While UO.GetDir()<>7 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoSW dir=5 ldir=4 rdir=5 key=37 ; LeftArrow While UO.GetDir()<>5 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif Endif If dx==0 AND dy<>0 Then If dy>0 Then ; GoS dir=4 key=35 ; End If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then If olddir==2 Then ; GoSE dir=3 ldir=2 rdir=3 key=40 ; DownArrow While UO.GetDir()<>3 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoSW dir=5 ldir=6 rdir=5 key=37 ; LeftArrow While UO.GetDir()<>5 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif If dy<0 Then ;GoN dir=0 key=33 ; PgUp olddir=UO.GetDir() If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then If olddir==2 Then ; GoNE dir=1 ldir=1 rdir=2 key=39 ; RightArrow While UO.GetDir()<>1 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Else ; GoWN dir=7 ldir=7 rdir=6 key=38 ; UpArrow While UO.GetDir()<>7 StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Wend Endif Endif Endif Endif Wend if k==1 then endif end sub
sub StepEdit(x,y,dir,key) VAR walkwait=100 VAR ErrLevel=0 If UO.GetDir()<>dir Then UO.Press(key) wait(walkwait) If UO.GetDir()<>dir Then CheckLag() Endif Endif UO.Press(key) wait(walkwait) If x==UO.GetX() AND y==UO.GetY() Then CheckLag() If x==UO.GetX() AND y==UO.GetY() Then ErrLevel=1 Endif Endif Return ErrLevel end sub
sub StepArrow(x,y,dir,ldir,rdir,key) VAR walkwait=100 VAR ErrLevel=0 If UO.GetDir()<>dir Then UO.Press(key) wait(walkwait) If UO.GetDir()<>dir AND UO.GetDir()<>ldir AND UO.GetDir()<>rdir Then CheckLag() Endif Endif If UO.GetX()==x AND UO.GetY()==y Then UO.Press(key) wait(walkwait) If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then CheckLag() If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then ErrLevel=1 Endif Endif Endif Return ErrLevel end sub
И
Code: #Ну, вроде откатал свое творение на тему ламбера... # #В общих чертах идея такова: находим местность насыщенную деревьями, запускаем макрос #записи движений, точнее записи координат рубаемых деревьев, и если успешно то можно #юзать скрипт. # #Теперь что касается настройки: #Нагрузить чара топором или другим прибором, который способен рубить логи. Накинуть в #него регов на рекал BM, BP, MR в количестве 50-100шт. 3 руны. # #Забиндить в клиенте на клавишу "NUM -" targetself - это чтоб прицел от топора убрать. #Впринципе не обязательно, но вроде как эстетичней. # #Забиндить в хоткеях инжекта на "NUM +" exec onaddtree, на "NUM /" exec onendrecord. #Соотвественно кнопка добавления дерева и окончания записи. # #Подходим к сундуку куда сгружать логи в зону где можно марчить руну, запускаем ,exec #addunload крестиком в руну, потом крестиком в сундук тычем. Если что то уже определено #допустим сундук есть а руну потеряли то запрос будет токо на руну. # #Идем в лес. Запускаем ,exec record и крестиком тычем в руну. После марчения скрипт #ждет от вас команду на добавление дерева или на окончание записи. Внимание! 1 + это #добавление одного дерева! #Значит обтыкиваем ближние деревья и переходим к следующим, обтыкиваем их тоже и так #пока не надоест или не кончится лес. Потом давим на "NUM /" и запускаем ,exec play #для проверки. Если чар нигде не буксует и проходит весь маршрут можно запускать ,exec #lumber после чего крестиком на топор указать если он еще не указан. # #Если всетаки чар застревает при проигрывании макро play то можно заново запустить #рекорд и выбрать более простой маршрут при подходе к этому месту. Есть второй вариант #решения проблемы. Надо открыть файл record.txt (предварительно выйдя из клиента и #заново зайдя в игру потому что файл лочится и защищен от просмотра и записи), найти #место STEP 0000 0000 с координатами позиции от куда чар начинает буксовать, пропустить #все CHOP ..... и перед следующим STEP 0000 0000 вставить таким же образом еще один STEP #0000 0000 с координатами чуть подальше места от куда чар начал буксовать. То есть #чар должен отойти назад или в бок а потом идти туда куда хотел. Если это выглядит #сложно для вас, то проще заново переписать весь маршрут. # # #Ну, что непонятно - спрашивайте. #Для начала не пытайтесь замарчить весь лес територии Yew, попробуйте 10-20 деревьев #а уж как освоитесь так вперд! # #Версия 1.0с - исправил некоторые недочеты. Для выхода из скрипта lumber нажимаем #кнопку "/" на цифровой клавиатуре # #Версия 1.1а - добавил паузу при вырубке энта. Киляется он руками после того как #покиляли, убрали диспелом стенки нажимаем "NUM -" чтоб скрипт продолжел работу. # #Версия 1.1b - исправил ошибку использования топора. # #Версия 1.1 - неоднократно проверена на нескольких компах с различной квалификацией #игроков. Обнаружилась интересная особенность, которая заключается в том что чар, #не владеющий магией или в курсовых шмотках, пешком идет на место старта скрипта
############################################################### #===---====----===---= LumberJacking =---=---=---=---=---=--==# # New Lumberjacking script. DRW Shard www.drw.ru # # Version 1.1 # # Scripted by Savage (c) 2004 ICQ:33336141 # #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# # To start script after setuping, use ",exec lumber" command # # from client window # ############################################################### # Setup: # # Bind NUM - key in client macro on targetself # # Bind NUM + key in injection hotkeys on exec onaddtree # # Bind NUM / key in injection hotkeys on exec onendrecord # # Equip char with: the hatchet or another chopping device, # # BM, MR, BP reagents 50-100 quantity, 3 blank rune. # # Go to unload position and execute: ,exec addunload. # # Choice rune and store container. # # Go to start chopping position and execute: ,exec record. # # Choice rune. Press NUM + key to add tree. Walk to next # # chopping position and press NUM + key... # # Press NUM / key to stop recording. # # Execute: ,exec play to test walking. If char sucessfuly # # walked to end recording position, execute: ,exec lumber. # # Or record way again. # #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""#
sub Lumber() VAR f=file("records.txt") VAR Buffer, LastTimer, ChopCount, X, Y, Tempx, TempY VAR Exit, ExitLocal VAR Tile, Xtree, YTree, ZTree, TileInfo VAR WaitTime=150 ; Max time to chop one tree VAR MaxWeight=700 ; (Max weight-20) VAR MaxChopCount=45 ; Max times to chop one tree
AddHatchet() wait(3000) AddTemp()
UO.SetGlobal('EndRecord',"Off")
While NOT UO.Dead() AND UO.GetGlobal('EndRecord')=='Off' mrecal('StartRune') ; start position
f.Open() Exit=0 While Exit==0 AND UO.GetGlobal('EndRecord')=='Off' tohide() Buffer=f.ReadString() If Buffer=="End" Then Exit=1 Else If Buffer=="Step" Then X=f.ReadNumber() Y=f.ReadNumber() WalkN(X,Y,'') tohide() Else Tile=f.ReadNumber() XTree=f.ReadNumber() YTree=f.ReadNumber() ZTree=f.ReadNumber() ChopCount=0 ExitLocal=0 repeat CheckLag() UO.WaitTargetTile(STR(Tile),STR(XTree),STR(YTree),STR(ZTree)) UO.UseObject('Hatchet') LastTimer=UO.Timer() while NOT UO.InJournal("You put") AND NOT UO.InJournal("You hack") AND NOT UO.InJournal("There are no") AND NOT UO.InJournal("That is too") AND NOT UO.InJournal("It appears") AND NOT UO.InJournal("You can") AND NOT LastTimer+WaitTime<UO.Timer() wait(100) wend If LastTimer+WaitTime<UO.Timer() Then ExitLocal=1 Endif if UO.InJournal("You hack") then repeat wait(100) until UO.InJournal("You put") OR LastTimer+WaitTime<UO.Timer() endif
if UO.InJournal("You put the Ent") then gong(2) TempX=UO.GetX() TempY=UO.GetY() UO.SetGlobal('AddTree','Off') UO.Print("Destroy the Ent manually and press NUM + key!") Repeat wait(1000) Until UO.GetGlobal('AddTree')=="On" WalkN(TempX,TempY,"") endif
ChopCount=ChopCount+1 until UO.InJournal("There are no") OR UO.InJournal("That is too") OR UO.InJournal("It appears") OR UO.InJournal("You can") OR ChopCount>=MaxChopCount OR ExitLocal==1
if UO.Weight>MaxWeight then unload() endif Endif EndIf Wend ; UO.Print("Playing stopped. Proverka zavershena.") Wend f.Close() end sub
sub mrecal(rune) repeat CheckLag() UO.WaitTargetObject(rune) UO.Cast('Recal') wait(5000) until NOT UO.InJournal("spell fizzles")
markrune: If UO.InJournal("fades completely") then CheckLag() UO.WaitTargetObject(rune) UO.Cast('Mark') endif wait(5000) If UO.InJournal("spell fizzles") then goto markrune endif end sub
sub addstart() CheckLag() UO.UseObject('StartRune') Repeat wait(500) Until UO.InJournal('You can') OR UO.InJournal('What is the') If UO.InJournal('You can') Then UO.Print('Select a StartRune. Vibery runu!') UO.AddObject('StartRune') While UO.Targeting()==2 wait(500) Wend markrune: CheckLag() UO.WaitTargetObject('StartRune') UO.Cast('Mark') wait(4000) If UO.InJournal("spell fizzles") then goto markrune endif UO.UseObject('StartRune') UO.SaveConfig() Else UO.Print("Ok! StartRune is found. Nashel StartRunu.") Endif wait(1000) UO.Say('StartRune') end sub
sub addtemp() CheckLag() UO.UseObject('TempRune') Repeat wait(500) Until UO.InJournal('You can') OR UO.InJournal('What is the') If UO.InJournal('You can') Then UO.Print('Select a TempRune. Vibery vremennuyu runu!') UO.AddObject('TempRune') While UO.Targeting()==2 wait(500) Wend UO.UseObject('TempRune') UO.SaveConfig() Else UO.Print("Ok! TempRune is found. Nashel TempRunu.") Endif wait(1000) UO.Say('TempRune') end sub
sub addunload() CheckLag() UO.UseObject('UnloadRune') Repeat wait(500) Until UO.InJournal('You can') OR UO.InJournal('What is the') If UO.InJournal('You can') Then UO.Print('Select a UnloadRune. Vibery runu razgruzki!') UO.AddObject('UnloadRune') While UO.Targeting()==2 wait(500) Wend markrune: CheckLag() UO.WaitTargetObject('UnloadRune') UO.Cast('Mark') wait(4000) If UO.InJournal("spell fizzles") then goto markrune endif UO.UseObject('UnloadRune') UO.SaveConfig() Else UO.Print("Ok! UnloadRune is found. Nashel UnloadRunu.") Endif wait(1000) UO.Say('UnloadRune') AddStore() end sub
sub addstore() Var LastTimer CheckLag() UO.UseObject('StoreCont') LastTimer=UO.Timer() Repeat wait(500) Until UO.InJournal("You can't see") OR UO.InJournal("You can't reach") OR UO.InJournal('What is the') OR LastTimer+30<UO.Timer() If UO.InJournal("You can't see") Then UO.Print('Select a StoreContainer. Vibery sunduk dlya logov!') UO.AddObject('StoreCont') While UO.Targeting()==2 wait(500) Wend UO.UseObject('StoreCont') UO.SaveConfig() Else UO.Print("Ok! StoreCont is added. Est sunduk!") Endif end sub
sub addhatchet() CheckLag() UO.UseObject('Hatchet') Repeat wait(500) Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.InJournal('What do you') If UO.InJournal('You can') Then UO.Print('Select a Hatchet. Vibery topor!') UO.AddObject('Hatchet') While UO.Targeting()==2 wait(500) Wend UO.SaveConfig() Else ; V cliente bindim na NUM - targetself ; Bind targetself on NUM - in client macro UO.Press(109) ; Otmena targeta Endif UO.Print("Ok! Hatchet is found. Nashel Topor.") end sub
sub unload() markrune: CheckLag() UO.WaitTargetObject('TempRune') UO.Cast('Mark') wait(5000) If UO.InJournal("spell fizzles") then goto markrune endif mrecal('UnloadRune') ; home logunload() mrecal('TempRune') end sub
sub logunload() VAR WaitTime=800 ToHide() Begin: UO.FindType('0x1BDD') ; logs if UO.GetQuantity('finditem')>0 then UO.MoveItem('finditem','0','StoreCont') CheckLag() wait(WaitTime) goto Begin endif end sub
sub OnAddTree() ; Assign on Num + in hotkeys UO.SetGlobal('AddTree','On') end sub
sub OnEndRecord() ; Assign on Num / in hotkeys UO.SetGlobal('EndRecord','On') end sub
sub Record() VAR f=file("records.txt") VAR TileInfo, Exit=0, X,Y, i=0 UO.SetGlobal('AddTree','Off') ; Num + UO.SetGlobal('EndRecord','Off') ; Num / f.Create() f.Open() AddStart() While Exit==0
X=UO.GetX() Y=UO.GetY() UO.Print("Press command key! Davi knopku!")
While UO.GetGlobal('AddTree')=='Off' AND UO.GetGlobal('EndRecord')=='Off' wait(500) Wend
If UO.GetGlobal('EndRecord')=='On' Then Exit=1 Endif
If UO.GetGlobal('AddTree')=='On' Then UO.SetGlobal('AddTree','Off')
If UO.GetX()<>X OR UO.GetY()<>Y Then UO.Print("Writing waypoint. Zapisivayu koordinaty!")
f.WriteLn("Step") f.WriteLn(UO.GetX()) f.WriteLn(UO.GetY()) Endif
UO.Info() UO.Print("Click on tree. Tkni v derevo!")
While UO.Targeting()==2 wait(500) Wend
TileInfo=UO.LastTile() f.WriteLn("Chop") f.WriteLn(TileInfo) i=i+1 Endif Wend f.WriteLn("End") f.Close() UO.Print("Recording stopped. Zapis' zavershena.") UO.Print("Count of added trees="+STR(i)) UO.Print("Dobavleno derev'ev="+STR(i)) end sub
sub Play() VAR f=file("records.txt") VAR X,Y, Buffer, Exit=0 mrecal('StartRune') f.Open() UO.SetGlobal('EndRecord','Off') ; Num /
While Exit==0 AND UO.GetGlobal('EndRecord')=='Off' Buffer=f.ReadString() If Buffer=="End" Then Exit=1 Else If Buffer=="Step" Then X=f.ReadNumber() Y=f.ReadNumber() WalkN(X,Y,'') wait(3000) Else If NOT f.EOF() Then Buffer=f.ReadLn() Endif EndIf EndIf Wend UO.Print("Playing stopped. Proverka zavershena.") f.Close() end sub
############################################################### ############################################################### ; ; Shared Subs ; ############################################################### ###############################################################
#============================================================== # tohide() - try hidding char. When char lose HP, drink inviz # potion if it found in backpack # # Journal has been deleted!!! #-------------------------------------------------------------- sub tohide() While NOT UO.Hidden() UO.DeleteJournal() UO.FindType('0x0F0E','0x0631','my')
If UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 Then UO.UseType('0x0F0E','0x0631') ; inviz potion UO.Exec('warmode 0') wait(2000) Else UO.Exec('warmode 0') UO.UseSkill('Stealth') Repeat wait(100) Until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') Endif Wend end sub
#============================================================== # CheckLag() - click on backpack and awaiting "backpack" # message in journal. # # Journal has been deleted!!! #-------------------------------------------------------------- sub CheckLag() UO.DeleteJournal() UO.Click('backpack')
Repeat wait(200) Until UO.InJournal('backpack') end sub
#============================================================== # Gong(counter) - playing wav-file 'counter'-times # http://www.jetta.ru/cow.wav #-------------------------------------------------------------- sub Gong(times) ; play wav-file VAR i For i=1 to times UO.Exec("playwav d:\game\uo\injection\cow") wait(1200) ; time to play sample at once Next end sub
sub tst() WalkN(2102,2082,'') end sub
#============================================================== # WalkN(X,Y,Serial) - char is walking by dX and dY step # sub using Home, End, PgUp, PgDown keys # d'not rebind this key from default action! # serial - Serial of target or "" - string # walkwait - delay after keypress # Example: # WalkN(2080,2113,'') - go to coordinates # WalkN(0,0,'0x12345678') - go to target position #-------------------------------------------------------------- sub WalkN(x,y,Target) VAR i,StepSucess VAR dx,dy,Exit=0 While Exit<>1 If Target<>"" Then dx=UO.GetX(Target)-UO.GetX() dy=UO.GetY(Target)-UO.GetY() ; UO.Print("Target locked!") If UO.GetDistance(Target)<2 Then Exit=1 Endif Else dx=x-UO.GetX() dy=y-UO.GetY() If dx==0 AND dy==0 Then Exit=1 Endif
Endif If dx<>0 AND dy<>0 Then If dx>0 AND dy>0 Then StepSucess=Go(3,40,300) ;SE - DownArrow If StepSucess==-1 Then StepSucess=Go(7,38,300) ;WN - UpArrow StepSucess=Go(1,39,300) ;NE - RightArrow If StepSucess==-1 Then StepSucess=Go(5,37,300) ;SW - LeftArrow Endif Endif Endif
If dx>0 AND dy<0 Then StepSucess=Go(1,39,300) ;NE - RightArrow If StepSucess==-1 Then StepSucess=Go(5,37,300) ;SW - LeftArrow StepSucess=Go(3,40,300) ;SE - DownArrow If StepSucess==-1 Then StepSucess=Go(7,38,300) ;WN - UpArrow Endif Endif Endif
If dx<0 AND dy>0 Then StepSucess=Go(5,37,300) ;SW - LeftArrow If StepSucess==-1 Then StepSucess=Go(1,39,300) ;NE - RightArrow StepSucess=Go(7,38,300) ;WN - UpArrow If StepSucess==-1 Then StepSucess=Go(3,40,300) ;SE - DownArrow Endif Endif Endif
If dx<0 AND dy<0 Then StepSucess=Go(7,38,300) ;WN - UpArrow If StepSucess==-1 Then StepSucess=Go(3,40,300) ;SE - DownArrow StepSucess=Go(5,37,300) ;SW - LeftArrow If StepSucess==-1 Then StepSucess=Go(1,39,300) ;NE - RightArrow Endif Endif Endif
Endif If dx<>0 AND dy==0 Then If dx>0 Then StepSucess=Go(2,34,300) ;E - PgDown If StepSucess==-1 Then StepSucess=Go(3,40,300) ;SE - DownArrow If StepSucess==-1 Then StepSucess=Go(1,39,300) ;NE - RightArrow Endif StepSucess=Go(2,34,300) ;E - PgDown Endif Endif If dx<0 Then StepSucess=Go(6,36,300) ;W - Home If StepSucess==-1 Then StepSucess=Go(7,38,300) ;WN - UpArrow If StepSucess==-1 Then StepSucess=Go(5,37,300) ;SW - LeftArrow Endif StepSucess=Go(6,36,300) ;W - Home Endif Endif Endif
If dx==0 AND dy<>0 Then If dy>0 Then StepSucess=Go(4,35,300) ;S - End If StepSucess==-1 Then StepSucess=Go(3,40,300) ;SE - DownArrow If StepSucess==-1 Then StepSucess=Go(5,37,300) ;SW - LeftArrow Endif StepSucess=Go(4,35,300) ;S - End Endif Endif If dy<0 Then StepSucess=Go(0,33,300) ;N - PgUp If StepSucess==-1 Then StepSucess=Go(1,39,300) ;NE - RightArrow If StepSucess==-1 Then StepSucess=Go(7,38,300) ;WN - UpArrow Endif StepSucess=Go(0,33,300) ;N - PgUp Endif Endif Endif Wend 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 CheckLag() Endif Endif
UO.Press(key) wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then CheckLag() Endif
If x==UO.GetX() AND y==UO.GetY() AND OldDir<>UO.GetDir() Then UO.Press(key) wait(walkwait) Endif
If x==UO.GetX() AND y==UO.GetY() Then CheckLag() Endif If x==UO.GetX() AND y==UO.GetY() Then UO.Print("Zasada!") return -1 Else return 1 Endif end sub
|