Добавление в скрипт !

Ask for scripts here

Moderators: Murderator+, Murderator

Post Reply
Mama23
Posts: 2
Joined: 2008-04-11 22:27:45

Добавление в скрипт !

Post by Mama23 »

У меня старый скрипт ламбера к которому я сильно привык за несколько лет :)
1)в него надо добавить убийство рипера с одеванием лука(без лута)

2)Особенности шарда что игрок сам вырубает логи пока они не закончатся в дереве, а в моем скрипте после того как логи упали в пак он заного пытается рубить и срывает ламбер :You stop Lumberjacking: " Это не проблема но на каждом дереве теряется 3 секунды :cry:

Ниже сам скрипт и то что надо вставить

Code: Select all


###############################################################
##############################1################################
;                                              ##
;                     Lumber                      ##
;                                              ##
##############################1################################
###############################################################

; Полуавтомат. Анализ

sub Record()                                                                                                         
var i=0,j=0,k=0,r=0,q=0,ii,jj, a=0                                                                                                   
dim TreeX[700], TreeY[700],TreeT[700]                                                                                       
dim TreeTile[700]
var Exit=0                                                                                                      
var flag=0,treeCount=0,clicks=0,flag2=0                                                                                       
UO.SetGlobal('EndRecord','Off')
            #Графика деревьев                                                                        
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("filterspeech on")                                                                                                
uo.exec("filterspeech add 'Where do you want to use the pickaxe?'")                                                                  
                                                                                                                  
                                                                                                                  
#Собираем координаты из клиента                                                               
uo.print('Lets get the coords...')
while Exit==0                                                                                                                                                                                                
      clicks=0                                                                                                      
      flag=0                                                                                                         
      uo.DeleteJournal()                                                                                                
                              #Кликаем на тайл                                                                        
      uo.usetype('0x0e85')                                                                                             
      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 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('Tree found: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2))+' '+str(treeCount))                                                  ##
         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('Naideno derevo: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2))+' '+str(treeCount))                                             ##
         end if                                                                                                      ##
      end if
   If UO.GetGlobal('EndRecord')=='On' Then
         Exit=1
      Endif
wend
uo.exec("filterspeech off")                                                                                                ##
uo.print('Analiz zakoncen: C:\trees.dat')                                                                                    ##
SaveToFile(treeCount,TreeX,TreeY,TreeT)                                                                                       ##
                                                                                                            ##
uo.print('Derevyev naydeno: '+str(treeCount))                                                                                 ##
wait(2000)                                                                                             ##
end sub   

sub OnEndRecord()
; Assign on Num / in hotkeys
   UO.SetGlobal('EndRecord','On')
end sub


###############################################################
#(c) Elthar (Duo) and Enemy (Velzevul) Guild KPOT
#28.01.04
###############################################################
###                  Инструкции по применению               ###
###############################################################
### Во время работы скрипта рекомендуется не говорить,
### это будет тормозить его выполнение, хотя и не смертельно.
### Вердату желательно иметь нормальную, не с пеньками вместо
### деревьев.
###
### 1. До запуска скрипта в бэкпаке должно быть: любой топор,
### кирка (a pickaxe); если надо, чтобы чар реколился домой и
### складывал логи, то еще две руны и спеллбук с реколом, либо рунбука.
### 2. Марчим одну руну куда-нить в безопасное место (например,
### в дом), вторую туда, где хотим рубить. Идем туда, врубаем
### скрипт. Руны засовывать в рунбук в следующем порядке:
### руну к сейфу в 3 слот, руну в лес в пятый слот
### 3. Появится прицел и мессага "Выберите топор". Кликаем на
### топор. Если переменная TryRecall=1 то так же выбираем
### сначала руну домой, потом руну в лес. Если вы рекалитесь с рунбуки то указать рунбуку.
### Нужно обязательно проверить, хватает ли регов или свитков,
### иначе чар застрянет посреди леса.
### 4. Если переменная GetFromFile=1, то скрипт считает из файла
### координаты деревьев и сразу побежит к первому дереву. Если
### GetFromFile=0, то начнется анализ территории. ВО ВРЕМЯ АНАЛИЗА
### ОКНО КЛИЕНТА ДОЛЖНО БЫТЬ АКТИВНО, И КУРСОР ДОЛЖЕН НАХОДИТЬСЯ
### НА ИГРОВОМ ПОЛЕ!!! Можно менять переменную Area от 1 до 4,
### чтобы увеличивать/уменьшать размер территории для анализа.
### Сколько выбирать, зависит от густоты леса и скилла Ламбера,
### пробуй сам.
### 5. Когда база загрузится, появится соответствующая мессага,
### и начнется бесконечный цикл на обход деревьев. Он происходит
### так: идем к дереву; если переменная TryHiding=1 то пытаемся
### уйти в хайд; начинаем рубить логи, пока все не вырубим, или
### пока не кончится таймер (30 ударов); если переменная
### TryRecall=1 и логов больше чем переменная LogsQty, то
### реколимся домой, складываем логи на пол, реколимся обратно;
### идем к следующему дереву и все повторяется сначала.
### Руну к сейфу нужно марчить так, чтобы после рекола он имел сейф в прямой досягаемости
### Вот собственно и все! Enjoy it!
### Для нормального анализа вердата должна быть не с пеньками а с полноценными деревьями
### Айдишник сейфа прописывать в процедуре Unload()
###############################################################



sub Lumber()
var i=0,j=0,k=0,r=0,q=0,ii,jj, a=0
var TopX=324,TopY=65                
dim TreeX[300], TreeY[300],TreeT[300]
dim TreeTile[300]
var flag=0,treeCount=0,clicks=0,flag2=0
var f=file("C:\trees.dat")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var Area=1       ## Размер обрабатываемой территории, можно менять от 1 до 4.

var TryHiding=0    ## 1 - перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет

var TryRecall=1  ## 1 - после того как соберет LogsQty логов, будет пытаться реколиться домой,              # складывать логи на пол и реколиться обратно (нужно выбрать две руны), 0 - не будет.   

var LogsQty=450    ## Количество логов, добыв которое надо реколиться домой.

var RecallFromScroll=0 ## 1 - с рун, 0 - из рунбука

var GetFromFile=1 ## 1 - координаты деревьев будут считыватся из файла, 0 - собиратся из клиента

var Const=1 ## во сколько раз увеличивать размер тестовой территории (коэффициент)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

                              #Графика деревьев
TreeTile[0]=3283                              
TreeTile[1]=3277
TreeTile[2]=3293
TreeTile[3]=3296
TreeTile[4]=3302
TreeTile[5]=3299
TreeTile[6]=3290
TreeTile[7]=3288
TreeTile[8]=3286
TreeTile[9]=3280

uo.exec("filterspeech on")
uo.exec("filterspeech add 'Where do you want to use the pickaxe?'")

uo.print('Выбери топор: ')
uo.exec('addobject axe')
wait(5000)

if TryRecall==1 then
   
   uo.print('Выбери Рунбуку:' )
   uo.exec('addobject Runebook')
   wait(5000)         
   
   if RecallFromScroll==1 then
      uo.print('Выбери руну домой: ')
      uo.exec('addobject runeHome')
      wait(5000)
      uo.print('Выбери руну в лес: ')
      uo.exec('addobject runeLumber')
      wait(5000)   
   end if
end if

                              #Загружаем координаты из файла
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('Собираем координаты деревьев в округе...')
for a=1 to Const
for q=1 to Area
if q==2 then
   gotoxy(uo.getx()+20,uo.gety()-10)
end if   
if q==3 then
   gotoxy(uo.getx(),uo.gety()+20)
end if
if q==4 then
   gotoxy(uo.getx()-20,uo.gety())
end if
for r=0 to 3
if r==1 then
   gotoxy(uo.getx()+10,uo.gety())
end if
if r==2 then
   gotoxy(uo.getx(),uo.gety()+10)
end if
if r==3 then
   gotoxy(uo.getx()-10,uo.gety())
end if
for j=0 to 8
   for i=0 to 8
      clicks=0
      flag=0
      uo.DeleteJournal()
                              #Кликаем на тайл
      uo.usetype('0x0e85')
      waitForTarget()
      uo.DeleteJournal()
      uo.LClick(TopX+i*21-j*21,TopY+i*21+j*21)
      WaitForTryRock()
                              #Проверяем дерево ли это
      flag=0
      for k=0 to 9
         if uo.LastTile(0)==TreeTile[k]+1 then
            flag=2
         end if
      next
      if flag==0 then
         for k=0 to 9
            if uo.LastTile(0)==TreeTile[k] then
               flag=1
            end if
         next
      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('Найдено дерево: 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('Найдено дерево: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))            
         end if   
      end if         
next   
next
next
next
next
uo.exec("filterspeech off")
uo.print('Анализ закончен, координаты деревьев записаны в файл C:\trees.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 TryRecall==1 AND uo.Count('ZLK')>=LogsQty then
            ToRecall(RecallFromScroll)
         end if
         uo.print('Идем к дереву '+str(i)+': x='+str(treex[i])+' y='+str(treey[i]))         
         flag=gotoxy(treex[i],treey[i])
         if flag==1 then   
            if TryHiding==1 then
               ToHide()
            end if         
            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
      wait(200)
      uo.deletejournal()
      uo.waittargettile(type,x,y,z)
      uo.useobject('axe')
      if WaitForChange()==1 then
         return 1
      end if   
   next
   return 0
end sub

sub ToRecall(FromScroll)
    RecallToHome(FromScroll)
    wait(1000)
    Unload()
    wait(1000)
    RecallToLumber(FromScroll)
end sub


sub RecallToHome(FromScroll)
var i
   uo.print('Реколимся домой...')
   for i=1 to 10
      uo.deletejournal()
      if FromScroll==0 then
         RecallRunebookhome()
      else
         uo.waittargetobject('runeHome')
         uo.cast('Recall')
      end if
      if WaitForRecall()==1 then
         return 1
      end if
   next
   return 0
end sub


sub RecallToLumber(FromScroll)
var i
   uo.print('Реколимся обратно...')
   for i=1 to 10
      uo.deletejournal()
      if FromScroll==0 then
         RecallRunebookles()
      else
         uo.waittargetobject('runeLumber')
         uo.cast('Recall')
      end if
      if waitForRecall()==1 then
         return 1
      end if
   next
   return 0
end sub

sub ToHide()
var i
   uo.print('Пытаемся уйти в хайд...')
   for i=1 to 15      
      uo.deletejournal()
      uo.useskill('Hiding')
      if WaitForHide()==1 then
         return 1
      end if
   next
   return 0      
end sub

sub WaitForRecall()
var Text1=uo.getname()+": The spell fizzles."
var mess='',lastX=uo.getX(),lastY=uo.getY()
   for var i=0 to 400
      mess=uo.journal(0)
      if uo.Journal(0)==Text1 then
         return 0
      end if
      if uo.getX()<>lastX OR uo.getY()<>LastY then
         return 1
      end if
      wait(50)
   next
   return 0
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 is nothing here to chop.'
var Text3="You can't reach this."
var mess
   for var i=0 to 200
      mess=uo.journal(0)
      if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 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 abs(x-myX)<=1 AND abs(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 abs(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:\trees.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 main()
Lumber()
end sub

sub Unload()
var UnloadCont='0x400ABAC0' #айди сейфа
ToHide()
VAR Exit, i
DIM Ore[5]
Ore[0]=0x1bdd
Ore[1]=0x1bdd
Ore[2]=0x1bdd
Ore[3]=0x1bdd

UO.SetReceivingContainer(UnloadCont) ; storecontainer
wait(500)


For i=0 to 3
Exit=0
repeat
UO.FindType(Ore[i])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
CheckLag()
wait(1500)
Else
Exit=1
endif
until Exit==1
Next

UO.UnSetReceivingContainer()
end sub

sub CheckLag()
   UO.DeleteJournal()
   UO.Click('backpack')

      repeat
      wait(500)
   until UO.InJournal('backpack')
end sub

sub RecallRunebookhome()
ToHide()
UO.UseObject('Runebook')
wait(500)
UO.LClick(135,99)
wait(1000)
end sub

sub RecallRunebookles()
ToHide()
Uo.UseObject('Runebook')
wait(500)
UO.LClick(135,129)
wait(1000)
end sub










Вот нашел поиском Ламбер заточеный под мой шард но он не пашен
Испорчено начало скрипта ошибка Unhandled exception in parsen


Code: Select all


##########################################################
###      Lumberjacking / v6.8 (Last)    ###
##########################################################

##################
### Peremennije ##
##################
###################################################################################################
var f=file("C:\trees3.dat") ## - ???? ? ????? ? ??????? ????? ???????? ?????????? ????????.
###
var LogsQty=600 ## - ?????????? ?????, ????? ??????? ???? ?????????? ?????.
###
var GetFromFile=1 ## 1 - ?????????? ???????? ????? ?????????? ?? ?????, 0 - ????????? ?? ???????
### (??????? ???????? ? ????? ?????????? ?? ?????).
###
var Attack=1 ## 1 - ???????? ????? ?? ????(? ????) ??? ?????, 0 - ????????? ?????.
### 
var AM=1 ## 1 - ???????? ????? ?? ????(? ????) ??? ?????, 0 - ????????? ?????.
###
var EatingFood=0 ## 1 - Aoaai anou, 0 - iao.
###
var TypeFood='0x097B' ## - Oei aau eioi?o? aoaai eooaou.(nae?an oeooaeee)
###
var Chest='0x40016ADD' ## - ID noiaoea eoaa aoaoo aua?o?aouny eiae.
###
var Trytodrop=1 ## Aoaai iuoaony iiaoiaeou e noiaoeo eee iao.
###
var ContX=1558 ##Eii?aeiaou X o noiaoea
###
var ContY=2655 ##Eii?aeiaou Y o noiaoea
###
var LumberSound=('D:\Ultima Online\inj\alert.wav') ## - ???? ?????? ????? ??????? ??? ?????.(???????? ?? ????)
###
var LumberSound1=('D:\Ultima Online\inj\alert.wav') ## - ???? ?????? ????? ??????? ??? ?????.(???????? ?? ????)
###
var oldX,oldY,time ## - ??? ??????.
###
################################################################################################### 
###########
### Kod ###
###########
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
########################
### Grafika Dervjev ###
########################
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("filterspeech on")
uo.Exec("filterspeech add 'Where do you want to use the pickaxe?'")

uo.Print('Viberi Tapor: ')
uo.Exec('addobject Axe')
while uo.Targeting()
wait(100)
wend

if Attack==1 then
uo.Exec('exec Attack')
end if

if AM==1 then
uo.Exec('exec AAmacro')
end if


#####################################
### Zagruzaem koordinati iz faila ###
#####################################
if GetFromFile==1 then
uo.Print('Zagruzaem koordinati iz faila...')
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
######################################
### Sobiraem koordinati iz clienta ###
######################################
uo.Print('Viberi kirku: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print('Sobiraem koordinati derevjev v okruge...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Klikaem na tail ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
###############################
### Proverjaem derevoli eto ###
###############################
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
#########################
### Kliknuli na stvol ###
#########################
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('Naideno derevo '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))+' '+str(treeCount))
end if
end if
##########################
### Kliknule po listve ###
##########################
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('Naideno derevo '+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('Analiz zakoncen, koordinati derevjev zapisani v fail C:\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Derevo naideno: '+str(treeCount))
wait(2000)
######################################
### Hodim po sobranim koordinatam  ###
######################################
while 1==1
if treeCount>0 then
for i=1 to treeCount
if Trytodrop==1 and uo.Count('ZLK')>=LogsQty or uo.InJournal('It is too heavy..') then
GotoXY(uo.getx(Chest),uo.gety(Chest))
DropLogs()
end if
end if
uo.Print('Idjom k derevu '+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('Nacinaem rubitj derevo...')
for i=0 to 15
if uo.Warmode()==1 then
return 0
end if
wait(200)
uo.DeleteJournal()
CheckLag()
uo.WaitTargetTile(Type,X,Y,Z)
uo.UseObject('Axe')
if WaitForChange()==1 then
return 1
end if
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="It appears immune to your blow"
var Text4="There is nothing here to chop."
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
while NOT UO.InJournal("There is nothing")
wait(500)
if uo.InJournal('Reaper')or uo.InJournal('is attacking you') then
ReaperDanger()
wait(1000)
return 1
end if
wend
end if
if uo.InJournal('Reaper')or uo.InJournal('is attacking you')or uo.InJournal('wisp')or uo.InJournal('Bear')or uo.InJournal('Wolf') then
ReaperDanger()
return 1
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(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(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()
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('U vas vsego'+str(uo.Count('0x1BDD'))+' logov v sumke')
uo.Print('Iz nih '+str(uo.Count('0x1BDD','0x0000'))+' prostih i ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' cvetnih')
end sub

sub Open(Container)
uo.DeleteJournal()
uo.UseObject(Container)
repeat
wait(500)
until uo.InJournal('Contains')
end sub

sub Attack()
uo.DeleteJournal()
var Enemy='0x00000000'
repeat
if uo.InJournal('is attacking you') or uo.InJournal('Reaper') or uo.InJournal('Wis Quas') then
uo.DeleteJournal()
end if
wait(1000)
if uo.InJournal('till') then
uo.DeleteJournal()
end if
wait(1000)
until false
end sub

sub ReaperDanger()
uo.DeleteJournal()
uo.Print('Viruble Reaper!')
killelem()
repeat
wait(3000)
uo.Print('Script na pauze!')
until uo.InJournal('GO')
uo.Print('Sript prodolzen!')
uo.DeleteJournal()
wait(1000)
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 Terminate()
uo.Print('Vse funkciji otlkljuceni!')
uo.DeleteJournal()
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
end sub

sub killelem()
   VAR Count,Elem     
   uo.equipt('Lhand','0x13B1')
   uo.useobject('finditem')
   wait(1000)
   uo.equipt('Rhand','0x13AF')
   UO.DeleteJournal()
   UO.Exec('warmode 1')

   UO.FindType('0x002F',-1,'ground')
   Elem=UO.GetSerial('finditem')
   wait (500)
   UO.Attack(Elem)
   
   repeat
      wait(1000)
      If UO.Life<150 Then
        UO.WaitMenu('Camping','Healing Campfire')
        UO.UseType(0x0DE1)
      Endif
       If UO.Life<50 Then
        UO.UseType(0x183A)
      Endif
   until UO.IsNPC(Elem)==0
   wait(3000)
   UO.Exec('warmode 0')
   wait(1000)

   UO.Print("Sdoh skotina!")
UO.Say('GO')
loot()
wait(10000)
UO.Say('GO')
end sub

Sub EatingFood()
ToEat()
end sub

Sub ToEat()
uo.SetReceivingContainer('backpack')
Open(Chest)
wait(500)
UO.FindType("0x0DE1" )   
UO.moveitem ('finditem' ,1000, chest)
wait(500)
uo.FindType('0x0DE1','-1',Chest)
uo.Grab('10','finditem')
wait(500)
uo.UnsetReceivingContainer()
end sub

Sub DropFood()
if uo.Waiting() then
uo.CancelTarget()
end if
var f,Exit
dim Food[1]
Food[0]=TypeFood
uo.SetReceivingContainer(Chest)
wait(500)
for f=0 to 0
Exit=0
repeat
uo.FindType(Food[f])
if uo.GetQuantity('finditem')>0 then
uo.Grab('0','finditem')
wait(1500)
else
Exit=1
end if
until Exit==1
next
uo.UnSetReceivingContainer(Chest)
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 GetXY(str,arnum)
   arnum[0]=val(mid(str, 7, 3))
   arnum[1]=val(mid(str, 10, 3))
end sub

sub decode()
var temp='',i=0
var pos=0
var line=5
var sX=0, sY=0
var code=''
var finding = 1
var CurrX=0
var CurrY=0
var NumSum
dim tempXY[2]
dim Num[9]
Num[0]=6
Num[1]=35
Num[2]=45
Num[3]=-24
Num[4]=34
Num[5]=-5
Num[6]=26
Num[7]=4
Num[8]=-6
   Repeat
      temp=uo.LastGump('command',line)
      GetXY(temp, tempXY)
      if pos >= 17 then
         if pos == 17 then
            NumSum=(CurrX-sX)*10+(CurrY-sY)
            finding = 1
            i=0
            while finding 
               if NumSum == num[i] then
                  code=code+str(i+1)
                  finding = 0
               end if
               i=i+1
            wend
         end if
         if tempXY[0]-CurrX > 5 then
            pos=0
         end if
      end if
      if not pos then
         sX=tempXY[0]
         sY=tempXY[1]
         pos=15
         line=line+15
      end if
      CurrX=tempXY[0]
      CurrY=tempXY[1]
      pos=pos+1
      line=line+1
   Until len(code) == 4
   return code
end sub

sub AAmacro()
   while not uo.dead()
      if uo.LastGump('text',0) == 'enter anti macro code:' and uo.LastGump('replyed') == 0 then
         uo.lclick(uo.LastGump('x')+75, uo.LastGump('y')+69)
         wait(300)
         uo.say(decode())
         wait(300)
         uo.lclick(uo.LastGump('x')+77, uo.LastGump('y')+108)
      end if
      wait(1000)
   wend
end sub

sub loot()
 var corpse='0x2006'
 var waittime=1000
 var body,bodypack,i
 DIM Loot[12]
 Loot[0]=0x09AA
 Loot[1]=0x1541
 Loot[2]=0x0EED
 Loot[3]=0x1BDD
 Loot[4]=0x141A
 Loot[5]=0x1416
 Loot[6]=0x1410
 Loot[7]=0x1417
 Loot[8]=0x1418
 Loot[9]=0x1419
 Loot[10]=0x0E76
 Loot[11]=0x1413
 Loot[12]=0x1086
 uo.set('finddistance','2')
  while uo.countonground(corpse)>0
   uo.findtype(corpse,'-1','ground')
   body=uo.getserial('finditem')

   uo.useobject('backpack')

   repeat
    wait(100)
   until uo.getserial('lastcontainer')==uo.getserial('backpack')

   uo.useobject(body)
   repeat
    wait(100)
   until uo.getserial('lastcontainer')<>uo.getserial('backpack')

   bodypack=uo.getserial('lastcontainer')
   For i=0 to 12
    repeat
     UO.FindType(Loot[i],-1,bodypack)
     if UO.GetQuantity('finditem') then
      UO.MoveItem('finditem','backpack')
      repeat
       wait(100)
      until uo.containerof('finditem')==uo.getserial('backpack')
      wait(waittime)
     endif
    until uo.findcount()==0
   next
   uo.ignore(body)
  wend
endsub





То что надо вставить из 2го в первый !
Это еда , килл рипера , кэмпинг , можно и лут моба +одевание лука
А еще проще исправить начало второго скрипта но там я рун буки не видел




Это вырезки который поидеи я мог вставить в свой скрипт но не получилось ((

Code: Select all


sub ReaperDanger()
uo.DeleteJournal()
killelem()
uo.DeleteJournal()
wait(1000)
end sub



Code: Select all


sub killelem()
   VAR Count,Elem     
   uo.equipt('Lhand','0x13B1')
   uo.useobject('finditem')
   wait(1000)
   uo.equipt('Rhand','0x13AF')
   UO.DeleteJournal()
   UO.Exec('warmode 1')

   UO.FindType('0x002F',-1,'ground')
   Elem=UO.GetSerial('finditem')
   wait (500)
   UO.Attack(Elem)
   
   repeat
      wait(1000)
      If UO.Life<150 Then
        UO.WaitMenu('Camping','Healing Campfire')
        UO.UseType(0x0DE1)
      Endif
       If UO.Life<50 Then
        UO.UseType(0x183A)
      Endif
   until UO.IsNPC(Elem)==0
   wait(3000)
   UO.Exec('warmode 0')
   wait(1000)

   UO.Print("Sdoh skotina!")
UO.Say('GO')
loot()
wait(10000)
UO.Say('GO')
end sub




Code: Select all


sub Attack()
uo.DeleteJournal()
var Enemy='0x00000000'
repeat
if uo.InJournal('is attacking you') or uo.InJournal('Reaper') or uo.InJournal('Wis Quas') then
uo.DeleteJournal()
end if
wait(1000)
if uo.InJournal('till') then
uo.DeleteJournal()
end if
wait(1000)
until false
end sub


и наверно это пригодится WaitForChange

Code: Select all


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="It appears immune to your blow"
var Text4="There is nothing here to chop."
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
while NOT UO.InJournal("There is nothing")
wait(500)
if uo.InJournal('Reaper')or uo.InJournal('is attacking you') then
ReaperDanger()
wait(1000)
return 1
end if
wend
end if
if uo.InJournal('Reaper')or uo.InJournal('is attacking you')or uo.InJournal('wisp')or uo.InJournal('Bear')or uo.InJournal('Wolf') then
ReaperDanger()
return 1
end if
wait(50)
next
return 0
end sub





Code: Select all


sub AAmacro()
   while not uo.dead()
      if uo.LastGump('text',0) == 'enter anti macro code:' and uo.LastGump('replyed') == 0 then
         uo.lclick(uo.LastGump('x')+75, uo.LastGump('y')+69)
         wait(300)
         uo.say(decode())
         wait(300)
         uo.lclick(uo.LastGump('x')+77, uo.LastGump('y')+108)
      end if
      wait(1000)
   wend
end sub




Кому не трудно помогите разобраться что бы это все работало в куче[/code]
Mama23
Posts: 2
Joined: 2008-04-11 22:27:45

Post by Mama23 »

Спасибо за никакую помощь ) но если кому понадобится кроме меня

Code: Select all

################## 
### Peremennije ##
##################
################################################################################
##################
var f=file("C:\trees5.dat") ## - Путь к файлу в котором будут хранится координаты деревьев.
###
var LogsQty=500 ## - Количество логов, добыв которое надо реколиться домой.
###
var GetFromFile=1 ## - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
###
var Attack=0 ##  - bred
###
var Chest='0x40065598' ## - ID сундука куда будут выгружаться логи
###
var Trytodrop=1 ##
###
var ContX=925 ## - Координаты X у сундука
###
var ContY=2564 ## - Координаты Y у сундука
###
var oldX,oldY,time ##
###
################################################################################
################## 
###########
### Kod ###
###########
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
########################
### Grafika Dervjev ###
########################
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("filterspeech on")
uo.Exec("filterspeech add 'Where do you want to use the pickaxe?'")

uo.Print('Viberi Tapor: ')
uo.Exec('addobject Axe')
while uo.Targeting()
wait(100)
wend

if Attack==1 then
uo.Exec('exec Attack')
end if



#####################################
### Zagruzaem koordinati iz faila ###
#####################################
if GetFromFile==1 then
uo.Print('Zagruzaem koordinati iz faila...')
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
######################################
### Sobiraem koordinati iz clienta ###
######################################
uo.Print('Viberi kirku: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print('Sobiraem koordinati derevjev v okruge...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Klikaem na tail ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
###############################
### Proverjaem derevoli eto ###
###############################
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
#########################
### Kliknuli na stvol ###
#########################
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('Naideno derevo '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))+' '+str(treeCount))
end if
end if
##########################
### Kliknule po listve ###
##########################
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('Naideno derevo '+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('Analiz zakoncen, koordinati derevjev zapisani v fail C:\trees5.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Derevo naideno: '+str(treeCount))
wait(2000)
######################################
### Hodim po sobranim koordinatam  ###
######################################
while 1==1
if treeCount>0 then
for i=1 to treeCount
if Trytodrop==1 and uo.Count('ZLK')>=LogsQty or uo.InJournal('It is too heavy..') then
GotoXY(uo.getx(Chest),uo.gety(Chest))
DropLogs()
end if
end if
uo.Print('Idjom k derevu '+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('Nacinaem rubitj derevo...')
for i=0 to 15
if uo.Warmode()==1 then
return 0
end if
wait(200)
uo.DeleteJournal()
CheckLag()
uo.WaitTargetTile(Type,X,Y,Z)
uo.UseObject('Axe')
if WaitForChange()==1 then
return 1
end if
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="There is nothing here to chop."
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
while NOT UO.InJournal("There is nothing")
wait(500)
if uo.InJournal('Reaper')or uo.InJournal('is attacking you') then
ReaperDanger()
wait(1000)
return 1
end if
wend
end if
if uo.InJournal('Reaper')or uo.InJournal('is attacking you') then
ReaperDanger()
return 1
end if
wait(50)
next
return 0
end sub

Sub WaitForTryRock()
var Text1="That is too far away."
var Text2="Try mining elsewhere."
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(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(treeCount,TreeX,TreeY,TreeT)
var f=file("C:\trees5.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()
if uo.Waiting() then
uo.CancelTarget()
end if
var a,Exit
dim Logs[2]
Logs[0]=0x1BDD
Logs[1]=0x0EED
uo.Print('.')
uo.SetReceivingContainer(Chest)
wait(500)
for a=0 to 1
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
uo.UnSetReceivingContainer(Chest)
uo.Print('.')
end sub

sub InfoLogs()
uo.Print('U vas vsego'+str(uo.Count('0x1BDD'))+' logov v sumke')
uo.Print('Iz nih '+str(uo.Count('0x1BDD','0x0000'))+' prostih i ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' cvetnih')
end sub

sub Open(Container)
uo.DeleteJournal()
uo.UseObject(Container)
repeat
wait(500)
until uo.InJournal('Contains')
end sub

sub Attack()
uo.DeleteJournal()
var Enemy='0x00000000'
repeat
if uo.InJournal('is attacking you') or uo.InJournal('Reaper') or uo.InJournal('Wis Quas') then
uo.DeleteJournal()
end if
wait(1000)
if uo.InJournal('till') then
uo.DeleteJournal()
end if
wait(1000)
until false
end sub

sub ReaperDanger()
uo.DeleteJournal()
killelem()
uo.DeleteJournal()
wait(1000)
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 Terminate()
uo.Print('Vse funkciji otlkljuceni!')
uo.DeleteJournal()
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
end sub

sub killelem()
   VAR Count,Elem     
   uo.equipt('Lhand','0x13B1')
   uo.useobject('finditem')
   wait(1000)
   uo.equipt('Rhand','0x13AF')
   UO.DeleteJournal()
   UO.Exec('warmode 1')

   UO.FindType('0x002F',-1,'ground')
   Elem=UO.GetSerial('finditem')
   wait (500)
   UO.Attack(Elem)
   
   repeat
      wait(1000)
      If UO.Life<150 Then
        UO.say ('.camp')
      Endif
       If UO.Life<50 Then
        UO.UseType(0x183A)
      Endif
   until UO.IsNPC(Elem)==0
   wait(20000)
   UO.Exec('warmode 0')
   wait(1000)
loot()
wait(10000) 
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')
#BETEP™#
end sub


sub GetXY(str,arnum)
   arnum[0]=val(mid(str, 7, 3))
   arnum[1]=val(mid(str, 10, 3))
end sub



sub loot()
var corpse='0x2006'
var waittime=1000
var body,bodypack,i
DIM Loot[12]
Loot[0]=0x09AA
Loot[1]=0x1541
Loot[2]=0x0EED
Loot[3]=0x1BDD
Loot[4]=0x141A
Loot[5]=0x1416
Loot[6]=0x1410
Loot[7]=0x1417
Loot[8]=0x1418
Loot[9]=0x1419
Loot[10]=0x0E76
Loot[11]=0x1413
Loot[12]=0x1086
uo.set('finddistance','2')
  while uo.countonground(corpse)>0
   uo.findtype(corpse,'-1','ground')
   body=uo.getserial('finditem')

   uo.useobject('backpack')

   repeat
    wait(100)
   until uo.getserial('lastcontainer')==uo.getserial('backpack')

   uo.useobject(body)
   repeat
    wait(100)
   until uo.getserial('lastcontainer')<>uo.getserial('backpack')

   bodypack=uo.getserial('lastcontainer')
   For i=0 to 12
    repeat
     UO.FindType(Loot[i],-1,bodypack)
     if UO.GetQuantity('finditem') then
      UO.MoveItem('finditem','backpack')
      repeat
       wait(100)
      until uo.containerof('finditem')==uo.getserial('backpack')
      wait(waittime)
     endif
    until uo.findcount()==0
   next
   uo.ignore(body)
  wend
endsub

Post Reply