Помошь Мининг + Ходилка!

Ask for scripts here

Moderators: Murderator+, Murderator

Post Reply
kostjan
Posts: 89
Joined: 2009-03-06 21:52:25
Contact:

Помошь Мининг + Ходилка!

Post by kostjan »

Взял 2 скрипта один на мининг другой на ходилку переделал под себя всё работает как часики но проблема в одном некак немогу придумать (зделать) пытался много раз нечего не выходит, дело в том что я хочу чтобы он копал не в 1 месте, а каждый раз ходил по разным местам допустим так: после того как он выкапывает он идёт ложет всё в сундук около дома и обратно возврашяеться на тоже место! А как мне сделать так чтобы после того как он выкопал одно место сходил сложыл всё в сундук и чтобы он шол копал на другое место перепробовал множество вариантов но нечего не получаеться... Жду помощи заранее спасибо!

Code: Select all

sub maning() 
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

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
UO.Print("Копаем в координатах: "+str(mx-i)+" "+str(my-j))
while not UO.InJournal("no ore here") and not UO.InJournal("There is nothing here to mine for") and not UO.InJournal("You cannot mine so close to yourself") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock")
UO.DeleteJournal()
if uo.waiting() then
uo.canceltarget()
endif
UO.Waittargettile("1341", str(i), str(j), str(mz))
UO.Useobject("Shovel")
while not UO.InJournal("You put") and not UO.InJournal("heavy") and not UO.InJournal("You cannot mine so close to yourself") and not UO.InJournal("location") and not UO.InJournal("There is nothing here to mine for") and not UO.InJournal("but fail") and not UO.InJournal("far away") and not UO.InJournal("in rock")
wait (500)
if uo.injournal("heavy") or uo.dead() then
sirena()                   
Pause()
endif
for jor = 0 to 9   
ser = uo.journalserial(jor)
noto = uo.getnotoriety(ser)
if noto <> 1 and noto <> 0 and not uo.injournal("elemental") then
if uo.waiting() then
uo.canceltarget()
endif
loot()
wait(3000)
endif
next   
wend
if uo.weight > 565 then  ; Максимальный вес при котором домой с рудой
goto end
endif
wend
UO.DeleteJournal()
next
next
goto na4alo
end:
if uo.waiting() then
uo.canceltarget()
endif

;бежыт домой
uo.warmode(0)
GOHOME()
wait(5000)
loot()
wait(3000)
uo.deletejournal()
if uo.waiting() then
uo.canceltarget()
endif

;бежыт В Шахту
GOSHAHTA()
mx = UO.GetX("self")
my = UO.GetY("self")
wait(5000)
if not UO.GetX("self") <> mx and not UO.GetY("self") <> my then
endif
goto na4alo
end sub

sub loot()    ; перекладка руды в сундук
if uo.waiting() then
uo.canceltarget()
endif
VAR a,Exit
VAR UnloadCont='0x40003FB5' ; АЙДИ сундука для руды 
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 sirena(); звук при появлении ПК
uo.playwav("D:\alarm.wav")
endsub

sub Pause() ; Пауза скрипта если выкопали Элема (продолжить сказав GO )
UO.DeleteJournal()
REPEAT
WAIT(3000)
UO.Print("Pause")
UNTIL UO.InJournal('GO')
UO.Print("Play")
endif
end sub

sub GOHOME()
     ; now you need to move, for example to 1234 876 exactly
     ; do it
     var stepdelay = 1000
     GoToXY(1829, 1030, 0)
     ; after this call your char stands directly at 1234 876
  endsub
 
sub GOSHAHTA()
     ; now you need to move, for example to 1234 876 exactly
     ; do it
     var stepdelay = 1000
     GoToXY(1820, 1030, 0)
      ; after this call your char stands directly at 1234 876
  endsub
 
#(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
kumatt
Posts: 4
Joined: 2009-06-22 07:54:00

Post by kumatt »

еу а как мне узнать кординаты GoToXY(1829, 1030, 0) именно эту тему
если мне например надо на 329 1513 м?
Post Reply