Мининг в ВИП.

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
D1ra7h
Posts: 5
Joined: 2006-09-02 15:50:06
Location: DrW
Contact:

Мининг в ВИП.

Post by D1ra7h »

Ребят, помогиет доработать скрипт.

Code: Select all

sub main() 
   while not uo.dead() 
      WalkN(5137,1084,'') 
      Mining() 
      WalkN(5142,1084,'') 
      Mining() 
      WalkN(5148,1084,'') 
      Mining() 
   wend 
end sub 

Sub Mining() 
   VAR MaxWeight=500 ; vash maksimal'niy ves 
   VAR UnloadBox='0x400BF86D' ; ID containera 
   VAR UnloadBag='0x40382325' ; ID Meshka 
   VAR Lopata='0x40362A48' ; ID kirki&lopati 
   VAR Timer=0 
    
   VAR MyX, MyY, MyZ, i, j,t=false 
    
   MyX = UO.GetX() 
   MyY = UO.GetY() 
   MyZ = UO.GetZ() 
    
   ToHide() 
   Wait(1500) 
   UO.TextOpen() 
   UO.TextPrint('Script start '+MakeTime()) 
   for i = -4 to 4 
      for j = -3 to 4 
         repeat 
            tohide() 
            uo.deletejournal() 
            UO.Waittargettile("6044", str(myx+i), str(myy+j), str(myz)) 
            UO.UseObject(Lopata) 
            Timer = UO.Timer() 
            while not UO.InJournal("You put") and not UO.InJournal("location") and not UO.InJournal("no ore") and not UO.InJournal("but fail") and not UO.InJournal("far away") and not UO.InJournal("in rock") and not UO.InJournal("OOPS") and not UO.InJournal("attacking you") and not UO.InJournal("no line") and Timer + 1200 > UO.Timer() 
               wait(300) 
            wend 
            If UO.InJournal('Elemental') then 
               UO.TextPrint('Elemental founded '+MakeTime()) 
               repeat 
                  tohide() 
                  wait(1200) 
               until UO.InJournal('go') 
               UO.TextPrint('Back to script '+MakeTime()) 
            End If 
            if UO.InJournal("but fail") then 
               if t then 
                  wait(1200) 
                  t = false 
               else 
                  t = true 
               end if 
            else 
               t = false 
            end if 
         until not UO.InJournal("but fail") 
         If UO.Weight>MaxWeight then 
            WalkN(0,0,UnloadBox) 
            Unload(UnloadBag) 
            WalkN(MyX,MyY,'') 
         End if 
      next 
   next 
end sub 

Sub Unload(UnloadBox) 
   VAR Exit,i 
   DIM Ore[4] 
   Ore[0]='0x19B7' ; 1 ore 
   Ore[1]='0x19BA' ; 2 ore 
   Ore[2]='0x19B8' ; 3 ore 
   Ore[3]='0x19B9' ; 4 and more ore 
UO.SetReceivingContainer(UnloadBox) 
   ToHide() 
   For i=0 to 3 
      Exit=0 
      While Exit<>1 
         UO.FindType(Ore[i])    
         If UO.GetQuantity('finditem')>0 then 
            UO.Grab('all','finditem') 
            CheckLag() 
            Wait(1200) 
         Else 
            Exit=1 
         Endif 
      Wend 
   Next 
   UO.UnSetReceivingContainer() 
end sub 
    
Sub ToHide() 
   While NOT UO.Hidden() 
      UO.DeleteJournal() 
      UO.Exec('warmode 0') 
      UO.UseSkill('Stealth') 
      Repeat 
         Wait(300) 
      Until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') OR UO.Dead() 
   Wend 
end sub 

