Code: Select all
# 1) Запускаем функцию sub record_path()
# 2) Медленно при помощи клавиатуры ходим по желаемому маршруту копания
# 3) При прохождении всего маршрута (желательно вернуться на исходную позицию... И желательно запомнить ее расположение) пишем просто слово stop
# 4) Появится окошко ТЕКСТ. Там вы увидите набор примерно такого вида 9s9d8e4k6g
# 5) Копируем его и вставляем в кавычки в поля var path="ТУТ ВСТАВИТЬ" в функции main().
# 6) В функции sub record_path() поле var path="" оставить без изменений (пустым)
# 7) В обжект тайпах прописать тип pickaxe на кирку. Либо, у кого дойдут руки, отредактировать этот скрипт и вставить запрос на кирку прямо в клиенте (прим. ВЕТЕРАН).
# 8) Скрипт писал не я.
###########################################################
# Main Mining Function! Conf. Needed (look above)
############################################################
sub go_mining()
var cycle=1 # 1 - зациклировать, 0 - нет
var path="9i2i3o9l2l2k" # все в кавычках очистить вначале скрипта
var test=0
var i=0
var j
VAR UnloadBox='0x4000b61e' ; ID containera
VAR UnloadBag='0x4000df13' ; ID Meshka
VAR Lopata='0x4000be70' ; ID kirki&lopati
VAR MaxWeight=400 ; vash maksimal'niy ves
VAR MyX, MyY, MyZ
MyX = 238
MyY = 268
MyZ = UO.GetZ()
ToHide()
Wait(1000)
UO.DeleteJournal()
While i<LEN(path)
if VAL(path[i]) then
j=VAL(path[i])
i=i+1
else
j=1
endif
Repeat
if test<>1 then
UO.DeleteJournal()
mine_spot()
end if
UO.Print("New Location!")
if not make_step(path[i]) then
UO.Print("Probably Stuck!")
UO.Print("Hope it is a Worldsave")
endif
j=j-1
Until j==0
i = i + 1
if cycle && i==LEN(path) then
i=0
endif
Wend
end sub
############################################################
# Auxilliar Function. Little mod needed (look above)
############################################################
sub mine_spot()
var Timer
VAR UnloadBox='0x4000b61e' ; ID containera
VAR UnloadBag='0x4000df13' ; ID Meshka
VAR Lopata='0x4000be70' ; ID kirki&lopati
VAR MaxWeight=400 ; vash maksimal'niy ves
VAR MyX, MyY, MyZ
MyX = 238
MyY = 268
MyZ = UO.GetZ()
var wrema=uo.timer()
Var i, f, copX, copY
copX=uo.getX()
copY=uo.getY()
For i = copX-2 to copX+2
For f = copY-2 to copY+2
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")
UO.Print("Now Mining In: "+str(copX-i)+" "+str(copY-f))
CheckLag()
ToHide()
UO.DeleteJournal()
UO.WaitTargetTile("1339",STR(i),STR(f), str(MyZ))
UO.UseObject(Lopata)
Timer=0
Repeat
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("nothing") AND NOT UO.InJournal("cannot") AND NOT Timer>=50
Wait(500)
Timer=Timer+1
Wend
If UO.Weight>MaxWeight then
WalkN(361,333,UnloadBox)
Unload(UnloadBag)
WalkN(MyX,MyY,'')
else
wait(100)
Endif
next
next
if uo.timer()>= wrema + 3000 then
uo.usetype('0x097b','0x0000')
uo.usetype('0x0c6d','0x0000')
wait(1000)
edatimer=uo.timer()
return 0
Wend
end sub
############################################################
# Main Path-Recording function!
############################################################
sub record_path()
var x
var y
var path=""
UO.DeleteJournal()
Repeat
x=UO.GetX()
y=UO.GetY()
if waitNewPos(x,y) then
path=path+extract_dir(x,y,UO.GetX(),UO.GetY())
endif
Until UO.InJournal("stop")
path = compressPath(path)
UO.TextClear()
UO.TextOpen()
UO.TextPrint("Your path is:")
UO.TextPrint(path)
end sub
############################################################
# Auxilliar sub.
############################################################
sub send_step(keycode,dir)
var x = UO.GetX()
var y = UO.GetY()
var timeout = 0
if UO.GetDir()<>dir then
UO.Press(keycode)
Repeat
wait(50)
Until UO.GetDir()==dir
endif
UO.Press(keycode)
Repeat
timeout=timeout+50
wait(50)
Until x<>UO.GetX() || y<>UO.GetY() || timeout>2000
if timeout>2000 then
return 0
endif
return 1
end sub
############################################################
# Bunch of auxilliar subs. No need to change anything!
############################################################
sub waitNewPos(x,y)
while x==UO.GetX() && y==UO.GetY()
if UO.InJournal("stop") then
return 0
endif
wend
return 1
end sub
sub compressPath(path)
Var i=0
Var j=0
Var newPath=""
while i<LEN(path)
j=1
while path[i]==path[i+1] AND j<9
i=i+1
j=j+1
wend
if j==1 then
newPath=newPath+path[i]
else
newPath=newPath+STR(j)+path[i]
endif
i=i+1
wend
return newPath
end sub
sub extract_dir(x,y,a,b)
if x>a then
if y==b then
return "i"
else
if y>b then
return "n"
else
return "w"
endif
endif
else
if x<a then
if y==b then
return "l"
else
if y>b then
return "e"
else
return "s"
endif
endif
else
if y>b then
return "o"
else
return "k"
endif
endif
endif
end sub
sub make_step(dir)
if dir=="e" then
send_step(39,1)
return 1
endif
if dir=="l" then
send_step(34,2)
return 1
endif
if dir=="s" then
send_step(40,3)
return 1
endif
if dir=="k" then
send_step(35,4)
return 1
endif
if dir=="w" then
send_step(37,5)
return 1
endif
if dir=="i" then
send_step(36,6)
return 1
endif
if dir=="n" then
send_step(38,7)
return 1
endif
if dir=="o" then
send_step(33,0)
return 1
endif
if dir=="d" then
While UO.Count("0x19b9")
UO.Drop("0x19b9")
wait(1000)
Wend
wait(200)
return 1
endif
UO.Print("Recall Time!")
return 0
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
#================================================= =============
# 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