Page 1 of 1

Про минеров и войнов. Нужна помощь

Posted: 2005-06-16 16:44:11
by VORTEX
Люди у меня огромная просьба к скриптерам , сам я таковым не являюсь. Cначала опишу ситуацию- копаю в випке у друга, но играю с работы и по этому перс ночью роет без присмотра , возникают проблемы с эльами (кусаются гады (с DRW мы :)) . Так вот сама просьба - нельзя ли переделать мой скрипт на копание так, чтоб после убийства эльки другом мой чар продолжил рыть , как вставить функцию запускающую скрипт когда какой либо чар говот GO .
Вот код моего рабочего скрипта :

Code: Select all

sub Mining()
	VAR MaxWeight=500 ; vash maksimal'niy ves
	VAR UnloadBox='0x402612CF' ; ID containera
	VAR UnloadBag='0x401374A6' ; ID Meshka
	VAR Lopata='0x400F8C99' ; ID kirki&lopati
	VAR Timer=0
	
	VAR MyX, MyY, MyZ, i, j
	
	MyX = UO.GetX() 
	MyY = UO.GetY() 
	MyZ = UO.GetZ() 
	
	ToHide()
	Wait(1000)
	While NOT UO.Dead()
		For i = MyX-4 to MyX+4 
			For j = MyY-4 to MyY+4 
		
				UO.DeleteJournal()
				UO.Print("Now Mining In: "+str(MyX-i)+" "+str(MyY-j))
				While NOT UO.InJournal("no ore") AND NOT UO.InJournal("far away") AND NOT UO.InJournal("in rock")# AND NOT UO.InJournal("Iron") AND NOT UO.InJournal("Copper") AND NOT UO.InJournal("Bronze") AND NOT UO.InJournal("Rusty") AND NOT UO.InJournal("no line") AND NOT UO.InJournal("Elemental")
					CheckLag()
					ToHide()
					UO.DeleteJournal()
					UO.WaitTargetTile("6044", str(i), str(j), str(MyZ)) 
					UO.UseObject(Lopata)
			
					Timer=0
					While NOT UO.InJournal("You put") AND NOT UO.InJournal("but fail") AND NOT UO.InJournal("no ore") AND NOT UO.InJournal("far away") AND NOT UO.InJournal("in rock") AND NOT UO.InJournal("no line") AND NOT UO.InJournal("Elemental") AND NOT Timer>=600
						Wait(500)
						Timer=Timer+1
					Wend
					
					If UO.InJournal('Elemental') then
						repeat
							Wait(1000)
						until UO.InJournal('go')
					EndIf
			
					If UO.Weight>MaxWeight then
						WalkN(0,0,UnloadBox)
						Unload(UnloadBag)
						WalkN(MyX,MyY,'')
					Endif
				Wend
			Next
		Next
	Wend
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(1000)
			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(100) 
		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(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  
   	  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() 
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('Disconnected & Reconnected @ '+ReconnectTime) 
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 
заранне ОГРОМНОЕ СПАСИБО
PS и раконнектор тоже почему то не пашет , может подправите ?

Posted: 2005-06-16 17:02:13
by flake

Code: Select all

    If UO.InJournal('Elemental') then 
       repeat 
           Wait(1000) 
       until UO.InJournal('go') 
     EndIf
Так у тебя уже вроде стоит эта штука.
Если видит элементаль - скрипт будет ждать, пока кто-то рядом не скажет "go"

Posted: 2005-06-16 17:44:54
by VORTEX
Спасибо , я же писАл что нифига не понимаю в скриптах .
А про реконнектор что скажите ??

Posted: 2005-06-16 18:01:07
by flake
Могу посоветовать вот этот:
Хз кто его писал, мне его еще давно кто-то дал.
Работает отлично.

Code: Select all

sub Reconnect() 
    var rflag 
    rflag=1 
    repeat 
        while (uo.ObjAtLayer('Bpack')=='') 
            if rflag then 
                rflag=0 
            end if 
            wait(20000) 
            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)then 
            rflag=1 
        end if 
    until false 
end sub 

Posted: 2005-07-14 17:12:48
by kazava
А можно ли изменить скрипт чтобы чар Реколился в пещеру по рунбуку(допустим руна в рунбуке в 8 слоте)после набирание определенного веса летел домой по рунбуке(допустим руна домой в 1 слоте)...

Напишите весь этот скрипт с изменением!!