Sub CheckLag() 
   UO.DeleteJournal() 
   UO.Click('backpack') 
   repeat 
      Wait(50) 
   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(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 


#============================================================== 
#  Healing() - memoryzed current weapon, bandageself, armed 
#-------------------------------------------------------------- 
Sub Healing() 
   UO.SetArm('CWeapon') 
   UO.Exec("bandageself") 
   wait(500) 
   UO.Arm('CWeapon') 
end sub 

#============================================================== 
#  Recconector 
#-------------------------------------------------------------- 
Sub Reconnector() 
var ReconnectTime, RFlag 
ReconnectTime = '0' 
RFlag = 1 
Repeat 
While (UO.ObjAtLayer('Bpack') == '') 
if RFlag Then 
ReconnectTime = MakeTime() 
UO.TextOpen() 
UO.TextPrint('Disconnected '+ReconnectTime) 
RFlag = 0 
endif 
Wait(20000) # WorldSave Protection 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.LDblClick(357,164) 
UO.LClick(616,459) 
Wait(3000) 
WEnd 
Wait(3000) 
if (RFlag == 0) and (ReconnectTime <> '0') Then 
;UO.Exec('terminate all') 
;UO.Exec('exec autoload') 
UO.TextOpen() 
UO.TextPrint('Reconnected '+MakeTime()) 
RFlag = 1 
ReconnectTime = '0' 
endif 
Until false 
end sub 

Sub MakeTime() 
VAR D, T, Ret, i 
Ret = STR(UO.Time()) 
T = "" 
For i = 0 To Len(Ret) 
T = Ret[Len(Ret)-i] + T 
If (I == 2) OR (I == 4) Then 
T = ":" + T 
EndIf 
Next 
Ret = STR(UO.Date()) 
D = "" 
For i = 0 To Len(Ret) 
D = Ret[Len(Ret)-i] + D 
If (I == 2) OR (I == 4) Then 
D = "." + D 
EndIf 
Next 
Ret = T + " @ " + D 
RETURN Ret 
end sub
он у меня начинает ходить по вей шахте, не копает, а просто ходит и пешется "zasada" :)
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

Code: Select all

      WalkN(5137,1084,'')
      Mining()
      WalkN(5142,1084,'')
      Mining()
      WalkN(5148,1084,'') 
эти кординаты правельные ?
D1ra7h
Posts: 5
Joined: 2006-09-02 15:50:06
Location: DrW
Contact:

Post by D1ra7h »

Ребят, а вот этот почему не ходит чар?

Code: Select all

################MINIG############################# ####### 
;--------------------------- Flags ---------------------------- 
; 0-Actions flag. If =1 ResidentACT paused script and run self 
; 1-Elemental flag 
; 2-World save flag 
; 99-Pause main script flag 
;-------------------------------------------------- ------------ 

sub ResidentMSG() 
VAR i 
UO.DeleteJournal() 
;------------------ Clear global var ------------------------- 
for i=0 to 2 
UO.SetEasyUO(i,"0") 
next 
;-------------------- Check situations ----------------------- 
while 1==1 
If UO.InJournal("OOPS") then 
UO.SetJournalLine(UO.InJournal("OOPS")-1,"Fixed" ) 
UO.SetEasyUO(1,"1") 
UO.SetEasyUO(0,"1") 
endif 

If UO.InJournal("Elemental is attacking you") AND UO.GetEasyUO(0)=="0" then 
UO.SetJournalLine(UO.InJournal("Elemental is attacking you")-1,"Fixed") 
UO.SetEasyUO(1,"1") 
UO.SetEasyUO(0,"1") 
endif 

If UO.InJournal("World save") then 
UO.SetJournalLine(UO.InJournal("World save")-1,"Fixed") 
UO.SetEasyUO(2,"1") 
UO.SetEasyUO(0,"1") 
endif 
wait(250) 
wend 
end sub 

;-------------------- Action for situation -------------------- 
sub ResidentACT() 

UO.SetEasyUO(99,"0") 

while 1==1 
if UO.GetEasyUO(0)=="1" then 

UO.SetEasyUO(99,"1") ;Pause main script 

if UO.GetEasyUO(1)=="1" then 
KillElem() 
UO.SetEasyUO(1,"0") 
endif 

