Yoko

All sides of Injection
It is currently 2025-11-07 11:39:45

All times are UTC+02:00




Post new topic  Reply to topic  [ 11 posts ] 
Author Message
PostPosted: 2004-06-22 13:13:41 
Offline
Expert!
User avatar

Joined: 2004-04-04 11:13:54
Posts: 1205
Location: Балаково, Саратовская обл.
Вот потэстите кому не влом...

Вообщем это ходилка лесная, обходит простые препядствия.
Поставить свои координаты, отбежать куда нить и запустить.

Думаю что усложнять чтоб обходила лабиринт - смысла нету. Все таки она планировалось как часть лумберскрипта. Может кому и пригодится.

Использует стандартные клавиши хождения в клиенте. Стрелки и Home,End,PgUp,PgDown.

sub tst()
WalkN(2102,2082,'')
end sub

Code:
#==============================================================
#  CheckLag() - click on backpack and awaiting "backpack"
#               message in journal.
#
#  Journal has been deleted!!!
#--------------------------------------------------------------
sub CheckLag()
   UO.DeleteJournal()
   UO.Click('backpack')

   Repeat
      wait(500)
   Until UO.InJournal('backpack')
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
         Endif

         If dx>0 AND dy<0 Then
            StepSucess=Go(1,39,300) ;NE - RightArrow
         Endif

         If dx<0 AND dy>0 Then
            StepSucess=Go(5,37,300) ;SW - LeftArrow
         Endif

         If dx<0 AND dy<0 Then
            StepSucess=Go(7,38,300) ;WN - UpArrow
         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
            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
            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
            Endif
         Endif
         
         If dy<0 Then
            StepSucess=Go(0,33,300) ;N - PgUp
            If StepSucess==-1 Then
               StepSucess=Go(7,38,300) ;WN - UpArrow
               If StepSucess==-1 Then
                  StepSucess=Go(1,39,300) ;NE - RightArrow
               Endif
            Endif
         Endif
      Endif
   Wend
end sub


sub Go(dir,key,walkwait)
   VAR x,y

   x=UO.GetX()
   y=UO.GetY()

   while UO.GetDir()<>dir
      UO.Press(key)
      wait(walkwait)
      If UO.GetDir()<>dir Then
         CheckLag()
      Endif
   wend

   UO.Press(key)
   wait(walkwait)

   If x==UO.GetX() AND y==UO.GetY() Then
      CheckLag()
   Endif
   
   If x==UO.GetX() AND y==UO.GetY() Then
      return -1
   Else
      return 1
   Endif
end sub


Top
   
 Post subject:
PostPosted: 2004-06-23 15:39:36 
Offline

Joined: 2004-06-02 10:03:56
Posts: 8
хорошая ходилка
1 баг нашёл, исправлю потом, сча время нету (завтра посл экзамен)
короче у меня он застопорился, когда чар шел вверх (NW)
там было неск деревьев.. хотя по другим направлениям он прекрасно ходит


Top
   
 Post subject:
PostPosted: 2004-06-24 19:38:22 
Offline
Expert!
User avatar

Joined: 2004-04-04 11:13:54
Posts: 1205
Location: Балаково, Саратовская обл.
На стрелках это клиент сам обходит препядствия


Top
   
 Post subject:
PostPosted: 2004-06-27 10:09:06 
Offline
Expert!
User avatar

Joined: 2004-04-04 11:13:54
Posts: 1205
Location: Балаково, Саратовская обл.
В ходе тэстирования немного изменил систему обхода препядствий. Теперь он делает шаг назад и потом шаг в сторону. помогает обойти препядствия стоящие друг к другу углами тайлов. Грубо говоря глухой тупик.


Еще подправил. Теперь вроде действует неплохо.
Code:
#==============================================================
#  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


Top
   
 Post subject:
PostPosted: 2005-07-06 09:26:49 
Offline
User avatar

Joined: 2005-07-06 04:57:14
Posts: 13
Неподскажете как ету ходилку пристрастить к моиму скрипту на ламбер ?

вот кусок скрипта главная часть

Code:
sub main() 
var i

DIM Forest[32]

# ,infotile
Forest[0]   = "3277 2492 567 5" 
Forest[1]   = "3277 2500 567 0"
Forest[2]   = "3299 2508 567 0"
--\\--\\--\\--

while true

    for i=0 to 30
        uo.print("Иду рубать: " + str(i) )
        kTree( Forest[i] )
        RubTree( Forest[i] )
        MakeBoards()

wend
end sub


Top
   
 Post subject:
PostPosted: 2005-07-06 10:58:25 
Offline

Joined: 2005-05-03 11:51:04
Posts: 108
Location: KDK Elite Group (c)
dUha wrote:
Неподскажете как ету ходилку пристрастить к моиму скрипту на ламбер ?

вот кусок скрипта главная часть

Code:
sub main() 
var i

DIM Forest[32]

