В этом скрипте если его запустить он открывает банк берёт кирку и стейки и идёт копать по определёным координатам. Но как пак становится полный нечего не происходит он просто дальше копает.
Прошу помочь мне доделать этот скриптик.
Code: Select all
VAR Sunduk = '0x00000000'; сундук с инструментом (кирка)
; туда же кладем фиш стейки
VAR Sunduk2 = '0x00000000'; сундук для руды
VAR SteikFat = '0x097B';фиш стейки
VAR Picsar = '0x0E85';кирка
sub start()
uo.exec('exec ahtung')
uo.exec('exec main')
end sub
Sub main()
GoToTile( 5975, 1492, 1, False )
wait( 5000 )
UO.Say( 'Bank' )
wait( 5000 )
If UO.Count( SteikFat ) < 10 Then
UO.FindType( SteikFat,'-1',Sunduk)
If UO.FindCount () > 0 Then
UO.MoveItem( 'finditem','10' )
wait (1000)
Else
UO.Print( 'Нет стейков' )
Endif
Endif
If UO.Count( Picsar ) < 2 Then
UO.FindType( Picsar,'-1',Sunduk)
If UO.FindCount () > 0 Then
UO.MoveItem( 'finditem','10' )
wait (1000)
Else
UO.Print( 'Нет кирки' )
Endif
Endif
GoToTile( 5977, 1494, 1, False )
GoToTile( 5977, 1505, 1, False )
GoToTile( 5974, 1504, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 5989, 1503, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 5995, 1497, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6004, 1506, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6006, 1507, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6006, 1512, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6006, 1517, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6004, 1519, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6004, 1504, 1, False )
GoToTile( 6009, 1504, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6013, 1504, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6013, 1500, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6013, 1495, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6009, 1495, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6007, 1500, 1, False )
GoToTile( 6006, 1495, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 6002, 1496, 1, False )
wait(3000)
UO.Warmode("0")
Mining()
wait(3000)
GoToTile( 5992, 1504, 1, False )
GoToTile( 5984, 1499, 1, False )
GoToTile( 5976, 1499, 1, False )
GoToTile( 5975, 1492, 1, False )
wait(5000)
UO.Say( 'Bank' )
wait( 3000 )
UO.FindType( '0x19B9' )
If UO.FindCount() > 0 Then
UO.MoveItem( 'finditem','0','Sunduk2' )
Endif
wait( 1000 )
UO.Print( 'Закончили' )
uo.exec('terminate all')
end sub
Sub GoToTile( OX, OY, N, S )
VAR myx, myy, MD, J
VAR Lx1, Ly1
VAR Lx2, Ly2
VAR Sx, Sy
VAR T
VAR Des = N
VAR MoveDelay = 100
J = 1
MD = MoveDelay * 1.5
myx = uo.getx()
myy = uo.gety()
MoveOnce( GetDir( uo.getx(), uo.gety(), ox, oy), MD, False)
Sx = 0
Sy = 0
Lx1 = uo.getx() / 2
Ly1 = uo.gety() / 2
Lx2 = Lx1 / 2
Ly2 = Ly1 / 2
T = UO.Timer()
If (GetDistance(ox, oy) <> N) OR ( (NOT S) AND GetDistance(ox, oy) > N ) Then
UO.Exec('exec PermResend')
EndIf
While ( (GetDistance(ox, oy) <> N) OR ((NOT S) and GetDistance(ox, oy) > N) ) and ( OX >= 0 ) and ( OY >= 0 )
If ( (UO.Timer() - T) * 15 > MoveDelay ) Then
T = UO.Timer()
Lx2 = Lx1
Ly2 = Ly1
Lx1 = myx
Ly1 = myy
myx = uo.getx()
myy = uo.gety()
endIf
MD=MoveDelay
If ((OX-uo.getx())*(OX-uo.getx())+(OY-uo.gety())*(OY-uo.gety())>0) Then
MD = MD * 3 / GetDistance( ox, oy )
EndIf
wait(MD)
If GetDistance( OX, OY ) > Des Then
MoveOnce(GetDir(uo.GetX(),uo.GetY(),ox,oy),MD,False)
Else
If S Then
If GetDistance(OX,OY)<Des Then
If GetDistance(OX,OY)<>0 Then
MoveOnce(GetDir(ox,oy,uo.GetX(),uo.GetY()),MD,False)
Else
MoveOnce(GetDir(uo.GetX(),uo.GetY(),Lx2,Ly2),MD,False)
EndIf
EndIf
EndIf
EndIf
If GetDistance(OX,OY)<>Des Then
If (Lx2==uo.getx()) and (Ly2==uo.gety()) Then
If (Sx<>uo.getx()) or (Sy<>uo.gety()) Then
J=1
EndIf
J=J+1
UO.Resend()
Sx = uo.getx()
Sy = uo.gety()
Stun(ox,oy,J)
EndIf
EndIf
Wend
UO.Exec( 'terminate PermResend' )
endsub
Sub MoveOnce( Dir, Del, Rev )
VAR Num
Var MoveNumber = 1
If Rev Then
Num = MoveNumber + 1
Else
Num = MoveNumber
EndIf
If ( Num > 0 ) and ( Dir <> 0 ) Then
If Dir == 1 Then
UO.Press( 38, Num, Del )
EndIf
If Dir == 2 Then
UO.Press( 33, Num, Del )
EndIf
If Dir == 3 Then
UO.Press( 39, Num, Del )
EndIf
If Dir == 4 Then
UO.Press( 34, Num, Del )
EndIf
If Dir == -1 Then
UO.Press( 40, Num-1, Del )
EndIf
If Dir == -2 Then
UO.Press( 35, Num, Del )
EndIf
If Dir == -3 Then
UO.Press( 37, Num, Del )
EndIf
If Dir == -4 Then
UO.Press( 36, Num, Del )
EndIf
If Rev Then
If Dir <> -1 Then
UO.Press( 40, 1, Del )
EndIf
EndIf
EndIf
endsub
Sub GetDir( myx, myy, ox, oy )
VAR I, J
J = 0
VAR X = ox - myx
VAR Y = oy - myy
I = GetQDir( Abs(X), Abs(Y) )
If X >= 0 Then
If Y >= 0 Then
If I == 1 Then
J = -2
Else
If I == 2 Then
J = -1
Else
If I == 3 Then
J = 4
EndIf
EndIf
EndIf
Else
If I == 1 Then
J = 2
Else
If I == 2 Then
J = 3
Else
If I == 3 Then
J = 4
EndIf
EndIf
EndIf
EndIf
Else
If Y >= 0 Then
If I == 1 Then
J = -2
Else
If I == 2 Then
J = -3
Else
If I == 3 Then
J = -4
EndIf
EndIf
EndIf
Else
If I == 1 Then
J = 2
Else
If I == 2 Then
J = 1
Else
If I == 3 Then
J = -4
EndIf
EndIf
EndIf
EndIf
EndIf
RETURN J
endsub
Sub GetQDir( x, y )
VAR Ep = 0.172
VAR J = 0
If X == 0 Then
J = 1
Else
If ( Y / X ) < Ep Then
J = 3
Else
If ( X / Y ) < Ep Then
J = 1
Else
J = 2
EndIf
EndIf
EndIf
RETURN J
endsub
Sub GetDistance( X, Y )
VAR A, B, C
A = abs( X - UO.GetX() )
B = abs( Y - UO.GetY() )
If A > B Then
C = A
Else
C = B
EndIf
Return C
endsub
Sub Perp( Dir )
VAR D = Dir
If Dir == 1 Then
D = 3
EndIf
If Dir == 2 Then
D = 4
EndIf
If Dir == 3 Then
D = -1
EndIf
If Dir == 4 Then
D = -2
EndIf
If Dir == -1 Then
D = -3
EndIf
If Dir == -2 Then
D = -4
EndIf
If Dir == -3 Then
D = 1
EndIf
If Dir == -4 Then
D = 2
EndIf
RETURN D
endsub
Sub Stun( X, Y, N )
VAR I
VAR myx
VAR myy
VAR MoveDelay = 100
myx = uo.getx()
myy = uo.gety()
For I=1 to N
MoveOnce(perp(GetDir(myx,myy,x,y)),MoveDelay,False)
Next
Wait(MoveDelay)
UO.Resend()
If (myx==uo.getx()) and (myy==uo.gety()) Then
For I=1 to N
MoveOnce(-perp(GetDir(myx,myy,x,y)),MoveDelay,False)
Next
Wait(MoveDelay)
UO.Resend()
EndIf
If (myx==uo.getx()) and (myy==uo.gety()) Then
For I=1 to N
MoveOnce(-GetDir(myx,myy,x,y),MoveDelay,False)
Next
Wait(MoveDelay)
Stun(x,y,N)
EndIf
endsub
Sub abs( a )
VAR b
If a < 0 Then
b = -a
Else
b = a
endif
return b
endsub
Sub PermResend()
Var Mn = 9
VAR MoveDelay = 100
Repeat
UO.Resend()
Wait( MoveDelay * Mn )
Until ( 1 > 2 )
endsub
Sub Mining()
var x,y,z, n
VAR LastTimer
UO.Set('finddistance','2')
n=0
z=UO.GetZ("self")
for x=-2 to 2
for y=-2 to 2
UO.Print(str(x)+" "+str(y))
Repeat
if UO.InJournal('TORMOZ') then
pause()
endif
UO.DeleteJournal()
UO.Warmode("0")
UO.WaitTargetTile("1341",STR(UO.GetX()+x),STR(UO.GetY()+Y),str(z))
UO.UseType('0x0E85')
LastTimer=UO.Timer()
Repeat
wait(500)
Until UO.InJournal("Вы положили") or UO.InJournal("can't see") or UO.InJournal("heavy") or UO.InJournal("в другом") or UO.InJournal("ничего") or UO.InJournal("неудалось") or UO.InJournal("нет обзора") or UO.InJournal("in rock") or UO.InJournal("must wait") or UO.InJournal("nothing") or UO.InJournal("elsewhere") or UO.InJournal("where it") OR UO.Timer()>LastTimer+200
if UO.InJournal("Вы положили") then
n=0
else
n=n+1
endif
Until UO.InJournal("nothing") or UO.InJournal("elsewhere") or UO.InJournal("ничего") or UO.InJournal("location") or UO.InJournal("far away") or UO.InJournal("in rock") or UO.InJournal("where it") or n>=5
next
next
end sub
Sub ahtung()
repeat
panika()
wait(1000)
until uo.Dead()
end sub
Sub panika()
if uo.injournal("Golem") then
UO.Say ('AHTUNG')
wait( 100 )
UO.Say ('Guard')
wait( 100 )
UO.Say ('Guard')
wait( 100 )
UO.Say ('Guard')
wait( 100 )
UO.Say ('Guard')
wait( 100 )
UO.Say ('Поняковский брось курицу !!!!')
wait (500)
uo.DeleteJournal()
end if
end sub