Page 3 of 3

Posted: 2009-03-18 13:27:38
by Jekaaa
Спасибо, щас попробую. У меня еще 1 просьба не мог бы ты написать простенький скрипт. Персонаж атакует последнюю цель, делает 3 шага на запад (West) и сразу отбегает (3 шага) на восток (East) ждет 6 секунд, повторяет этот скрипт 6 раз, потом 1 раз повторяет тот же скрипт но с задержкой на 10 секуню, а потом с ново возвращаться к началу скрипта и проводит комбинацию заново.

Posted: 2009-03-21 18:43:48
by Jekaaa
Добавил координат все равно ходит только на лево =( второй скрипт не работает. А при тыканье на пустоту макрос просто замирает и персонаж ничего не делает (сообщения при этом нет). =( Вот скрипт которым я щас пользуюсь.

Code: Select all

sub Mining_Carve()
var i
dim x[6],y[6]
x[0]=355
y[0]=1460
x[1]=349
y[1]=1452
x[2]=360
y[2]=1447
x[3]=360
y[3]=1437
x[4]=378
y[4]=1437
x[5]=378
y[5]=1445
x[6]=387
y[6]=1435
    repeat
       for i=0 to 6
             walkn(x[i],y[i],' ')
             mining()
       next
    until uo.weight>=uo.str*4
endsub
sub Mining()
   var x,y
        for x=-2 to 2
           for y=-2 to 2
                 if x==0 and y==0 then
                      wait(500)
                 else
                      uo.deletejournal()
                      uo.waittargettile('0',str(uo.getx('self')+x),str(uo.gety('self')+y),'0')
                      uo.usetype('NPF')
                             repeat
                                   wait(300)
                             until uo.injournal('far away|no more|nothing here')
                 endif
            next
      next
endsub
##############################
# 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()
         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 Target<>"" AND uo.GetDistance(Target)<=3 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()
   deljournal('a backpack')
   uo.click('backpack')
   repeat
      wait(50)
   until uo.injournal('a backpack')
endsub
Sub deljournal(msg)
   while uo.injournal(msg)
      uo.setjournalline(uo.injournal(msg)-1,"")
   wend
endsub