if UO.GetEasyUO(2)=="1" then 
UO.Click('self') 
repeat 
wait(500) 
until UO.InJournal("Dirath: Dirath") 
UO.SetEasyUO(2,"0") 
endif 

UO.SetEasyUO(0,"0") 
UO.SetEasyUO(99,"0") 
endif 
wait(250) 
wend 
end sub 

;------------- Pause main script while situations ------------- 
sub CheckPause() 
if UO.GetEasyUO(99)=="1" then 
repeat 
wait(100) 
until UO.GetEasyUO(99)=="0" 
endif 
end sub 

;==================== Main mining script ====================== 
sub mine() 
VAR i,TileY,TileX,DirX,DirY 
UO.Exec('exec alarm') ; alarm when char lose HP 
UO.Exec('exec ResidentMSG') ; check messages 
UO.Exec('exec ResidentACT') ; action on messages 

While NOT UO.Dead() 
UO.DeleteJournal() 
DirX=1 
DirY=1 

For TileY=1 to 7 
For TileX=1 to 16 
ToHide() 
CheckPause() 
digit() 
walk(1*DirX,0) 
next 
ToHide() 
CheckPause() 
digit() 
DirX=-1*DirX 
walk(0,1*DirY) 
next 
ToHide() 
CheckPause() 
digit() 
DirY=-1*DirY 
unloadore() 
walk(5645-UO.GetX(),1050-UO.GetY()) 
wend 
end sub 

;-------------------- Try to mine under self ------------------ 
sub digit() 
VAR Last=0,LastTimer 
VAR MaxWeight=650 

if UO.Weight>=MaxWeight then 
unloadore() 
endif 

repeat 
CheckLag() ; deleting journal 
UO.WaitTargetSelf() 
UO.UseType('0x0E85') 
LastTimer=UO.Timer() 

repeat 
wait(100) 
until UO.InJournal("You put") OR UO.InJournal("You loosen") OR UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("OOPS") OR UO.InJournal("attacking you") OR LastTimer+150<UO.Timer() 
wait(1000) 
CheckPause() 

if UO.InJournal('You loosen') then 
repeat 
wait(100) 
until UO.InJournal("You put") OR LastTimer+105<UO.Timer() 
endif 

until UO.InJournal("There is no") OR UO.InJournal("That is too") 
wait(1000) 
CheckPause() 
end sub 

;------------------------- Unload ore ------------------------- 
sub unloadore() 
VAR TempX,TempY,i,Exit 
DIM Ore[5] 

TempX=UO.GetX() 
TempY=UO.GetY() 
CheckPause() 
walk(5646-TempX,1057-TempY) 
CheckPause() 
ToHide() 
CheckPause() 

Ore[0]=0x19B9 ; 4 and more ore 
Ore[1]=0x19B7 ; 1 ore 
Ore[2]=0x19BA ; 2 ore 
Ore[3]=0x19B8 ; 3 ore 

UO.SetReceivingContainer('0x400BF86D') ; storecontainer 
wait(500) 

For i=0 to 3 
Exit=0 
repeat 
UO.FindType(Ore[i]) 
CheckLag() 

if UO.GetQuantity('finditem')>0 then 
UO.Grab('0','finditem') 
CheckLag() 
wait(1500) 
Else 
Exit=1 
endif 
until Exit==1 
Next 

UO.UnSetReceivingContainer() 

walk(TempX-5446,TempY-1057) 
CheckPause() 
ToHide() 
CheckPause() 
end sub 

;----------- Morf in Daemon, kill elem and loot him ----------- 
sub killelem() 
VAR Count, LastTimer 

UO.UseType('0x0F0E','0x0631') ; inviz potion 

repeat 
If UO.Mana>=50 then 
UO.WaitMenu('What','Daemon') 
UO.Cast('Polymorph') 
wait(8000) 
else 
while UO.Mana<50 
UO.UseType('0x0F0E','0x09DF') ; total mana potion 
wait(3000) 
wend 
endif 
until UO.STR>200 ; U'r not morfed char max Strength 

