Page 1 of 1

Помогите еще с 1 скриптом.... утт кж посложнее

Posted: 2007-12-13 13:17:45
by Mopozz
У меня не передвигается к личу после того как атачит его...
Line19: function not found - WalkN

Code: Select all

sub Attack() 
uo.set('finddistance','10')
DIM R[5]
R[1] = 0x0018 # Тип Lich.
R[2] = 0x0018
R[3] = 0x0018
R[4] = 0x0018
R[5] = 0x0018
VAR LastTimer, Attack
var a
repeat
for a=1 to 5
UO.DeleteJournal()
UO.FindType(R[a],-1,'ground')
if UO.FindCount("finditem")>0 then
Attack=UO.GetSerial('finditem')
UO.Exec('warmode 1')
UO.Attack(Attack)
WalkN(0,0,Attack)
LastTimer=UO.Timer()
repeat
wait(2000)
until uo.dead(Attack) or UO.InJournal('Body') OR LastTimer+150<UO.Timer()
endif
wait(500)
next
wait(200)
until uo.dead()
wait(200)
Looting()
end sub


Хелп плиз...пол дня ковыряюсь....

Posted: 2007-12-13 13:24:29
by stickman
дык чтоб он передвигался как раз таки нужна эта передвигалка WalkN

Code: Select all

#============================================================== 
#  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(5134,1086,'') - 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 
        ToHide()
      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

Posted: 2007-12-13 13:29:40
by Mopozz
48 строка ToHide()
что то на эту строку ругается....

Posted: 2007-12-13 13:34:34
by stickman
удали ее нафиг :lol:

Posted: 2007-12-13 13:37:44
by Mopozz
так... эфект опеределенный есть... но...он идет не к личу а ввурх куда то )

Posted: 2007-12-13 14:02:58
by stickman
кароч вот.. я протестил. все работает

Code: Select all

sub Attack() 
uo.set('finddistance','10')
DIM R[5]
R[1] = 0x0018 # Òèï Lich.
R[2] = 0x0018
R[3] = 0x0018
R[4] = 0x0018
R[5] = 0x0018
VAR LastTimer, Attack
var a
repeat
for a=1 to 5
UO.DeleteJournal()
UO.FindType(R[a],-1,'ground')
if UO.FindCount("finditem")>0 then
Attack=UO.GetSerial('finditem')
UO.Exec('warmode 1')
UO.Attack(Attack)
WalkN(0,0,Attack)
LastTimer=UO.Timer()
repeat
wait(2000)
until uo.dead(Attack) or UO.InJournal('Body') OR LastTimer+150<UO.Timer()
endif
wait(500)
next
wait(200)
until uo.dead()
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(5134,1086,'') - 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

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

Posted: 2007-12-13 14:03:55
by stickman
с лутом думаю сам разберешься ,)

Posted: 2007-12-13 14:16:32
by Mopozz
все круто, вс еработает..но ты преувеличиваешь мои возможности ))
что то не полчается чтоб после убийства он переходил к sub Looting ((

Posted: 2007-12-13 14:19:41
by Destruction
until uo.dead(Attack) or UO.InJournal('Body') OR LastTimer+150<UO.Timer()

После этого поставить Looting() и всё.. Наверное.. :)

Posted: 2007-12-13 14:21:35
by stickman
вот лутинг.. не забудь в скрипт вписать этот looting()
и в массивах соотв. типы поменя на то что тебе нужно лутать :)

Code: Select all

sub Looting() 
var t,l
t=400                           
uo.UseObject('lastcorpse')
wait(t)
dim Loot[28]             
uo.Print('Go...')

     Loot[0]=0x13B9 ; Viking Sword
     Loot[1]=0x0EED ; gp
     Loot[2]=0x1B76 ; Shield
     Loot[3]=0x1412 ; Kaska
     Loot[4]=0x1413 ; Gorget
     Loot[5]=0x1415 ; Telo
     Loot[6]=0x1411 ; Nogi
     Loot[7]=0x1410 ; Plechi
     Loot[8]=0x1414 ; Perchatkazzz
     Loot[9]=0x143E ; Alebardiii
     Loot[10]=0x1F52 ; Paralize
     Loot[11]=0x0F7E ; bones
     Loot[12]=0x0F78 ; batwings
     Loot[13]=0x0F91 ; wyrm's heart
     Loot[14]=0x1086 ; Mana Braclet
     Loot[15]=0x1086 ; Maisi #####
     Loot[16]=0x13B1 ; Bow
     Loot[17]=0x13B5 ; Scmitar
     Loot[18]=0x13FE ; Katana
     Loot[19]=0x0F79 ; Blackmoor
     Loot[20]=0x14EF ; DeeD
     Loot[21]=0x13FC ; Crosbow
     Loot[22]=0x0F60 ; Logsword
     Loot[23]=0x1406 ; War Mace
     Loot[24]=0x0F8E ; Serpent Scales
     Loot[25]=0x14EB ; Treassure Map
     Loot[26]=0x0F79 ; Blackmoor
     Loot[27]=0x0F3F ; Arrow
     Loot[28]=0x1BD1 ; Feathers

carve()
for l=1 to 28                       
uo.FindType(Loot[l],"-1","lastcorpse")
if uo.FindCount()>0 and uo.GetDistance("lastcorpse")<=2 then
uo.MoveItem( "finditem", "0", "ID=0x4036BC34")
uo.Print('Looting: '+str(uo.findcount()))
wait(t)
uo.Print('Stop.')
end if
next
end sub

Sub carve()
  var carve_tool
  var carve_tool2
  uo.waittargetobject('lastcorpse')
  carve_tool=uo.ObjAtLayer('Lhand')
  wait(100)
  carve_tool2=uo.ObjAtLayer('Rhand')
  uo.useobject(carve_tool)
  wait(100)
  uo.useobject(carve_tool2)
  CheckLag()
  UO.Set('finddistance', '11')
  UO.FindType(0x2006, -1,'ground')
  uo.usefromground("0x0E75")
end sub

Posted: 2007-12-13 14:41:44
by Mopozz

Code: Select all

until uo.dead(Attack) or UO.InJournal('Body') OR LastTimer+150<UO.Timer()


такая строка у меня есть... но толку от нее ноль.. (
не лутит...

Posted: 2007-12-13 15:13:05
by Mopozz
Все заработало...
лут правда открывает сек через 30 но это фигня...
и еще кил гамп не закрывает...
я сначало подумал что это фигня... но потом обнаружил что елси он убивает следующего, то не собирает с него лут ((