если можно с объяснениями и примерами что бы в дальнейшем я мог это проделать сам...
Code: Select all
var distance='8' # дистанция поиска
var corpser=1
var tweapon=uo.getserial(uo.objatlayer('Rhand')) #щит
var tshield=uo.getserial(uo.objatlayer('Lhand')) #меч
var mx,my
mX=uo.getX("self");
mY=uo.getY("self");
sub main()
var n, m, mob
   Dim npc[10]
   npc[0]=2 # сколлько раз
   npc[1]='0x002F' #   reaper
   npc[2]='0x0018' #   лич 0x0018
   
DIM Loot[100] 
  Loot[0]=72      ; 
  Loot[1]='0x0EED'  ; gp 
  Loot[2]='0x0F7B'  ; BM 
  Loot[3]='0x0F7A'  ; BP 
  Loot[4]='0x0F84'  ; GA 
  Loot[5]='0x0F85'  ; GI 
  Loot[6]='0x0F86'  ; MR 
  Loot[7]='0x0F88'  ; NS 
  Loot[8]='0x0F8C'  ; SA 
  Loot[9]='0x0F8D'  ; SS 
  
  Loot[10]='0x0F7E' ; bones
  Loot[11]='0x1413' ;arm 
  Loot[12]='0x1415' ;arm 
  Loot[13]='0x1411' ;arm 
  Loot[14]='0x1410' ;arm 
  Loot[15]='0x1414' ;arm 
  Loot[16]='0x0E21' ; bandages 
  Loot[17]='0x0F78' ; batw 
  Loot[18]='0x0E34' ; blank scroll
  Loot[19]='0x0F25' ; amber
  
  Loot[20]='0x0F28' ; diamonds
  Loot[21]='0x0F2D' ; tourmalines
  Loot[22]='0x0F2C' ; citrine
  Loot[23]='0x0F0F' ; star sapphires
  Loot[24]='0x0F17' ; amethysts
  Loot[25]='0x0F23' ; citrines
  Loot[26]='0x0F2F' ; emeralds
  Loot[27]='0x0F22' ; amethyst
  Loot[28]='0x0F24' ; citrines
  Loot[29]='0x0F10' ; emeralds
  
  Loot[30]='0x0F27' ; diamond
  Loot[31]='0x0F14' ; ruby
  Loot[32]='0x0F11' ; sapphires
  Loot[33]='0x0F18' ; tourmalines
  Loot[34]='0x0F26' ; diamonds
  Loot[35]='0x0F2E' ; amethysts
  Loot[36]='0x0F1B' ; star sapphires
  Loot[37]='0x0F20' ; tourmalines
  Loot[38]='0x0F1A' ; rubies
  Loot[39]='0x0F1C' ; rubies
  
  Loot[40]='0x0F16' ; amethysts
  Loot[41]='0x0F1D' ; ruby
  Loot[42]='0x0F15' ; citrines
  Loot[43]='0x0F1F' ; sapphires
  Loot[44]='0x0F1E' ; tourmalines
  Loot[45]='0x0F12' ; sapphire
  Loot[46]='0x0F21' ; star sapphire
  Loot[47]='0x0F2A' ; ruby
  Loot[48]='0x0E76' ; сумкa
  Loot[49]='0x0F19' ; sapphire
  
  Loot[50]='0x0F2B' ; ruby
  Loot[51]='0x0DF2' ; wand 
  Loot[52]='0x0DF3' ; wand 
  Loot[53]='0x0DF4' ; wand 
  Loot[54]='0x0DF5' ; wand 
  Loot[55]='0x1F69' ; Summon Daemon
  Loot[56]='0x1F66' ; Energy Vortex
  Loot[57]='0x0F13' ; ruby
  Loot[58]='0x0F30' ; diamond
  Loot[59]='0x1F29' ; diamond
  
  Loot[60]='0x0F3F' ; arrows  
  Loot[61]='0x0F29' ; diamond
  Loot[62]='0x0F29' ; diamond
  Loot[63]='0x0F29' ; diamond
  Loot[64]='0x0F29' ; diamond
  Loot[65]='0x0F29' ; diamond
  Loot[66]='0x0F29' ; diamond
  Loot[67]='0x0F29' ; diamond
  Loot[68]='0x0F29' ; diamond
  Loot[69]='0x0F29' ; diamond
  Loot[70]='0x0F29' ; diamond
  Loot[71]='0x0F90' ; DEADWOOD
  Loot[72]='0x1BDD' ; Logs
   
   uo.set('finddistance',distance)
    While NOT UO.Dead()
   
         for n=1 to npc[0]
         uo.findtype(npc[n],-1,'ground')
		    if uo.findcount() then
            uo.useobject(tweapon)
            uo.useobject(tshield)
            wait(100)
            mob=uo.getserial('finditem')
	    kill(mob)
            uo.useobject('lastcorpse')
            checklag()
            wait(1000)
            for m=1 to loot[0]
        while uo.getquantity('<'+loot[m])
            uo.moveitem('<'+loot[m])
            wait(700)
		wend
            next
            while uo.life<uo.str-20 # and uo.count('0x0E21')
			#UO.Cast('Greater Heal', 'self')
	        #uo.usetype('0x0F0E','0x09BB')               #     питье хила<=====
			UO.BandageSelf()
			wait(1000) 
			uo.useobject(tweapon)
			uo.useobject(tshield)
			wait(2500)
	    wend
            if uo.count('0x0E20') then
               uo.waittargettype('0x1008')
               uo.usetype('0x0E20')
               wait(1000)
            endif
         walkn(mX,mY,"")		#ИДТИ В НАЧАЛЬНЫЕ КООРДИНАТЫ
	else
		hide()
	endif
	next
      wait(1000)
   wend
