Всем привет. Мне очень нужно скрестить Мbнинг ВЕТЕРАН'А и Ходилку
SerrouS'a
Но проблема в том, что я незнаю как... Хоть я и начал изучать скриптинг, всеравно, для меня это пока сложно и я прошу вашей помощи=)
Тема такая. Открылся новый шард, на котором пока нету рунбуков и дальность копки руды всего 2 таила. Поэтому я решил подредактировать скрипт Ветерана и добавить туда ходилку... И вробе бы я ее тудда впихнул, координаты вписал. Теперь мне нужно, чтобы скрипт реагировал на саму копку... Тйсть если вокруг руда закончилась, он проверял посредстом поворота на 360 градусов)) Если он там не находит руду, он переходит на следующий таил и копает там и так далее... я впринципе мог что то неправильн сделать... но если что. поправьте пожалуста. И если вам несложно, то как "скрестите скрипты", напишите на примере сэтого скрипта, как эьто делать, чтобы лишнй раз не писать сюда, с такой же просьбой. Заранее пасибо.
Code: sub maning() #BETEP™# var mx, my, mz, i, j, jor, ser, noto Uo.exec("set norbcheck 1"); для рекола uo.exec("set norbcalc 1"); тоже
uo.print('!!Выбери Лопату!! ') uo.exec('addobject Shovel') while uo.targeting() wait(100) wend
uo.print('!!Выбери Руну ДОМОЙ !! ') uo.exec('addobject runeHome') while uo.targeting() wait(100) wend
uo.print('!!Выбери Руну В ПЕЩЕРУ !! ') uo.exec('addobject runeCave') while uo.targeting() wait(100) wend
na4alo: mx = UO.GetX("self") my = UO.GetY("self") mz = UO.GetZ("self") UO.DeleteJournal() for i = mx-2 to mx+2 for j = my -2 to my+2 while not UO.Hidden() UO.Warmode("0") uo.print("Прячемся...") UO.UseSkill("Hiding") wait(4000) wend UO.Print("Копаем в координатах: "+str(mx-i)+" "+str(my-j)) while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock") and not UO.InJournal("Iron Ore") and not UO.InJournal("Copper") and not UO.InJournal("Rusty Ore") UO.DeleteJournal() if uo.waiting() then uo.canceltarget() endif UO.Waittargettile("1341", str(i), str(j), str(mz)) UO.Useobject("Shovel") repeat while not UO.InJournal("You put") and not UO.InJournal("heavy") and not UO.InJournal("location") and not UO.InJournal("no ore") and not UO.InJournal("but fail") and not UO.InJournal("far away") and not UO.InJournal("in rock") wait (500) until wend if uo.weight > 625 then ; Максимальный вес при котором домой с рудой goto end endif wend UO.DeleteJournal() next next goto na4alo end: if uo.waiting() then uo.canceltarget() endif uo.waittargetobject('runeHome') ; домой wait(500) uo.cast('Recall') wait(3000) loot() wait(3000) reccal: uo.deletejournal() if uo.waiting() then uo.canceltarget() endif uo.waittargetobject('runeCave') ; в шахту wait(500) uo.cast('Recall') mx = UO.GetX("self") my = UO.GetY("self") wait(10000) if not UO.GetX("self") <> mx and not UO.GetY("self") <> my then goto reccal endif goto na4alo end sub
sub loot() ; перекладка руды в сундук if uo.waiting() then uo.canceltarget() endif VAR a,Exit VAR UnloadCont='0x40041342' ; АЙДИ сундука для руды 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
Code: #(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 = 1000
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
until 0 endsub
sub go() maning() GoToXY(2642, 2195, 0) maning() GoToXY(2632, 2195, 0) maning() GoToXY(2626, 2201, 0) maning() endsub
|