# ,infotile
Forest[0]   = "3277 2492 567 5" 
Forest[1]   = "3277 2500 567 0"
Forest[2]   = "3299 2508 567 0"
--\\--\\--\\--

while true

    for i=0 to 30
        uo.print("Иду рубать: " + str(i) )
        kTree( Forest[i] )
        RubTree( Forest[i] )
        MakeBoards()

wend
end sub


Из того что ты показал тут тебе ниче не сказать куда его врубать .У тебя kTree( Forest[i] ) вот в ней (я так думаю) и идет вызов ходилки с передачей координат x,y. Кинь этот саб там может и увидим да подскажем =)


Top
   
 Post subject:
PostPosted: 2005-07-07 11:14:08 
Offline
User avatar

Joined: 2005-07-06 04:57:14
Posts: 13
Вот тот кусок
Code:
sub kTree( Current_Tree ) 
var User_x, User_y          # Mine Coordinates
var User_old_x, User_old_y
var Tree, TreeX, TreeY      # Tree Coordinates
var Distance                #
var Dx, Dy                  #
var MouseX, MouseY
var Stack_step = 0          # Если тормоза

    uo.print("Current_Tree=" + Current_Tree )
         
#   Tree  = Current_Tree
    TreeX = Current_Tree[5]+ Current_Tree[6]+ Current_Tree[7]+ Current_Tree[8]
    TreeY = Current_Tree[10]+Current_Tree[11]+Current_Tree[12]+Current_Tree[13]
   
     uo.print("TreeX="+TreeX + ", TreeY=" + TreeY )
     

# Rule: Go by attitude then by Latitude,
#       If Stuck - change direction

        User_old_x = 1
        User_old_y = 1
       
    Stack_step = 0                  # reset Stack trying counter
    While Distance > 10
        # Мои кординаты
        User_x = uo.getx()
        User_y = uo.gety()
        uo.print("Я по x="+str(User_x)+", Я по y="+str(User_y) )
       
        # Validate for Dead stop.
        if ( (User_old_x - User_x) == 0 AND (User_old_y - User_y) == 0 ) then
            Stack_step = Stack_step + 1
            if ( Stack_step == 3) then
                Stack_Solving()
            endif   
        else
            Stack_step = 0 
        endif
       
        Dx = val(TreeX) - User_x   
        Dy = val(TreeY) - User_y
        Distance = Dx*Dx + Dy*Dy
        uo.print("По x="+str(Dx)+", По ="+str(Dy)+", Дистанция до дорева= "+str(Distance) )
        MouseX = 320+Dx*21
        MouseY = 238+Dy*21
       
        if (MouseX > 634) then
            MouseX = 634
        endif           

        if (MouseX < 10)  then
            MouseX = 10 
        endif           
        if (MouseY > 475) then
            MouseY = 475
        endif
        if (MouseY < 10)  then
            MouseY = 10 
        endif       
       
        uo.print("MouseY="+ str(MouseX) +", MouseY="+ str(MouseY) )
        UO.RClick( MouseX , MouseY )
        wait(200)
        UO.RDblClick( MouseX , MouseY )
       
        wait(1000)
        User_old_x = User_x
        User_old_y = User_y
    wend


     wait(1000)
end sub


Top
   
 Post subject:
PostPosted: 2005-07-07 16:07:00 
Offline
User avatar

Joined: 2005-07-06 04:57:14
Posts: 13
Так что кто-то поможет???


Top
   
 Post subject:
PostPosted: 2005-07-07 16:35:47 
Offline

Joined: 2005-05-02 17:37:12
Posts: 46
Вот эта процедура для разрезания тайла по пробелам
у тебя это 2 и 3 позиция

Sub GetNumb(C,I)
var J,T,K
J=0
K=1
While K>0
J=J+1
If (Mid(C,J,1)==' ') Or (J>=Len(C)-1) Then
If I==0 Then
T=Val(Left(C,J))
Else
T=GetNumb(Right(C,Len(C)-J-1),I-1)
EndIf
K=0
EndIf
wend
UO.Print(T)
return T
endsub
А вот так можно разрезать и получить X Y куда идти
X=GetNumb(Forest,2)
X=GetNumb(Forest,3)
А потом уже вызывать в нужном месте ходилку


Top
   
 Post subject:
PostPosted: 2005-07-09 10:16:15 
Offline
User avatar

Joined: 2005-07-06 04:57:14
Posts: 13
Ну ето все хорошо но я еше не настока знаю скрипты инжекта чтоб ето самому переписать
немог бы ктото мне в етом помочь ??
или зделать дополнительный скрипт который будет переделывать параметры чтобы оно переделывало переменные под ето скрипт ???

Заранее весьма блогодарен


Top
   
 Post subject:
PostPosted: 2005-07-14 16:52:17 
Offline
User avatar

Joined: 2005-07-06 04:57:14
Posts: 13
Так что нет такого скриптера кто поможет ??


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 2 guests


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:  
Powered by phpBB® Forum Software © phpBB Limited