endsub
Sub kill(mob)
   var n
   checklag()
   for n=0 to 100
      uo.attack(mob)
      if uo.getdistance(mob)>1 then
         walkn(0,0,mob)
      endif
      if uo.injournal('Body of') then
         if corpser==1 then
            uo.waittargetobject('lastcorpse')
            wait(100)
            uo.usetype('0x0F51')
            wait(500)   
         endif
         return
      endif
      wait(1000)
   next
endsub
Sub WalkN(x,y,Target) ########################################## Ходилка
   VAR LastTimer
   LastTimer=UO.Timer()
   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"
   uo.say('')   
   While Exit<>1   
      If Target<>"" Then
         dx=UO.GetX(Target)-UO.GetX()
         dy=UO.GetY(Target)-UO.GetY()         
         If UO.GetDistance(Target)<2 OR LastTimer+100<UO.Timer() Then
            wait(1000)
            return
         Endif
      Else
         dx=x-UO.GetX()
         dy=y-UO.GetY()
         If dx==0 AND dy==0 OR LastTimer+100<UO.Timer() Then
            return
         Endif
      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
end sub
Sub StepEdit(x,y,dir,key)
   VAR walkwait=450
   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
         ;zatik
         ErrLevel=1
      Endif
   Endif
   Return ErrLevel
end sub
Sub StepArrow(x,y,dir,ldir,rdir,key)
   VAR walkwait=450
   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
            ;zatik         
            ErrLevel=1
         Endif
      Endif
   Endif
   Return ErrLevel
end sub
Sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
Sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a backpack') then
         return 1
      endif
      wait(200)
   next
endsub 		
Sub hide()
    var failMessage = "You fail|You don't|You can't"
    var timeLeft = 0
    while not UO.Hidden()
		uo.exec("warmode 0")	
        UO.Useskill("Hiding") 
        DeleteJournal(failMessage) 
        timeLeft = 3000 
        while (not UO.Hidden()) AND (timeLeft > 0) AND (UO.InJournal(failMessage) == 0) 
            timeLeft = timeLeft - 100
            wait(100)
        wend
    wend
endsub
Sub DeleteJournal( string1 )
    VAR nom = UO.InJournal( string1 )
    If nom > 0 Then
        UO.SetJournalLine( Nom - 1, 'string replaced' )
        DeleteJournal( string1 )
    Endif
endsub
