Мининг + Ходилка
Posted: 2009-09-12 15:37:47
Взял скрипт на мининг прикрепил к нему ходилку - вроде всё работает на УРА... Но иногда вылазит PARSER и после клиент крашиться. Смысл скрипта копает, докапывает до полного веса идёт ложыт в сумку. Если вылазит Элементал одевает Катану убивает его. И обратно наченает копать. Может кто поможет найти в чём проблема?
Это не столь важно вроде.
Мининг Скрипт
Ходилка Работает На Ура!
Это не столь важно вроде.
;Кординаты
sub Na4alokopki()
while gotoxy(1917,373,0)
Mining()
GoToHome()
GoToMine()
gotoxy(1912,372,0)
Mining()
GoToHome()
GoToMine()
gotoxy(1909,370,0)
Mining()
GoToHome()
GoToMine()
gotoxy(1905,369,0)
Mining()
GoToHome()
GoToMine()
gotoxy(1901,368,0)
Mining()
GoToHome()
GoToMine()
gotoxy(1903,364,0)
Mining()
GoToHome()
GoToMine()
gotoxy(1897,367,0)
Mining()
GoToHome()
GoToMine()
gotoxy(1893,365,0)
Mining()
GoToHome()
GoToMine()
wend
end sub
sub GoToHome()
;gotoxy(1922,374,0)
gotoxy(1924,373,0)
wait(100)
loot()
end sub
sub GoToMine()
;gotoxy(1924,373,0)
;gotoxy(1922,374,0)
gotoxy(1917,374,0)
end sub
Мининг Скрипт
;Сам Мининг
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('0x0E86')
LastTimer=UO.Timer()
Repeat
wait(500)
if uo.injournal("is attacking you") then
UO.UseType('0x13FE')
Pauza()
endif
wait(410)
If UO.Life < (UO.Str - 5) Then
UO.Exec("bandageself")
Endif
if uo.weight > 545 then ; Максимальный вес при котором домой с рудой
GoToHome()
endif
Until UO.InJournal("You put") or UO.InJournal("You cannot mine") or UO.InJournal("can't see") or UO.InJournal("heavy") or UO.InJournal("stop") or UO.InJournal("location") or UO.InJournal("no ore") or UO.InJournal("but fail") or UO.InJournal("far away") 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("You put") then
n=0
else
n=n+1
endif
Until UO.InJournal("nothing") or UO.InJournal("elsewhere") or UO.InJournal("no ore here") 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 loot() ; перекладка руды в сундук
if uo.waiting() then
uo.canceltarget()
endif
VAR a,Exit
VAR UnloadCont='0x40009F27' ; АЙДИ сундука для руды
DIM Ore[5]
Ore[0]=0x19B9 ; 4 and more ore
Ore[1]=0x19B7 ; 1 ore
Ore[2]=0x19BA ; 2 ore
Ore[3]=0x19B8 ; 3 ore
UO.SetReceivingContainer(UnloadCont)
wait(500)
For a=0 to 3
Exit=0
repeat
UO.FindType(Ore[a])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
wait(1500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
end sub
sub Pauza() ; Пауза скрипта если выкопали Элема (продолжить сказав GO )
UO.DeleteJournal()
REPEAT
WAIT(3000)
UO.Print("!!!СКРИПТ НА ПАУЗЕ!!!!")
UNTIL UO.InJournal('GO') or UO.InJournal('Body of Earth Elemental')
UO.Print("!!!СКРИПТ ПРОДОЛЖЕН!!!!")
endif
end sub
sub Plavka()
uo.IgnoreReset()
uo.FindType('0x19B9')
while uo.FindCount()
if uo.GetQuantity('finditem') > 9 then
uo.UseObject('finditem')
while uo.GetX('finditem')
wait(200)
wend
else
uo.Ignore('finditem')
end if
uo.FindType('0x19B9')
wend
GoToMine()
end sub
Ходилка Работает На Ура!
;Ходилка
#(c)SerrouS
Sub InitStack()
UO.SetGlobal('STACK', '0')
endsub
Sub Push( param )
var chk = val(UO.GetGlobal('STACK')) ; количество элементов в стеке
UO.SetGlobal('STACK',str(chk + 1))
UO.SetGlobal('STACK_'+str(chk), param)
endsub
Sub Pop ()
var chk = val(UO.GetGlobal('STACK')) ; количество элементов в стеке
if chk then
UO.SetGlobal('STACK',str(chk - 1))
return UO.GetGlobal('STACK_'+str(chk - 1))
else
return ''
endif
endsub
SUB GoToXY(x,y,prec)
#original (c) ...
#modification 2.00 (c) SerrouS
dim turn[8] ; индекс - ГетДир, значение поворот направо под 45 градусов
turn[0] = 39
turn[1] = 34
turn[2] = 40
turn[3] = 35
turn[4] = 37
turn[5] = 36
turn[6] = 38
turn[7] = 33
dim deltax[8]; индекс - аналогично, значение - изменение координаты при проходе стенки
dim deltay[8]
deltax[0] = 1
deltax[1] = 1
deltax[2] = 1
deltax[3] = 0
deltax[4] = -1
deltax[5] = -1
deltax[6] = -1
deltax[7] = 0
deltay[0] = -1
deltay[1] = 0
deltay[2] = 1
deltay[3] = 1
deltay[4] = 1
deltay[5] = 0
deltay[6] = -1
deltay[7] = -1
var dx,dy
var mx,my ; current coords
var lx = 0, ly = 0, ld = -1 ; last move coords
var pathFind = 0 ; as logical 0 - norm, 1 - block
var ind
var recursInd = 0
var fout = 0
var stepdelay = 300
InitStack()
repeat
mx=UO.GetX()
my=UO.GetY()
; calculating for precision coming
dx = mx - x
If dx < 0 Then
dx = 0 - dx
EndIf ;get ABS diff
dy = my - y
If dy < 0 Then
dy = 0 - dy
EndIf
If dy > dx Then
dx = dy
EndIf
If dx <= prec Then
Return
EndIf
if mx == x and my == y then
return
endif
lx = mx
ly = my
ld = UO.GetDir() ; cause once pressing can only change the direcction
if mx == x and my > y then
UO.Press(33)
endif
if mx == x and my < y then
UO.Press(35)
endif
if mx < x and my == y then
UO.Press(34)
endif
if mx < x and my > y then
UO.Press(39)
endif
if mx < x and my < y then
UO.Press(40)
endif
if mx > x and my == y then
UO.Press(36)
endif
if mx > x and my > y then
UO.Press(38)
endif
if mx > x and my < y then
UO.Press(37)
endif
UO.Print('KeyPressed')
wait( stepdelay )
if lx == UO.GetX() and ly == UO.GetY() and ld == UO.GetDir() then
; now there is a stop situation
UO.Print('PathFind')
recursInd = 0
repeat
#################################################
ind = ld
UO.Print(str(ind))
fout = 0
repeat ; идем в обход пока не упремся снова или не кончится стена
UO.Print('Iteration')
mx = UO.GetX()
my = UO.GetY()
ld = UO.GetDir()
UO.Press( turn[ ind ] )
wait( stepdelay )
if (UO.GetX() == mx and UO.GetY() == my and ld == UO.GetDir()) then
fout = 1 ; уперлись
else
dx = UO.GetX() - mx
dy = UO.GetY() - my
UO.Print('deltas '+str(dx)+' '+str(dy))
if deltax[ ind ] == dx and deltay[ ind ] == dy then
fout = 2 ; препятствие пройдено
endif
endif
until fout
UO.Print('fout '+ str(fout))
if fout == 1 then ; уходим на следующий поворот
recursInd = recursInd + 1
Push( str( ind ) )
;ld = ind
else ; fout == 2
; надо попытаться восстановить контекст из стека, или выйти из обхода
UO.Print('Iter '+ str(recursInd))
pathFind = 0
if recursInd then ; восстановление
pathFind = 1
recursInd = recursInd - 1
ld = val(Pop()) - 1
if ld == -1 then
ld = 7
endif
UO.Press( turn[ld] )
wait ( stepdelay ) ; в сиду того, что ондо нажатие меняет напрваление
endif
endif
#################################################
until not recursInd and not pathFind
UO.Print('PathFind END')
endif