Yoko

All sides of Injection
It is currently 2026-01-16 13:14:30

All times are UTC+02:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2010-01-11 11:58:29 
Offline

Joined: 2005-01-21 15:45:19
Posts: 31
Помогите пожалуйста, нашёл скрипт который вроде как сам должен подходить к цели, но работает как-то странно, если идёт то уходит вроде тока на WN вне зависимости где цель, помогите поменять условия так что бы чар держался на растоянии удара от цели. спасибо

Code:
sub main()
WalkN(0,0,'lasttarget')
end sub

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()
         If UO.GetDistance(Target)<1 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 Target<>"" AND uo.GetDistance(Target)<=1 then         
         Exit=1
      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('cliloc# 0x9ED5')
end sub


Top
   
 Post subject:
PostPosted: 2010-01-12 15:11:40 
Offline

Joined: 2005-04-19 18:00:29
Posts: 2259
Location: Московская область
Запускать:
Code:
sub GoGo()
  uo.AddObject('npc')
  while uo.Targeting()
    wait(100)
  wend
  Go_To(uo.GetX('npc'),uo.GetY('npc'))
end sub


Вставить в этом же файле:
Code:

sub Step(x,y,mx,my,forstep)
  if uo.GetX('self') <> x then
    if uo.GetY('self') <> y then
      if mx<0 then
        if my<0 then
          uo.Press(40)
          wait(forstep)
        else
          uo.Press(39)
          wait(forstep)
        end if
      else
        if my<0 then
          uo.Press(37)
          wait(forstep)
        else
          uo.Press(38)
          wait(forstep)
        end if
      end if
    else
      if mx<0 then
        uo.Press(34)
        wait(forstep)
      else
        uo.Press(36)
        wait(forstep)
      end if
    end if
  else
    if my<0 then
      uo.Press(35)
      wait(forstep)
    else
      uo.Press(33)
      wait(forstep)
    end if
  end if
end sub

sub Go_To(x,y)
var mx,my,fx,fy
  var xx=x
  var yy=y
  var DistX=0
  var DistY=1
  var forstep=300
 
  repeat
    mx=uo.GetX('self')-x
    my=uo.GetY('self')-y
    fx=mx+x
    fy=my+y
    Step(xx,yy,mx,my,forstep)
  until x==fx+DistX && y==fy+DistY || x==fx-DistX && y==fy+DistY || x==fx+DistX && y==fy-DistY || x==fx-DistX && y==fy-DistY || x==fx && y==fy
end sub


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited