Yoko

All sides of Injection
It is currently 2024-04-17 00:30:16

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2010-09-13 16:06:39 
Offline

Joined: 2005-05-13 03:15:24
Posts: 6
Здрасте переделал под себя скрипт на скупку регов и выкладку в дом... сначала все было нормально и он работал как нада.. но потом сошел с ума и ПЕРЕСТАЛ подходить к вендорам просто тупо реколиться от рунки к рунке ходит в неизвестном направлнии (тоесть не к вендорам) и тыкает buy
а вот и скрипт
Code:
sub main()    
   var maxRune = 9;
   var maxVendors = 9;
   DIM rune[9]   
   DIM ven[9]
   var i, n, j, m
   var runeBank = '0x7CC001D6';
   rune[1]='0x7CC001D5'   
   rune[2]='0x7CC00A2A'
   rune[3]='0x7CC016A1'
   rune[4]='0x7CC01732'
   rune[5]='0x7CC01733'
   rune[6]='0x7CC00A29'
   rune[7]='0x7CC05E8B'
   rune[8]='0x7CC016A2'
   rune[9]='0x7CC06F0A'
   ven[1]='0x0098EA91,0x0098F8B8,0x00990C15,0x0098F2D1' #Britain 1
   ven[2]='0x00993F8A,0x0098F2D0' #Britain 2
   ven[3]='0x0098EC86,0x009ABFE9,0x0098F2CA' #maginciya
   ven[4]='0x0098F559,0x009A99E3,0x009A99E5' #brit 3
   ven[5]='0x009A9783,0x009A977A' #minoc
   ven[6]='0x0098F2BD' #Moon
   ven[7]='0x0098F2AC' #vesp
   ven[8]='0x0098F2CC,0x00990C1E' #cove
   ven[9]='0x00D0A54A,0x0098F290' #skara
   repeat
   while not uo.dead()
      for i=1 to maxRune
            recall(i,rune)
            for j=1 to GetAmountVendors( ven[i] )
               uo.Print(STR(GetVendor( ven[i], j )))
               WalkN(0,0,GetVendor( ven[i], j ))
               UO.buy('test','vendor')
                              wait(500)
                              UO.Say( uo.GetName(GetVendor( ven[i], j )) + " buy")
               UO.DeleteJournal()   
                              next
                              wait(500)
                              next
recall(-1,runeBank);
                 uo.useobject('0x75A336F0')
                 wait(1000)
                 Checklag()
                        while uo.count('0x0F88')
                               uo.findtype('0x0F88','0x0000','2')
                               uo.moveitem('finditem','0','0x75A336F0')
                               wait(1000)
                               Checklag()
                               uo.FindType(0x0E76,0x0000,0x75A336F0)
                                uo.Grab(1,'finditem')
                                wait(1000)
                                wait(100000)
                        wend
             wend
end sub

sub GetVendor( str, j )
   var   lstr, ven, venID, i
   if GetAmountVendors( str ) < j then
      j = GetAmountVendors( str );
   endif
   lstr = len( str )
   ven = 1;
   venID = ''   
   for i = 0 to lstr     
      if str[i]==',' then         
         if ven == j then           
            return venID
         else
            venID = ''
            ven = ven + 1
         endif
      else
         venID = venID+str[i];     
      endif
   next
   return venID
end sub

sub GetAmountVendors( str )
   var j, num, i
   j = len( str ) - 1
   num=1;
   for i = 0 to j       
      if str[i]==',' then
         num=num+1       
      endif       
   next   
   return num;
end sub

sub takenum()
   var ns, j, i, n
   var str, num
   num=''   
   n=uo.InJournal('Recalls Remaining')-1
   str=uo.Journal(n)
   UO.Print(str)
   j = len( str ) - 1
   for i = 0 to j
      if str[i]<>' ' then
         num=num+str[i]
      else
         return val(num)
      endif       
   next
   return val(num)
end sub

sub Recall(i,rune)
   var b
   if i <> -1 then
      uo.print('Recoll Rune '+str(i))
   endif
   for b=1 to 10
      if i == -1 then
         uo.deletejournal()
         uo.waittargetobject(rune)
         uo.cast('Recall',rune)
         if WaitForRecall()==1 then
            return 1
         end if
      else
         uo.deletejournal()
         uo.waittargetobject(rune[i])
         uo.cast('Recall',rune[i])
         if WaitForRecall()==1 then
            return 1
         end if
      end if
   next
   return 0
end sub

sub WaitForRecall()
   var Text1="cliloc# 0xAB68"
   var mess='',lastX=uo.getX(),lastY=uo.getY()
   for var v=0 to 200
      mess=uo.journal(0)
      if uo.Journal(0)==Text1 then
         return 0
      end if
      if uo.getX()<>lastX OR uo.getY()<>LastY then
         return 1
      end if
      wait(50)
   next
   return 0
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()
         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 deljournal(msg)
   while uo.injournal(msg)
      uo.setjournalline(uo.injournal(msg)-1,"")
   wend
end sub

 Sub Checklag()
   deljournal('Night a Backpack')
   uo.click('backpack')
   repeat
      wait(50)
   until uo.injournal('Night a Backpack')
   end sub


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

All times are UTC+02:00


Who is online

Users browsing this forum: Google [Bot] and 10 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:  
cron
Powered by phpBB® Forum Software © phpBB Limited