Приветствую всех. Шард OLDP
За основу взял (не помню чей) майнинг на 5 шахт.
Тестил на 1 шахте.
Проблемки:
Поставил во всех процедурках отчеты о том что делает.
1. После рекола на рзгрузку может "тупануть" - при разгрузке 'Idem v tochku vigruzki' и стоит на месте или подойдет к сундуку и чего-то ждет. При загрузке - берет кирку и стопорится.
2. С элементалями. Может бегать вокруг элема (циклит WalkN) в итоге не пьет инвизку и помирает. Или недобивает элема и пытается среколится домой, таймер выставлял и 10000 и 20000.
3. Не пьет хилки (редко), хотя в паке лежат. Оба варианта глючат (say .drink heal и стандартный через findtype)
Проверку элемов убрал из mine - тупил еще хуже. Если будет 2 элема (2й кто-то выкопал) то как убьет своего пойдет копать. Элемы кастуют, бегают шустро (при касте отбегают)
Если ставить инвиз-рекол при появлении элема, то никаких проблем нет вообще.
Code:
######################################
# Промаркировать каждую пещеру надо зарание, запустив процедуру MultyMark()
# Для марка, обходя последовательно все точки копания набирать "set"
# (точка копания - центр квадрата 2х2 тайлов, который выкапывается подчистую)
# При окончании марка в текущей пещере набрать "stop" перереколиться в следующюю пещеру и продолжить
# После марка 5 пещер появятся файлы C:\mine.dat, C:\mine1.dat, C:\mine2.dat, C:\mine3.dat, C:\mine4.dat
# После этого можно начинать копку запустив процедуру main() стоя у банка.
# И если в банке будут лежать жаренные фишстеки, чар не применет возможностью ими полакомиться.
# при вероятности дисконнектов перед копкой запускать процедуру Reconnect
;,set quiet
################################
var kill=1 ;Убивать элементалей 1-да, 0-нет
var UCont = '0x4012CC93';ID конта в который будет складываться накопанное.
var LCont = '0x4012CC43' ;ID конта c бинтами, бутылками и т.д.
var RuneBook='0x40047289'
var weapon='0x13B5'
var shield='0x1B76'
var ncxu=4093 ;Координаты появления после рекола на разгрузку
var ncyu=386
var ncxC=4095 ;Координаты точки разгрузки
var ncyC=386
var gzX=2504
var gzY=556
var f=file("C:\mine32.dat")
var Space=' '
var q, w, p
var mine
var n
###############################
# процедура запуска для 5 пещер
# количество пещер может быть уменьшено или увеличено
# удалением или внесением троестрочий вида:
# f=file("C:\mine1.dat")
# mine='Mine1'
# one()
sub main()
var Time=Time()
Uo.exec("set norbcheck 1")
uo.exec("set norbcalc 1")
UO.Click('self')
wait(100)
uo.GetStatus('uo.JournalSerial(0)')
uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0)))
uo.TextOpen()
uo.TextPrint('Начинаем:'+uo.GetName(uo.JournalSerial(0)) +Space +Time)
uo.exec('terminate alln_main')
While true
uo.say(' ')
uo.say(',exec alert')
uo.say(',exec mine')
uo.say(',exec autobotl')
While not uo.dead()
wait(1000)
Wend
uo.exec('terminate alln_main')
While uo.dead()
uo.press(32881) ;Закрываем все гампы ALT+F2
wait(100)
CheckLag()
uo.press(113) ;Открываем papedroll F2
wait(100)
CheckLag()
uo.lclick(1882,58)
wait(100)
CheckLag()
uo.lclick(353,349)
wait(100)
CheckLag()
uo.press(112) ;Открываем backpack
Wend
wait(120000)
While uo.getx()<>ncxu and uo.gety()<>ncyu
Recalling(RuneBook, 4)
Wend
walkn(ncxC,ncyC,'')
wait(2000)
Eqiuping()
Wend
end sub
#######################################
Sub mine()
var Time=Time()
uo.TextOpen()
uo.TextPrint('ТП в точку выгрузки' +Space +Time)
While uo.getx()<>ncxu and uo.gety()<>ncyu
Recalling(RuneBook, 4)
Wend
repeat
f=file("C:\mine32.dat")
mine='Mine'
n=3
one()
; f=file("C:\mine1.dat")
; mine='Mine1'
; n=4
; one()
; f=file("C:\mine2.dat")
; mine='Mine2'
; n=5
; one()
; f=file("C:\mine3.dat")
; mine='Mine3'
; one()
; f=file("C:\mine4.dat")
; mine='Mine4'
; one()
until UO.Dead()
end Sub
################################
Sub one()
dim PX[50], PY[50]
var Minepoints=0
var i
uo.Print('Loading from file...')
f.open()
Minepoints=safe call f.ReadNumber()
for i=1 to Minepoints
PX[i]=safe call f.ReadNumber()
PY[i]=safe call f.ReadNumber()
next
f.close()
uo.Print('Loaded')
unload()
load()
rest()
Recalling(RuneBook, n)
for p=1 to Minepoints
uo.Print('X: '+str(PX[p])+' Y: '+str(PY[p]))
WalkN(PX[p],PY[p],'')
q=PX[p]
w=PY[p]
uo.Print('Mining...')
UO.Warmode("0")
mine(PX,PY)
next
Recalling(RuneBook, 4)
unload()
end Sub
##########################
Sub vozvrat(PX,PY)
var i
uo.Print('Move...')
for i=1 to p
uo.Print('X: '+str(PX[p])+' Y: '+str(PY[p]))
WalkN(PX[i],PY[i],'')
next
end Sub
########################
Sub Mark()
dim PX[50], PY[50]
var Minepoints=0
var i
uo.Print('Start marking...')
for i=1 to 50
UO.DeleteJournal()
uo.Print('Set point '+ str(i))
repeat
wait(500)
if UO.InJournal('stop')then
SaveToFile(i-1,PX,PY)
return
endif
until UO.InJournal('set')
PX[i] = UO.GetX("self")
PY[i] = UO.GetY("self")
uo.Print('Point '+str(i)+' X: '+str(PX[i])+' Y: '+str(PY[i])+'taken')
next
end Sub
########################
sub MultyMark()
uo.Print('Cove............ 1')
f=file("C:\mine32.dat")
Mark()
#uo.Print('Cove............ 2')
#f=file("C:\mine1.dat")
#Mark()
#uo.Print('Cove............ 3')
#f=file("C:\mine2.dat")
#Mark()
#uo.Print('Cove............ 4')
#f=file("C:\mine3.dat")
#Mark()
#uo.Print('Cove............ 5')
#f=file("C:\mine4.dat")
#Mark()
uo.Print('Marking finished. Ready for mine')
end Sub
#############################
Sub SaveToFile(mp,PX,PY)
var s=0,k=0
f.open()
f.create()
uo.Print('points = '+ str(mp))
s=safe call f.writeln(mp)
for k=1 to mp
s=safe call f.writeln(str(PX[k])+' '+str(PY[k]))
next
f.close()
end Sub
##################################
Sub mine(PX,PY)
var x, y,z
VAR LastTimer
var ms1="can't see"
var ms2="heavy"
var ms3="location"
var ms4="far away"
var ms5="in rock"
var ms6="elsewhere"
var ms7="nothing"
var ms8="You cannot mine"
var ms9="Correct code."
var ms10="close"
var h1="Gypsum"
var h2="Zink"
var h3="Stone"
var h4="Marble"
var h5="Sandstone"
var h6="Plaster"
var ore1="Marganece"
var ore2="Tourmaline"
var ore3="Tin"
var ore4="Bronze"
var ore5="Lead"
var ore6="Corrundum"
var ore7="Gold"
var ore8="Silver"
UO.Set('finddistance','2')
z=UO.GetZ("self")
for x=-2 to 2
for y=-2 to 2
UO.Print(str(x)+" "+str(y))
Repeat
UO.DeleteJournal()
UO.Exec("warmode 0")
UO.WaitTargetTile("1341",STR(UO.GetX()+x),STR(UO.GetY()+Y),z)
UO.UseType('0x0E85')
LastTimer=UO.Timer()
Repeat
If uo.lastgump('replyed') == 0 && uo.lastgump('text') == 'Please enter code:' Then
uo.textopen()
uo.textprint('Ахтунг! Нужен код!')
While not uo.InJournal(ms9)
wait(100)
Wend
End If
wait(100)
Until UO.InJournal(ms1) or UO.InJournal(ms2) or UO.InJournal(ms3) or UO.InJournal(ms4) or UO.InJournal(ms5) or UO.InJournal(ms6) or UO.InJournal(ms7) or UO.InJournal(ms8) or UO.InJournal(ms9) or UO.InJournal(ms10) or UO.InJournal(ore1) or UO.InJournal(ore2) or UO.InJournal(ore3) or UO.InJournal(ore4) or UO.InJournal(ore5) or UO.InJournal(ore6) or UO.InJournal(ore7) or UO.InJournal(ore8) or UO.InJournal(h1) or UO.InJournal(h2) or UO.InJournal(h3) or UO.InJournal(h4) or UO.InJournal(h5) or UO.InJournal(h6) or UO.Timer()>LastTimer+500
uo.exec("warmode 1")
wait(50)
uo.exec("warmode 0")
wait(50)
Until UO.InJournal(ms3) or UO.InJournal(ms4) or UO.InJournal(ms5) or UO.InJournal(ms6) or UO.InJournal(ms7) or UO.InJournal(ms10) or UO.InJournal(ore1) or UO.InJournal(ore2) or UO.InJournal(ore3) or UO.InJournal(ore4) or UO.InJournal(ore5) or UO.InJournal(ore6) or UO.InJournal(ore7) or UO.InJournal(ore8) or UO.InJournal(h1) or UO.InJournal(h2) or UO.InJournal(h3) or UO.InJournal(h4) or UO.InJournal(h5) or UO.InJournal(h6)
if UO.Weight>600 then
drop()
End If
If UO.Weight>700 then
unload(PX,PY)
End If
next
next
end Sub
#######################################
Sub drop()
var Time=Time()
var i
var amount=14
dim color[14]
color[1]='0x06D6' ;Marganece
color[2]='0x04C2' ;Tourmaline
color[3]='0x052D' ;Tin
color[4]='0x0488' ;Bronze
color[5]='0x084D' ;Lead
color[6]='0x060C' ;Corrundum
color[7]='0x0445' ;Gold
color[8]='0x0481' ;Silver
color[9]='0x03E3' ;Gypsum
color[10]='0x0026' ;Zink
color[11]='0x0909' ;Stone
color[12]='0x079E' ;Marble
color[13]='0x0090' ;Sandstone
color[14]='0x0097' ;Plaster
uo.ignorereset()
repeat
uo.deletejournal()
if uo.Targeting()==1 then
uo.canceltarget()
End If
for i = 1 to amount
uo.findtype('0x19B9',color[i],'backpack')
While uo.findcount() > 0
UO.WaitTargetObject('finditem')
UO.Drop(0,'finditem')
Wait(2500)
CheckLag()
UO.FindType('0x19B9',color[i],'backpack')
Wend
Next
uo.print('Drop Finished')
end Sub
#########################################
Sub load()
var Time=Time()
uo.TextOpen()
uo.TextPrint('Берем все необходимое' +Space +Time)
walkn(ncxC,ncyC,'')
wait(2000)
UO.DeleteJournal()
UO.UseObject(LCont)
wait(4000)
uo.print('Pickaxe')
UO.FindType('0x0E85','-1','backpack') ;pickaxe
If UO.Count('0x0E85')<1 Then
UO.FindType('0x0E85','-1',LCont )
UO.Grab('1','finditem')
Wait(2000)
End If
uo.print('Invis')
UO.FindType('0x182D','0x08FA','backpack') ;invis
If UO.Count('0x182D')<1 Then
UO.FindType('0x182D','0x08FA',LCont )
UO.Grab('1','finditem')
Wait(2000)
End If
If kill==1 Then
uo.print('GrStr')
UO.FindType('0x0F09',-1,'backpack') ;bandage
If UO.Count('0x0F09')<1 Then
UO.FindType('0x0F09','-1',LCont )
UO.Grab('1','finditem' )
Wait(2000)
End If
uo.print('Bandage')
UO.FindType('0x0E21',-1,'backpack') ;bandage
If UO.Count('0x0E21')<10 Then
UO.FindType('0x0E21','-1',LCont )
UO.Grab(str(10-UO.Count('0x0E21')),'finditem' )
Wait(2000)
End If
uo.print('Heal potion')
UO.FindType('0x182B',-1,'backpack') ;heal
If UO.Count('0x182B')<5 Then
UO.FindType('0x182B','-1',LCont )
UO.Grab(str(5-UO.Count('0x182B')),'finditem' )
Wait(2000)
End If
End If
uo.print('Zatar Finished')
recharge()
end Sub
#####################################
Sub recharge()
var Time=Time()
uo.TextOpen()
uo.TextPrint('Перезаряжаем рунбуку' +Space +Time)
UO.DeleteJournal()
UO.FindType('0x1F4C',-1,LCont) ;реколы
UO.Grab(20,'finditem')
CheckLag()
Repeat
UO.Recall(RuneBook, 1)
wait(1000)
Until uo.InJournal('The book is') or uo.InJournal('You have no scrolls')
UO.FindType(0x1F4C,-1,'backpack')
UO.MoveItem('finditem',0,LCont)
CheckLag()
uo.print('Recharge Finished')
end Sub
######################################
Sub unload()
var Time=Time()
uo.TextOpen()
uo.TextPrint('Выгружаем накопанное и лут' +Space +Time)
VAR a
VAR LastTimer
DIM Ore[13]
Ore[1]=0x19B9 ;4 and more ore
Ore[2]=0x19B7 ;1 ore
Ore[3]=0x19BA ;2 ore
Ore[4]=0x19B8 ;3 ore
Ore[5]=0x0EED ;деньги
Ore[6]=0x09AA ;пандоры
Ore[7]=0x19B9 ;руда
Ore[8]=0x0F26 ;диаманты
Ore[9]=0x0F8A ;pig iron
Ore[10]=0x1422 ;plaster
Ore[11]=0x1BF2 ;marble
Ore[12]=0x14EB ;map
Ore[13]=0x1088 ;necklace
uo.print('Idem v tochku vigruzki')
walkn(ncxC,ncyC,'')
wait(2000)
UO.UseObject(UCont)
CheckLag()
For a=1 to 13
UO.FindType(ore[a],-1,'backpack')
While UO.FindCount() > 0
UO.MoveItem('finditem',-1,UCont)
wait(500)
CheckLag()
UO.FindType(ore[a])
Wend
next
uo.print('Unload Finished')
end Sub
#######################################
Sub unload(PX,PY)
While uo.getx()<>ncxu and uo.gety()<>ncyu
Recalling(RuneBook, 4)
Wend
unload()
load()
wait(100)
Recalling(RuneBook, n)
uo.DeleteJournal()
vozvrat(PX,PY)
end Sub
##############################
Sub rest()
var Time=Time()
uo.TextOpen()
uo.TextPrint('Восстанавливаем МП и ХП' +Space +Time)
VAR LastTimer
while UO.Mana<UO.Int
UO.DeleteJournal()
LastTimer=UO.Timer()
UO.UseSkill('Meditation')
repeat
wait(100)
until UO.InJournal("You are") OR UO.InJournal("You lose") OR UO.Timer()>LastTimer+200
wend
While uo.life<uo.str
UO.DeleteJournal()
UO.BandageSelf()
Repeat
wait(100)
until uo.injournal('You put') or uo.injournal('You fail healing!') OR UO.Timer()>LastTimer+500
Wend
uo.print('HP MP restored')
end Sub
#########################################
Sub CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
repeat
wait(100)
until UO.InJournal('backpack')
end Sub
#######################################
sub Eqiuping()
UO.UseObject(LCont)
wait(5000)
uo.findtype('0x0E76',-1,LCont) ;armor pack
If uo.findcount()>0 Then
UO.Grab('1','finditem' )
Wait(2000)
Checklag()
uo.findtype('0x0E76',-1,'backpack')
uo.useobject('finditem')
uo.findtype(weapon,-1,LCont)
UO.Grab('1','finditem' )
Wait(2000)
Checklag()
uo.findtype(shield,-1,LCont)
UO.Grab('1','finditem' )
Wait(2000)
Checklag()
While UO.ObjAtLayer('Rhand')==''
uo.usetype(weapon)
Wait(100)
Wend
While UO.ObjAtLayer('Lhand')==''
uo.usetype(shield)
Wait(100)
Wend
While UO.ObjAtLayer('Legs')==''
uo.usetype('0x1411')
Wait(100)
Wend
While UO.ObjAtLayer('Arms')==''
uo.usetype('0x1410')
Wait(100)
Wend
While UO.ObjAtLayer('Gloves')==''
uo.usetype('0x1414')
Wait(100)
Wend
While UO.ObjAtLayer('Neck')==''
uo.usetype('0x1413')
Wait(100)
Wend
While UO.ObjAtLayer('Torso')==''
uo.usetype('0x1415')
Wait(100)
Wend
While UO.ObjAtLayer('Hat')==''
uo.usetype('0x1412')
Wait(100)
Wend
Else
Recalling(RuneBook, 2)
uo.exec('terminate all')
End If
End Sub
#######################################
sub alert()
var Time=Time()
var Space=' '
uo.deletejournal()
While not uo.dead()
uo.deletejournal()
While not UO.InJournal(":")
Wait(10)
Wend
If UO.InJournal("Elemental") Then
If kill==1 Then
UO.FindType(0x000E,-1,'ground')
If UO.FindCount()>0 Then
killelem()
uo.say(',exec mine')
End If
Else
uo.TextOpen()
uo.TextPrint('Сваливаем от элементаля'+uo.GetName(uo.JournalSerial(0)) +Space +Time)
safe()
uo.exec('terminate all')
End If
End If
If uo.injournal("[Chaos]") or uo.injournal("[Criminal]") Then
uo.GetStatus('uo.JournalSerial(0)')
uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0)))
uo.TextOpen()
uo.TextPrint('Появился враг - '+uo.GetName(uo.JournalSerial(0)) +Space +Time)
uo.exec('terminate mine')
safe()
wait(120000)
uo.say(',exec mine')
End If
Wait(100)
Wend
end Sub
#######################################
Sub killelem()
var Time=Time()
var y = uo.GetGraphic(uo.ObjAtLayer('Rhand'))
VAR LastTimer, Elem ,it=1
UO.Set('finddistance','20')
uo.exec("warmode 1")
wait(50)
uo.exec("warmode 0")
uo.print('weapon')
Repeat
uo.usetype(weapon)
Wait(100)
it=it+1
Until uo.GetGraphic(uo.ObjAtLayer('Rhand'))==weapon or it>10
If uo.GetGraphic(uo.ObjAtLayer('Rhand'))<>weapon Then
uo.say(' ')
uo.say('.arm')
uo.TextOpen()
uo.TextPrint('Нет оружия' +Space +Time)
End If
UO.DeleteJournal()
UO.FindType(0x000E,-1,'ground')
While UO.FindCount()>0
uo.TextOpen()
uo.TextPrint('Идем убивать элементаля' +Space +Time)
uo.exec('terminate mine')
uo.findtype('0x0F09','0x0000','backpack')
UO.Useobject('finditem')
wait(200)
Elem=UO.GetSerial('finditem')
UO.Exec('warmode 1')
UO.Attack(Elem)
WalkN(0,0,Elem)
wait(100)
repeat
If uo.GetGraphic(uo.ObjAtLayer('Rhand'))<>weapon Then
uo.say(' ')
uo.say('.arm')
uo.TextOpen()
uo.TextPrint('Нет оружия' +Space +Time)
End If
If UO.GetDistance(Elem)>1 then
WalkN(0,0,Elem)
End If
If uo.life<30 Then
bheal()
End If
wait(100)
until uo.gethp(Elem)==0 OR LastTimer+10000<UO.Timer()
uo.TextOpen()
uo.TextPrint('Элем мертв' +Space +Time)
wait(5000)
UO.Exec('warmode 0')
loot()
wait(2000)
Wend
end Sub
#######################################
sub autobotl()
While not uo.dead()
If uo.life<100 Then
uo.findtype('0x182B','0x0000','backpack')
If UO.FindCount()>0 Then
UO.Useobject('finditem')
End If
End If
If uo.Stamina<20 Then
uo.findtype('0x182C','0x0000','backpack')
UO.Useobject('finditem')
End If
Wait(100)
Wend
end sub
#######################################
sub bheal()
var Time=Time()
uo.TextOpen()
uo.TextPrint('ХП мало' +Space +Time)
uo.exec("warmode 0")
wait(10)
uo.say(' ')
wait(10)
uo.say('.drink invis')
wait(50)
If uo.injournal('not found') Then
uo.TextOpen()
uo.TextPrint('Инвизок нет' +Space +Time)
uo.DeleteJournal()
while not uo.Hidden()
uo.DeleteJournal()
uo.warmode(0)
uo.UseSkill('Hiding')
While not uo.injournal('You have hidden') and not uo.injournal('You stop')
wait(50)
Wend
wait(50)
Wend
End If
While uo.life<uo.str
UO.DeleteJournal()
UO.BandageSelf()
While not uo.injournal('You put') and not uo.injournal('You fail healing!')
wait(50)
wend
Wend
end sub
#######################################
Sub safe()
var Time=Time()
uo.exec("warmode 0")
wait(100)
uo.say(' ')
wait(10)
uo.say('.drink invis')
wait(100)
If uo.injournal('not found') Then
uo.TextOpen()
uo.TextPrint('Инвизок нет' +Space +Time)
End If
While uo.getx()<>gzX and uo.gety()<>gzY
Recalling(RuneBook, 2)
Wend
wait(1000)
end sub
#######################################
Sub Recalling(RuneBook, NRune)
VAR myx=UO.GetX()
VAR myy=UO.GetY()
VAR i=0
uo.DeleteJournal('fizzles')
UO.Recall(RuneBook, NRune)
CheckLag()
repeat
wait(100)
i = i + 1
until (i>100) OR UO.InJournal('fizzles')
wait(100)
If myx==UO.GetX() AND myy==UO.GetY() Then
UO.WarMode(0)
wait(50)
Recalling(RuneBook, NRune)
End If
end sub
#######################################
Sub Time()
var Date,nTime,uTime,i
uTime=str(uo.Time())
nTime=''
for i=0 to Len(uTime)
nTime=uTime[Len(uTime)-i]+nTime
if (i==2) or (i==4) then
nTime=':'+nTime
End If
next
uTime=str(uo.Date())
Date=''
for i=0 to Len(uTime)
Date=uTime[Len(uTime)-i]+Date
if (i==2) or (i==4) then
Date='.'+Date
End If
next
uTime=nTime+' @ '+Date
return uTime
end sub
#######################################
var LootDelay = 1000 ; задержка на лут предметов из трупа
var LootDist = 2 ; расстояние с которого лутить труп
var LootSize = 1 ; размер массива предметов
var Carve = False ; резать трупы
var Cut = False ; резать кожу
var Hidden = False ; прятаться во время лута
var Track = False ; трекать игроков
var Knife = '0x0F51'
var Scissors = '0x0F9E' ; тип ножниц
var Hide = '0x1078' ; тип неразрезанной кожи
var Corpse = '0x2006' ; тип трупа
var dBag = '0x0160'; цвет контейнера, куда скидывать лут
Sub loot()
dim Loot[LootSize]
Loot[1] = '0xFFFF' ; все предметы
var CurrentCorpse
var Index
UO.WarMode(0)
UO.Set('finddistance', Str(LootDist))
UO.FindType(Corpse, '-1', 'ground')
if UO.FindCount() > 0 then
CurrentCorpse = UO.GetSerial('finditem')
UO.Print('Лутим труп ' + UO.GetName(CurrentCorpse))
UO.UseObject(CurrentCorpse)
Wait(500)
for Index = 1 to LootSize
UO.FindType(Loot[Index], '-1', CurrentCorpse)
while UO.FindCount() > 0
if UO.GetDistance(CurrentCorpse) > LootDist then
UO.Print('Труп облутан не полностью!')
UO.WarMode(True)
return False
End If
UO.Grab('10000','finditem')
Wait(LootDelay)
UO.FindType(Loot[Index], '-1', CurrentCorpse)
wend
next
UO.Hide(CurrentCorpse)
UO.Ignore(CurrentCorpse)
End If
UO.Print('Труп успешно облутан.')
return True
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
If Target<>"" Then
dx=UO.GetX(Target)-UO.GetX()
dy=UO.GetY(Target)-UO.GetY()
; UO.Print("Target locked!")
If UO.GetDistance(Target)<1 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
#######################################