LastTimer=UO.Timer() 
repeat 
UO.BandageSelf() 
wait(4000) 
until UO.Life==UO.STR OR LastTimer+170<UO.Timer() 

UO.UseType(0x1B76) ; heater shield 
UO.UseType(0x1413) ; platemail gorget 

UO.DeleteJournal() 
UO.WarMode(1) 
UO.UseSkill('Meditation') ; reveal self 

; "Corpse autoopen" in "main" need be checked 
repeat 
wait(5000) 
until UO.InJournal('Body') OR UO.InJournal('You can') 

If UO.InJournal('You can') then 
UO.WaitTargetGround('0x19B9') ; 4 and more ore 
wait(1500) 
UO.Grab('all') 
UO.WaitTargetGround('0x0EED') ; gold coins 
wait(500) 
UO.Grab('all') 
Else 
UO.WaitTargetObject('lastcorpse') 
UO.UseType('0x0F51') ; dagger 
wait(500) 

UO.FindType('0x19B9',-1,'lastcorpse') ; ore 
wait(500) 
UO.Grab(0,'finditem') 

UO.FindType('0x0EED',-1,'lastcorpse') ; coins 
wait(500) 
UO.Grab(0,'finditem') 

UO.FindType('0x1BF5',-1,'lastcorpse') ; ings 
wait(500) 
UO.Grab(0,'finditem') 

UO.FindType('0x0E76',-1,'lastcorpse') ; bag 
wait(500) 
UO.Grab(0,'finditem') 
endif 

UO.WarMode('flip') 
wait(1000) 
UO.WarMode(0) 
wait(1000) 

LastTimer=UO.Timer() 
if UO.Life<170 then ; U'r max HP 
repeat 
UO.BandageSelf() 
wait(4000) 
until UO.Life>170 OR LastTimer+170<UO.Timer() 
endif 

ToHide() 
end sub 

sub tohide() 
while NOT UO.Hidden() 
UO.DeleteJournal() 

if UO.Life<170 then 
UO.UseType('0x0F0E','0x0631') ; inviz potion 
wait(2000) 
else 
UO.UseSkill('Hiding') 
repeat 
wait(50) 
until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') 
endif 
UO.WarMode('flip') 
wait(100) 
UO.Warmode(0) 
wend 
end sub 

sub CheckLag() 
UO.DeleteJournal() 
UO.Click('backpack') 

repeat 
wait(50) 
until UO.InJournal('backpack') 
end sub 

sub gong(times) ; play wav-file 
VAR i 
for i=1 to times 
UO.Exec("playwav c:\game\uo\cow") 
wait(1200) ; time to play sample at once 
next 
end sub 

sub alarm() 
while 1==1 
wait(1000) 
if UO.Life<170 then 
gong(1) 
endif 
wend 
end sub 

sub walk(dx,dy) 
VAR i, walkwait=300 
If dx<>0 then 
If dx>0 then 
If UO.GetDir()<>2 then 
UO.Press(34) 
wait(walkwait) 
CheckPause() 
Endif 
For i=1 to dx 
UO.Press(34) 
wait(walkwait) 
CheckPause() 
next 
Else 
If UO.GetDir()<>6 then 
UO.Press(36) 
wait(walkwait) 
CheckPause() 
Endif 
For i=1 to dx*-1 
UO.Press(36) 
wait(walkwait) 
CheckPause() 
next 
Endif 

endif 

If dy<>0 then 
If dy>0 then 
If UO.GetDir()<>4 then 
UO.Press(35) 
wait(walkwait) 
CheckPause() 
Endif 
For i=1 to dy 
UO.Press(35) 
wait(walkwait) 
CheckPause() 
next 
Else 
If UO.GetDir()<>0 then 
UO.Press(33) 
wait(walkwait) 
CheckPause() 
Endif 
For i=1 to dy*-1 
UO.Press(33) 
wait(walkwait) 
CheckPause() 
next 
Endif 
endif 
wait(1000) 
end sub 

Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

мде :roll:
Post Reply