Вот готовый проверянный мною скрипт!
Code:
;******************************************
;*** MINING From DIKIY,SAVAGE & SFAGNUM ***
;******************************************
; Чар копает киркой вокруг себя стоя в хайде на 4 клетки.
; при достижении максимального веса описанного в переменной "maxweight=XXX" - скрипт
; переходит к плавилке, плавит всю выкопанную руду по 1 штучке. Затем остановка.
; Предназначен для копки в шахте минока - для Нубов для прокачки мининга :o)
sub Dig()
var mx = UO.GetX("self"), my = UO.GetY("self"), mz = UO.GetZ("self"),TileNum='1339', t=0
var i,j,s ,maxweight=150
tohide()
if UO.Dead() then
return
end if
if UO.ContainerOf('objTools') <> UO.GetSerial('backpack') then
if findShovel() == 0 then
return
end if
end if
repeat
for i = -4 to 4
for j = -4 to 4
UO.Print("Now Mining In: "+str(mx-i)+" "+str(my-j))
while not UO.InJournal("no ore here") and not UO.InJournal("Try mining") and not UO.InJournal("You can't")and not uo.injournal("is nothing")and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock")
tohide()
CheckLag()
UO.Waittargettile("1341", str(i), str(j), str(mz))
UO.UseObject('objTools')
s = 0
while not UO.InJournal("You put") and not UO.InJournal("Try mining") and not UO.InJournal("You can't") and not UO.InJournal("location") and not uo.injournal("is nothing") 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 s < 500
wait(500)
s = s + 1
wend
if UO.Weight>=maxweight then
smelt()
endif
if UO.InJournal("but fail") then
wait(1000)
end if
wend
UO.DeleteJournal()
next
next
until false
return 1
end sub
Sub findShovel()
var tShovel
UO.UseObject('backpack')
if UO.Count('0x0E85') > 0 then
tShovel='0x0E85'
else
tShovel='0x0F39'
end if
if UO.Count(tShovel) > 0 then
UO.FindType(tShovel,'-1','backpack')
UO.AddObject('objTools','finditem')
else
UO.Print('чего то лопаты нет...')
return 0
end if
return 1
end sub
Sub tohide()
while NOT UO.Hidden() and not UO.Dead()
UO.DeleteJournal()
UO.Warmode('0')
UO.UseSkill('Hiding')
repeat
wait(50)
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
sub smelt()
walkn(2573,475,"") ; Координаты плавилки
var ore1 = 0x19B7 #Type 1 рудинки
var ore2 = 0x19BA #Type 2 рудинок
var ore3 = 0x19B8 #Type 3 рудинок
var ore4 = 0x19B9 #Type 4 рудинок или более
var delay = 1200 #Задержка на кидание шмота из бекпака
var lasttimer
ore2:
uo.findtype(ore2)
if uo.findcount() > 0 then
UO.Drop('0',0,0,0,'finditem')
wait(delay)
goto ore2
endif
ore3:
uo.findtype(ore3)
if uo.findcount() > 0 then
UO.Drop('0',0,0,0,'finditem')
wait(delay)
goto ore3
endif
ore4:
uo.findtype(ore4)
if uo.findcount() > 0 then
UO.Drop('0',0,0,0,'finditem')
wait(delay)
goto ore4
endif
repeat
uo.findtype(ore4, "-1", "ground")
if uo.findcount() == 0 then
goto ore4_end
endif
uo.grab("1","finditem")
lasttimer = uo.timer()
repeat
wait(300)
uo.findtype(ore1)
until uo.findcount() > 0 or uo.timer()>lasttimer+500
uo.usetype(ore1)
uo.findtype(ore4, "-1", "ground")
until uo.findcount() == 0
ore4_end:
repeat
uo.findtype(ore3, "-1", "ground")
if uo.findcount() == 0 then
goto ore3_end
endif
uo.grab("1","finditem")
lasttimer = uo.timer()
repeat
wait(300)
uo.findtype(ore1)
until uo.findcount() > 0 or uo.timer()>lasttimer+500
uo.usetype(ore1)
uo.findtype(ore3, "-1", "ground")
until uo.findcount() == 0
ore3_end:
repeat
uo.findtype(ore2, "-1", "ground")
if uo.findcount() == 0 then
goto ore2_end
endif
uo.grab("1","finditem")
lasttimer = uo.timer()
repeat
wait(300)
uo.findtype(ore1)
until uo.findcount() > 0 or uo.timer()>lasttimer+500
uo.usetype(ore1)
uo.findtype(ore2, "-1", "ground")
until uo.findcount() == 0
ore2_end:
repeat
uo.findtype(ore1, "-1", "ground")
if uo.findcount() == 0 then
goto ore1_end
endif
uo.grab("1","finditem")
lasttimer = uo.timer()
repeat
wait(300)
uo.findtype(ore1)
until uo.findcount() > 0 or uo.timer()>lasttimer+500
uo.usetype(ore1)
uo.findtype(ore1, "-1", "ground")
until uo.findcount() == 0
ore1_end:
terminate()
endsub
#======================================thx to SavageV==========
# 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 dx<>0 AND dy<>0 Then
If dx>0 AND dy>0 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
Endif
If dx>0 AND dy<0 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
If dx<0 AND dy>0 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
If dx<0 AND dy<0 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
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
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
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
Endif
Endif
If dy<0 Then
StepSucess=Go(0,33,300) ;N - PgUp
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
Endif
Endif
Endif
Wend
end sub
sub Go(dir,key,walkwait)
VAR x,y
x=UO.GetX()
y=UO.GetY()
while UO.GetDir()<>dir
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
wend
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If x==UO.GetX() AND y==UO.GetY() Then
return -1
Else
return 1
Endif
end sub
#####################
# ОСТАНОВКА СКРИПТА #
#####################
sub terminate()
var Time
Time = Time()
UO.Print("!!Скрипт ОСТАНОВЛЕН!!")
UO.TextPrint('Скрипт ОСТАНОВЛЕН: '+Time)
uo.TextPrint('ИТОГ КОПКИ:')
uo.TextPrint('ВСЕГО РУДЫ - '+str(uo.Count('0x19B9')+uo.Count('0x19B7')+uo.Count('0x19BA'))+' шт.')
uo.TextPrint('Из неё Айрона - '+str(uo.Count('0x19B9','0x0000'))+' шт.')
uo.TextPrint('Остальная руда - '+str(uo.Count('0x19B9')+uo.Count('0x19B7')+uo.Count('0x19BA')-uo.Count('0x19B9','0x0000'))+' шт.')
UO.UseSkill("Stealth")
uo.concolor('0x002b')
wait(4000)
uo.exec("terminate all")
end sub
sub time()
var hh,mm,ss,hms,t=str(UO.Time())
if len(t)<=2 then
hh="0"
mm="0"
ss=t
endif
if len(t)==3 then
hh="0"
mm=left(t,len(t)-2)
ss=right(t,len(t)-1)
endif
if len(t)==4 then
hh="0"
mm=left(t,len(t)-2)
ss=right(t,len(t)-2)
endif
if len(t)==5 then
hh=left(t,len(t)-4)
hms=left(t,len(t)-2)
mm=right(hms,len(hms)-1)
ss=right(t,len(t)-3)
endif
if len(t)==6 then
hh=left(t,len(t)-4)
hms=left(t,len(t)-2)
mm=right(hms,len(hms)-2)
ss=right(t,len(t)-4)
endif
return hh+":"+mm+":"+ss
end sub
всё исправил!