Yoko

All sides of Injection
It is currently 2024-03-28 22:56:58

All times are UTC+02:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: лут и мининг
PostPosted: 2009-03-18 19:22:23 
Offline
User avatar

Joined: 2008-09-26 17:06:16
Posts: 117
вот скрипт на лут но мне надо переделать чтобы он резазал а потом лутал
Code:
sub main()
uo.exec("exec Loottt")
end sub

sub Loottt()
var i,n
var luttuda='luttuda'
Dim Loot[148]
Loot[0]=0x0F0D ; gp
Loot[1]=0x0F7B ; BM
Loot[2]=0x0F7A ; BP
Loot[3]=0x0F84 ; GA
Loot[4]=0x0F85 ; GI
Loot[5]=0x0F86 ; MR
Loot[6]=0x0F88 ; NS
Loot[7]=0x0F8C ; SA
Loot[8]=0x0F8D ; SS
Loot[9]=0x0F90 ; Dead Woods
Loot[10]=0x0F7E ; Sceleton Bones
Loot[11]=0x0F87 ; Eyes of newt
Loot[12]=0x1078 ; Hides
Loot[13]=0x1BFB ; Bolts
Loot[14]=0x0E34 ; Blanc Scroll
Loot[15]=0x0F25 ; Pieces of Amber
Loot[16]=0x0F0D ; Ametist
Loot[17]=0x0F20 ; Tourmaline
Loot[18]=0x0F26 ; Diamond
Loot[19]=0x0F30 ; Diamond
Loot[20]=0x0F8E ; Serpent Scales
Loot[21]=0x14EB ; Treassure Map
Loot[22]=0x0F79 ; Blackmoor
Loot[23]=0x0F3F ; Arrow
Loot[24]=0x0F79 ; Blackmoor
Loot[25]=0x0F91 ; Wirn hart
Loot[26]=0x0F78 ; Bat
Loot[27]=0x1F03 ; ?iaa
Loot[28]=0x1515 ; ieauu
Loot[29]=0x1B76 ; ueo
Loot[30]=0x1414 ; ia??e
Loot[31]=0x1410 ; ?oee
Loot[32]=0x1415 ; aini
Loot[33]=0x1411 ; iiae
Loot[34]=0x1413 ; ai?ei
Loot[35]=0x1412 ; oeai
Loot[36]=0x0F0E ; aooueee
Loot[37]=0x0F0E ; aooueee
Loot[38]=0x0F0E ; aooueee
Loot[39]=0x0F0E ; aooueee
Loot[40]=0x0F0E ; aooueee
Loot[41]=0x1F5F ; ne?ieu
Loot[42]=0x1F5F ; ne?ieu
Loot[43]=0x1F5F ; ne?ieu
Loot[44]=0x1F5F ; ne?ieu
Loot[45]=0x0E76 ; Bag
Loot[46]=0x0E76 ; Bag
Loot[47]=0x09B0 ; Pounch
Loot[48]=0x09B0 ; Pounch
Loot[49]=0x1BDD ; Logs
Loot[50]=0x1BDD ; Logs
Loot[51]=0x1BDD ; Logs
Loot[52]=0x1BDD ; Logs
Loot[53]=0x1BDD ; Logs
Loot[54]=0x1BDD ; Logs
Loot[55]=0x1BDD ; Logs
Loot[56]=0x1BDD ; Logs
Loot[57]=0x1BDD ; Logs
Loot[58]=0x1BDD ; Logs
Loot[59]=0x1BDD ; Logs
Loot[60]=0x1BDD ; Logs
Loot[61]=0x1BDD ; Logs
Loot[62]=0x1BDD ; Logs
Loot[63]=0x1BEF ; eiae
Loot[64]=0x1BEF ; eiae
Loot[65]=0x1BEF ; eiae
Loot[66]=0x1BEF ; eiae
Loot[67]=0x1BEF ; eiae
Loot[68]=0x1BEF ; eiae
Loot[69]=0x1BEF ; eiae
Loot[70]=0x1BEF ; eiae
Loot[71]=0x19B9 ; ?oaa
Loot[72]=0x19B9 ; ?oaa
Loot[73]=0x19B9 ; ?oaa
Loot[74]=0x19B9 ; ?oaa
Loot[75]=0x19B9 ; ?oaa
Loot[76]=0x19B9 ; ?oaa
Loot[77]=0x19B9 ; ?oaa
Loot[78]=0x1F03 ; ?iaa
Loot[79]=0x1515 ; ieauu
Loot[80]=0x1B76 ; ueo
Loot[81]=0x1414 ; ia??e
Loot[82]=0x1410 ; ?oee
Loot[83]=0x1415 ; aini
Loot[84]=0x1411 ; iiae
Loot[85]=0x1413 ; ai?ei
Loot[86]=0x1412 ; oeai
Loot[87]=0x1F03 ; ?iaa
Loot[88]=0x1515 ; ieauu
Loot[89]=0x1B76 ; ueo
Loot[90]=0x1414 ; ia??e
Loot[91]=0x1410 ; ?oee
Loot[92]=0x1415 ; aini
Loot[93]=0x1411 ; iiae
Loot[94]=0x1413 ; ai?ei
Loot[95]=0x1412 ; oeai
Loot[96]=0x1F03 ; ?iaa
Loot[97]=0x1515 ; ieauu
Loot[98]=0x1B76 ; ueo
Loot[99]=0x1414 ; ia??e
Loot[100]=0x1410 ; ?oee
Loot[101]=0x1415 ; aini
Loot[102]=0x1411 ; iiae
Loot[103]=0x1413 ; ai?ei
Loot[104]=0x1412 ; oeai
Loot[105]=0x0E21 ; aeiou
Loot[106]=0x13B9 ; aeeeia
Loot[107]=0x1406 ; iaena
Loot[108]=0x13B1 ; eoe
Loot[109]=0x0F4F ; a?aaeao
Loot[110]=0x13FC ; oy?aeue a?a
Loot[111]=0x13FE ; eaoaia
Loot[112]=0x143E ; aeaaa
Loot[113]=0x143E ; ?oia
Loot[114]=0x0F4C ; aaieiie oiii?
Loot[115]=0x1B7A ; oeo aa?aai
Loot[116]=0x1541 ; iiaycea
Loot[117]=0x0E21 ; aeiou
Loot[118]=0x13B9 ; aeeeia
Loot[119]=0x1406 ; iaena
Loot[120]=0x13B1 ; eoe
Loot[121]=0x0F4F ; a?aaeao
Loot[122]=0x13FC ; oy?aeue a?a
Loot[123]=0x13FE ; eaoaia
Loot[124]=0x143E ; aeaaa
Loot[125]=0x1F14 ; ?oia
Loot[126]=0x0F4C ; aaieiie oiii?
Loot[127]=0x1B7A ; oeo aa?aai
Loot[128]=0x1541 ; iiaycea
Loot[129]=0x0E21 ; aeiou
Loot[130]=0x13B9 ; aeeeia
Loot[131]=0x1406 ; iaena
Loot[132]=0x13B1 ; eoe
Loot[133]=0x0F4F ; a?aaeao
Loot[134]=0x13FC ; oy?aeue a?a
Loot[135]=0x13FE ; eaoaia
Loot[136]=0x143E ; aeaaa
Loot[137]=0x1F14 ; ?oia
Loot[138]=0x0F4C ; aaieiie oiii?
Loot[139]=0x1B7A ; oeo aa?aai
Loot[140]=0x0847 ; amul
Loot[141]=0x0E20 ; aeiou (e?iaaau&#229
Loot[142]=0x0E20 ; aeiou (e?iaaau&#229
Loot[143]=0x0EED ; gp
Loot[144]=0x1086 ; Bracelet of Mana Regeneration
Loot[145]=0x0F03 ; Antifreeze
Loot[146]=0x1F52 ; Paralyze Scroll
Loot[147]=0x0E87 ; Pitchork
Loot[148]=0x0E87 ; Hammer
i = 700
UO.SetReceivingContainer(luttuda)
FOR n=1 TO 148
uo.findtype(Loot[n],"-1","lastcontainer")
if uo.findcount() > 0 then
UO.grab(0, "finditem")
uo.print("Found "+str(uo.findcount()))
Wait(i)
END if
next
UO.UnSetReceivingContainer()
end sub

sub Heal()       ;Хилинг
   If UO.STR==UO.Life Then
      UO.Print("Life is full")
   Else
      UO.SetArm("1")
      UO.BandageSelf()
      wait(1000)
      UO.Arm("1")
      UO.UnSetArm()
   Endif
end sub


а вот и срипт на мининг тут он работает но через некаторое время крэшит клиент
Code:
################################################################
### Переменные #################################################
################################################################
###
### Для начала подготовится, положить в банк мешок(bag) и такой же в MageChest
### В мешки положить реги рекола Black Pearl, Mandrake Root, Blood Moss
### Самое главное выяснить Серийник банка!!!
### В банк положить руны к дому(одного типа!!! Тип рун в банке и в MageChest должны совпадать!!!)
### Положить в MageChest Руны в шахту(одного типа)
###
################################################################
################################################################
################################################################

var kirka, a, name, run, MageChest
var myXX, myYY, p
p=0

### ID друзей для игнора при поиске ПК и Криминал
var Charon='0x00324C05'
var Buiok='0x000C430F'
var friend3='0x001EEB63'

var x, y, coord
var MCave='2558,501-2578,476'      ; диапозон координат пещеры
var BankBrit='1446,1702-1421,1671'   ; диапозон координат Банка в Брите
var Home='1829,786-1843,800'      ; диапозон координат Дома

var kalitka='0x0847'       ; Тип закрытой калитки
var door='0x06A5'      ; тип закрытой двери в дом

var OreBox, bag, bankbox, rune, CraftChest
var bagreg, chest
bag='0x0E76'         ;тип мешка с регами
bankbox='0x40355E29'      ;Id банка (для того, что бы узнать ID банка, командой ",info" -
            ;- на любой предмет и скопировать из полученной информации -
            ;- значение C= -> 0x40156896 <-
 
rune='0x1F14'         ; Тип руны может быть 2-х типов
            ; '0x1F14' и '0x1F15'

CraftChest='0x402C32D2'      ; Сундук Крафта с паками под руду и инготы

MageChest='0x402B6E6A'      ; Сундуг Мага с паками и мешком-с-регами для Рекола

kirka = "0x0E85"       ;Тип кирки. 2 вида может "0x0E85" и "0x0E86"

OreBox = "0x4050B366"      ;Контейнер для руды

var text1, text2

text1="There is no ore|You have no line|That is to far away|You can't think|You have no line of|too far away|mining in rock."

text2="You put the|You loosen some|You can't think|That is to far away|There is no ore|You have no line of|too far away|mining in rock."

run=118            ; Код клавиши с биндом "AlwesRun"

################################################################
###Функция Main ##########################################
################################################################
sub main()
  uo.exec("exec ressurect")
  uo.exec("exec FindMan")
  uo.exec("exec mine")
end sub

sub r()
var r=uo.getrun('self')
uo.print(str(r))
end sub

################################################################
### Функция mine ############################################
################################################################
sub mine()      ; Kopania
  uo.ignorereset()
  walker(2578,480,1)
  var pause=0
  myXX=uo.getX(); zapominaet mesto otkuda nacel kopati
  myYY=uo.getY();
  var PX, PY, PZ, IX, IY
  PX = UO.GetX()
  PY = UO.GetY()
  PZ = UO.GetZ()
  while UO.Weight<=uo.str*4
    For Iy=-4 to 4
      For Ix=-4 to 4
        uo.deletejournal()
        while not UO.InJournal(text1) && uo.weight<=uo.str*4
          if p==1 then
            if not uo.hidden() then
              InJournal('You have hidden',60)
            endif
          endif
          UO.WaitTargetTile(-1,Str(PX+Ix),Str(PY+Iy),Str(PZ))
          uo.usetype(kirka)
          InJournal(text2,0)
          if uo.injournal('You loosen some') then
            pause=pause+1
            if pause>4 then
              wait(10000)
              pause=0
            endif
          else
            pause=0
          endif
        endif
        wait(200)
      wend
    next
    wait(200)
  next
  wait(200)
wend
uo.exec('exec GoBrit')
end sub
################################################################
### Функция FindMan ########################################
################################################################
Sub FindMan()
uo.set('finddistance','20')
var serial, a, b
b=4
uo.ignorereset()
uo.ignore('self')
repeat
    if UO.InJournal("You have been revealed|You can't seem") then
      p=1
      DelTextInJournal("You have been revealed|You can't seem")
      uo.showjournal(20)
    endif
  if p==1 then
     p=0
      if not uo.hidden() then
        uo.warmode(0)
        uo.useskill("Hiding")
      endif
  else
    uo.findman(b)
    wait(500)
    if uo.findcount()>0 || uo.injournal('attacking you') then
      uo.print('ATAC')
      uo.print(uo.getname('finditem')+' '+str(uo.getdistance('finditem')))
      uo.forget('finditem')
      uo.exec('terminate all; exec GoBrit')
    endif
    wait(100)
  endif
  if b==4 then
    b=6
   else
    b=4
  endif
until uo.dead()
end sub

################################################################
### Функция GoBrit ############################################
################################################################
Sub GoBrit()
uo.exec('terminate mine')
uo.ignorereset()
uo.press(run)
wait(50)
uo.press(35)
 if uo.getrun()==0 then
  uo.press(run)
 endif
walker(2581,480,0)
wait(50)
uo.press(35)
wait(50)
uo.press(35)
wait(50)
uo.press(run)
uo.press(35)
wait(50)
 if uo.getrun()==1 then
  uo.press(run)
 endif
walker(1433,1693,1)
wait(5000)
coord=GetXY('self')
if ComXY(BankBrit,coord)==true then
uo.exec('terminate FindMan; exec GoHome')
else
GoBrit()
endif
end sub

sub GoHome()
OpenChest()
wait(1000)
GotoHomeT()
move()
wait(5000)
OpenChest()
wait(2000)
uo.exec('terminate all; exec main')
end sub

################################################################
### Функция OpenChest #########################################
################################################################
sub OpenChest()
uo.findtype('0x0E42',-1,'ground')
if uo.findcount()>0 then
  uo.useobject(MageChest)
  chest=MageChest
else
  uo.sayu(' bank ')
  chest=bankbox
endif
wait(1000)
CheckLag()
uo.findtype(bag,-1,chest)
bagreg=uo.getserial('finditem')
uo.useobject(bagreg)
wait(1000)
CheckLag()
FindRune(chest)
end sub

################################################################
### Функция FindRune ##########################################
################################################################
sub FindRune(b)
var idrune
uo.findtype(rune,-1,b)
idrune=uo.getserial('finditem')
Cast(idrune)
end sub

################################################################
### Функция Cast(rune) ############################################
################################################################
Sub Cast(rune)
var a
coord=GetXY('self')
if ComXY(Home,coord)==true then
  a=true
 else
  a=false
endif
MoveReg(bagreg)
var mana
if uo.bm>0 && uo.bp>0 && uo.mr>0 then
cast:
  if uo.mana < 20 then
    med()
    wait(2000)
    goto cast
  endif
    mana = uo.mana
    uo.cast('Recall',rune)
    DelTextInJournal("fizzle")
    while mana <= uo.mana
      wait(200)
    wend
    if ComXY(MCave,coord)==false then
     if ComXY(Home,coord)==a then
     wait(1000)
     CheckLag()
     if uo.injournal("fizzle") then
      MoveReg(bagreg)
      goto cast
     endif
      wait(200)
     endif
    endif
else
  uo.print('Stop')
  uo.closeuo()
endif
wait(1000)
end sub

################################################################
### Функция Move reg ##########################################
################################################################
sub MoveReg(id)
   uo.print('Move Reagents')
   var a
   dim reg[3]
      reg[0] = "0x0F7A"   ;Black Pearls
      reg[1] = "0x0F7B"   ;Blood Moss
      reg[2] = "0x0F86"   ;Mandrake Roots
   for a=0 to 2
      if uo.count(reg[a])<1 then
         uo.findtype(reg[a],-1,id)
         uo.moveitem('finditem',2,'backpack')
         wait(700)
         CheckLag()
      endif
   next
endsub

################################################################
### Функция-массив Регов ######################################
################################################################
Sub mreg(reg)
reg[0] = "0x0F7A"       ;Black Pearls
reg[1] = "0x0F7B"       ;Blood Moss
reg[2] = "0x0F86"       ;Mandrake Roots
return reg
end sub

################################################################
### Функция meditation #######################################
################################################################
sub med()
uo.print('Meditation')
while uo.mana < uo.int
  UO.UseSkill("Meditation")
  injournal("You are at peace|You lose your concentration",60)
wend
end sub

################################################################
### Функция Goto Home #########################################
################################################################
sub GotoHomeT()
  uo.set('finddistance',4)
  uo.print('Go to Home')
  if type(kalitka)==true then
    uo.press(121)
    CheckLag()
  else
    wait(200)
  endif
 walker(1831,797,0)
  uo.press(121)
  CheckLag()
  if type(kalitka)==false then
 walker(1831,798,0)
    uo.press(121)
    CheckLag()
  endif
  wait(200)
 walker(1836,798,0)
  if type(door)==true then
    uo.press(121)
    CheckLag()
  else
    wait(200)
  endif
 walker(1836,794,0)
  uo.press(121)
  CheckLag()
  wait(500)
  if type(door)==false then
    uo.press(121)
    CheckLag()
  else
    wait(200)
  endif
  CheckLag()
end sub

Sub type(tip)
uo.findtype(tip,-1,'ground')
if uo.findcount()>0 then
  return true
else
  return false
endif
end sub

################################################################
### Функция MoveOre ##########################################
################################################################
sub move()
uo.useobject(CraftChest)
CheckLag()
uo.print('MOVEORE()')
wait(2000)
var e
dim a[4]
a[0] = 0x19B7
a[1] = 0x19BA
a[2] = 0x19B8
a[3] = 0x19B9
uo.useobject(OreBox)
CheckLag()
for e = 0 to 3
  repeat
    uo.findtype(a[e],-1,'backpack')
    uo.moveitem('finditem',0,OreBox)
    wait(900)
    CheckLag()
  until uo.findcount()==0
next
wait(1000)
MoveHi()
end sub

Sub MoveHi()
var Chest, OreBox, HiOreBox
Chest='0x402C32D2'
OreBox = "0x4050B366"   ;Контейнер для руды
HiOreBox = "0x4050B362"   ;Контейнер для "выхи"
var e, c

dim a[4],x[19]
a[0] = 0x19B9      ;4 and more ore
a[1] = 0x19B7      ;1 ore
a[2] = 0x19BA      ;2 ore
a[3] = 0x19B8      ;3 ore

x[0] = '0x09B9'      ;Acid ore
x[1] = '0x09A4'      ;Cristaline ore
x[2] = '0x0085'      ;Dragon ore
x[3] = '0x09D3'      ;Steel ore
x[4] = '0x09E6'      ;Elvin ore
x[5] = '0x09F0'      ;Gorgan ore
x[6] = '0x008F'      ;Send rock ore
x[7] = '0x04C2'      ;Blood rock ore
x[8] = '0x09DA'      ;Vulcan ore
x[9] = '0x0028'      ;Obsidian ore
x[10] = '0x08AF'   ;Plutonium ore
x[11] = '0x09EC'   ;Blood crest ore
x[12] = '0x0455'   ;Black rock ore
x[13] = '0x010F'   ;Krynite ore
x[14] = '0x0BA7'   ;Eldar ore
x[15] = '0x00CE'   ;Valorite ore
x[16] = '0x052D'   ;Mitheril ore
x[17] = '0x07D5'   ;Verite ore
x[18] = '0x0060'   ;Aqua ore
uo.useobject(HiOreBox)
wait(700)
CheckLag()
for e=0 to 3
  for c=0 to 18
    repeat
        uo.findtype(a[e],x[c],OreBox)
      if uo.findcount()>0 then
        uo.moveitem('finditem',0,HiOreBox)
        CheckLag()
        wait(400)
      endif
      wait(100)
    until uo.findcount()==0
  next
next
end sub

sub ressurect()
repeat
  ; ©dark_kynep
  if UO.Life < 1 then
    uo.useobject('self')
    CheckLag()
    uo.warmode(0)
    UO.LClick(974,57)
    CheckLag()
    wait(1000)
    UO.LClick(267,308)
    CheckLag()
    wait(1000)
    UO.LClick(179,201)
    CheckLag()
    wait(1000)
    walker(2468,531,1)
    uo.useobject('0x4001D120')
    CheckLag()
    walker(2466,542,0)
    CheckLag()
    walker(2506,542,0)
    Alive()
  else
    wait(1000)
    ; UO.Print("You are Alive!!!")
  endif
until uo.dead()
end sub

Sub Alive()
OpenChest()
GotoHomeT()
Heal()
OpenChest()
uo.exec('terminate all; exec main')
end sub

sub Heal()
uo.useobject('0x4023D30F')
CheckLag()
wait(500)
uo.findtype('0x0E21',-1,'0x4023D30F')
uo.moveitem('finditem',10,'backpack',10,10,0)
CheckLag()
wait(500)
repeat
  uo.bandageself()
  wait(5000)
until uo.life==uo.str
wait(500)
uo.useobject(CraftChest)
CheckLag()
wait(500)
uo.findtype(kirka,-1,CraftChest)
uo.moveitem('finditem',1,'backpack',100,10,0)
CheckLag()
wait(500)
end sub

################################################################
### Функция паузы по проверке журнала или таймера ########
################################################################
Sub InJournal(t,time)
;uo.print('EXEC INJOURNAL(T,TIME)')
var timer=uo.timer()
DelTextInJournal(t)
if time==0 then
  ;uo.print('TIME==0')
  while not uo.InJournal(t)
    wait(200)
  wend
else
  ;uo.print('TIME<>0')
  while not uo.InJournal(t) && uo.timer()<timer+time
    wait(200)
  wend
endif
end sub

################################################################
### Функция удаления из журнала Текста ########################
################################################################
Sub DelTextInJournal(msg) ; msg это параметр, см. выше как его передают
var nom=UO.InJournal(msg) ; ищем сообщение и в переменную его
if nom>0 then
  UO.SetJournalLine(Nom - 1," ") ; подменим сообщение
  DelTextInJournal(msg) ; вызов функцией самой себя, рекурсия
endif
end sub

################################################################
### Функция отклик сервера ###############################
################################################################
Sub CheckLag()
DelTextInJournal("backpack") ; вытрим ТОЛЬКО нужные нам сообщения в журнале
UO.Click('backpack') ; одиночный клик по вашему backpack
InJournal("backpack",0)
end sub

################################################################
### Функция World save now ####################################
################################################################
Sub ws()
if uo.injournal("World is saving now...") then
  InJournal("World data saving",1800)
endif
end sub


########################################## ХОДИЛКА 3 ##########################
#var Prec=3 # Как близко следует подойти к цели (Precision)
#var MaxTraceDistance=15 # Максимальная длина обхода. Желательно ставить с расчета возможных препятсвий. Если ставить очень #большие числа, кодилка может пойти в обход пол мира чтобы дойти к соседнему дереву.
#var Speed=2 # Длина шага. Сколько шагов делать за раз. Выше 3 ставить смысла нет. Тоесть тупое умножение шагов. Для ламбера #идеально 3, для майнинга - 1.
#var StepTimeOut=400 # Если уперлись в неопознанный обьект, сколько мсек ждать сдвига с места. Если по простому - таймаут #шага. Если поставить сильно маленькие, ходилка начнет трассировать пустые места.
#UO.SetGlobal("Logging","1")  # - показывать отладочные сообщения.
#UO.SetGlobal("BlindWalk","0") # - не использовать проверку тайлов, а использовать ходьбу наощупь. Для майнинга ОБЯЗАТЕЛЬНО #ВКЛЮЧИТЬ.
#В функции IsPass, содержиться список проходимых тайлов.

#Walker(X,Y,Prec) - идем к цели с координатами X,Y. Возвращает 1 в случае успешного достижения цели, и 0 - при невозможном обходе (путь не найден)
#Tracer(StartDir,Direction) - трассировка 1 шага. Возвращает направление по которому получилось сдвинуться с места. StartDir #- направление последнего движения, Direction (-1 или +1) направление обхода. -1 - по часовой стрелке, +1 против часовой #стрелки. Направления скрипт использует личного формата:
#1 - влево вниз
#2 - вниз
#3 - вправо вниз
#4 - вправо
#5 - вправо вверх
#6 - вверх
#7 - влево вверх
#8 - влево
#Tracer(StartDir,Direction) - идеально подходит для рыбалки вдоль берега так как она будет обходить берег бесконечно (1 #запуск функции = 1 шаг обхода).
#####################################################
# WW  W  WW   AA    LL     Kk KK  EE  EE  RRR       #
# WW  W  WW  AA A   LL     Kk K   EEE     R  R      #
# WW  W  WW  AA A   LL     KKK    EEEEE   R R       #
# WW WW  WW  AAAA   LL     KKK    EEE     RRR       #
#  WWW WWW  AA   A   LLLL  KK Kk  EE  EE  R  RR     #
####################################################
var MaxTraceDistance=10
var TraceLoopIncrease=5 #Увеличение MaxTraceDistance при исчерпании количества ходов
var LimitTrace=20 #Сколько шагов в ОБЕ стороны от начальной точки обхода прекращают ходилку (выхода нет).
var Speed=1
var StepTimeOut=600 #Таймаут шага. Устанавливать не в размер пинга, а в размер шага + размер пинга.
# Для ходьбы - 500+Ping
# Для бега/ходьбы на лошади - 300+Ping
# Бег на лошади - 150 + Ping

var CheckCnt=2 #Количество слепых проверок. УВЕЛИЧИВАЕТ В СТОЛЬКО РАЗ ТАЙМАУТ. Использовать только на БЫСТРОМ но НЕСТАБИЛЬНОМ коннекте. При большом пинге будет УЖАС.
var DynamicPause=30 #Минимальные паузы в циклах. Чем меньше число - тем меньше рывков и тем больше нагрузка процессора.

Sub Walker(GoX,GoY,Prec)
uo.warmode(0)
UO.SetGlobal("Logging","0")
UO.SetGlobal("BlindWalk","0")
var LastDir
var MoveRes
var TracerCnt
UO.SetGlobal("GlobalGoX",str(GoX))
UO.SetGlobal("GlobalGoY",str(GoY))
while not IsEnd(GoX,GoY,Prec)
  TracerCnt = MaxTraceDistance
  repeat
    LogInfo('Just walking')
    LastDir=GoUntilHit(GoX,GoY,Prec)
   
    if IsEnd(GoX,GoY,Prec) then
      return 1
    end if
   
    LogInfo('Tracing')
    MoveRes = FullAroundTrace(LastDir,GoX,GoY,Prec,TracerCnt)
    if TracerCnt > LimitTrace then
      return 0
    endif
    TracerCnt = TracerCnt + TraceLoopIncrease
  until MoveRes == 1
wend
return 1
end sub

Sub FullAroundTrace(StartDir,GoX,GoY,Prec,MaxTrace)
var LineX=UO.GetX()
var LineY=UO.GetY()
var CurDir=StartDir
var Direction=CountDirection(GoX,GoY,CurDir,Prec)
var StartX,StartY
var MovesDone=0
repeat
  StartX=UO.GetX()
  StartY=UO.GetY()
  CurDir=Tracer(CurDir,Direction,Prec)
  if (CurDir==GetDir(GoX,GoY,Prec)) then
    return 1
  endif
  if MovesDone>0 and PrevMoveCross(GetDirToDir(UO.GetDir(),Prec),LineX,LineY,GoX,GoY,StartX,StartY,Prec) then
    return 1
  end if
  MovesDone=MovesDone+1
  CurDir=AddToDir(CurDir,-Direction,Prec)
until MovesDone>MaxTrace
return 0
end sub

Sub CountDirection(GoX,GoY,StartDir,Prec)
var GoDir=GetDir(GoX,GoY,Prec)
var MyX=UO.GetX()
var MyY=UO.GetY()
if GoDir<StartDir then
  return -1
end if
if GoDir>StartDir then
  return 1
end if
if Abs(MyX-GoX)>Abs(MyY-GoY) then
  if (GoDir==3 and GoY>MyY) OR (GoDir==7 and GoY<MyY) then
    return -1
  else
    return 1
  end if
else
  if (GoDir==1 and GoX<MyX) or (GoDir==5 and GoX>MyX) then
    return -1
  else
    return 1
  end if
end if
end sub

Sub PrevMoveCross(Dir,x1,y1,x2,y2,StartX,StartY,Prec)
var x3,y3,x4,y4
x3=StartX
y3=StartY
x4=StartX+(XFromDir(Dir)-StartX)*Speed
y4=StartY+(YFromDir(Dir)-StartY)*Speed
return LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec)
end sub

Sub LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec)
if x1==x3 and y1==y3 then
  return false
end if
var z1=(x3-x1)*(y2-y1)-(y3-y1)*(x2-x1)
var z2=(x4-x1)*(y2-y1)-(y4-y1)*(x2-x1)
if z1*z2>0 then
  return false
else
  LogInfo('Vector info:')
  LogInfo('x1= '+str(x1))
  LogInfo('y1= '+str(y1))
  LogInfo('x2= '+str(x2))
  LogInfo('y2= '+str(y2))
  LogInfo('x3= '+str(x3))
  LogInfo('y3= '+str(y3))
  LogInfo('x4= '+str(x4))
  LogInfo('y4= '+str(y4))
  return true
end if
end sub

Sub IsDiap(X,X0,X1,Prec)
if X<=X0+Prec and X>=X1-Prec OR X>=X0-Prec and X<=X1+Prec then
  return true
end if
return false
end sub

Sub GoUntilHit(GoX,GoY,Prec)
var LastDir
LastDir=GetDir(GoX,GoY,Prec)
var CouldMove
repeat
  LastDir=GetDir(GoX,GoY,Prec)
  if LastDir<>0 and not IsEnd(GoX,GoY,Prec) then
    CouldMove=TryDir(LastDir,Prec)
  end if
until LastDir==0 or IsEnd(GoX,GoY,Prec) or not CouldMove
return LastDir
end sub

Sub IsEnd(GoX,GoY,Prec)
if Abs(UO.GetX()-GoX)<=Prec and Abs(UO.GetY()-GoY)<=Prec then
  LogInfo('END FOUND')
  return true
else
  return false
end if
end sub

Sub GetDir(GoX,GoY,Prec)
var MyX=UO.GetX()
var MyY=UO.GetY()
var DiffX=Abs(UO.GetX()-GoX)
var DiffY=Abs(UO.GetY()-GoY)
var GoDir=0
if (DiffX/(DiffY+0.1))>=2 then
  if (MyX>GoX) then
    GoDir=7
  else
    GoDir=3
  end if
else
 
  if (DiffY/(DiffX+0.1))>=2 then
    if (MyY>GoY) then
      GoDir=5
    else
      GoDir=1
    end if
  else
   
    if (MyX>GoX) and (MyY>GoY) then
      GoDir=6
    else
      if (MyX>GoX) and (MyY<GoY) then
        GoDir=8
      else
        if (MyX<GoX) and (MyY>GoY) then
          GoDir=4
        else
          if (MyX<GoX) and (MyY<GoY) then
            GoDir=2
          end if
        end if
      end if
    end if
  end if
end if
return GoDir
end sub

Sub Tracer(StartDir,Direction,Prec)
var CurDir=StartDir
var Result
repeat
  Result=TryDir(CurDir,Prec)
  if not Result then
    CurDir=AddToDir(CurDir,Direction,Prec)
  end if
until Result
return Result
end sub

Sub AddToDir(Dir,Cnt,Prec)
var NewDir=Dir
NewDir=NewDir+Cnt
while NewDir>8
  NewDir=NewDir-8
wend
while NewDir<1
  NewDir=NewDir+8
wend
return NewDir
end sub

Sub TryDir(Dir,Prec)
var BegX=UO.GetX() # Ia?aeuiia O
var BegY=UO.GetY() # Ia?aeuiia Y
var Counter=0
var GoX=BegX
var GoY=BegY
GoX=XFromDir(Dir)
GoY=YFromDir(Dir)
if not IsPass(GoX,GoY) then
  LogInfo(str(GoX)+':'+str(GoY)+' is not passable')
  return false
end if
return TurnAndGoDir(Dir,Prec)
end sub

Sub XFromDir(Dir)
if Dir==2 OR Dir==3 Or Dir==4 then
  return (UO.GetX()+1)
end if
if Dir==6 OR Dir==7 Or Dir==8 then
  return (UO.GetX()-1)
end if
return (UO.GetX())
end sub

Sub YFromDir(Dir)
if Dir==8 OR Dir==1 Or Dir==2 then
  return (UO.GetY()+1)
end if
if Dir==4 OR Dir==5 Or Dir==6 then
  return (UO.GetY()-1)
end if
return (UO.GetY())
end sub

Sub TurnAndGoDir(Dir,Prec)
var StartDir=GetDirToDir(UO.GetDir(),Prec)
var StartX=UO.GetX()
var StartY=UO.GetY()
var EndDir
var Counter=0
var TestCounter=CheckCnt

#Direction Test
repeat
  Counter = 0
  LogInfo('Dir: '+str(StartDir)+' Counter: '+str(Counter))
  PressDir(Dir)
  repeat
    EndDir=GetDirToDir(UO.GetDir(),Prec)
    wait(DynamicPause)
    Counter=Counter+1
  until StartDir<>EndDir or StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause
  TestCounter = TestCounter - 1
  LogInfo('Dir: '+str(EndDir)+' Counter: '+str(Counter))
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause

if Counter>=StepTimeOut/DynamicPause  then
  LogInfo('Direction timeout reached')
  return 0
end if
#End direction Test

if StartY<>UO.GetY() or StartX<>UO.GetX() then
  return Dir
end if

#Start Primary test
TestCounter=CheckCnt
repeat
  GoDir(Dir,Prec)
  Counter=0
  repeat
    wait(DynamicPause)
    Counter=Counter+1
  until StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause
  TestCounter = TestCounter - 1
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause
#End primary test

if Counter>=StepTimeOut/DynamicPause then
  LogInfo('Step timeout reached')
  return 0
else
  return Dir
end if
end sub

Sub GetDirToDir(GotDir,Prec)
var ChangedDir=-GotDir
ChangedDir=AddToDir(ChangedDir,5,Prec)
return ChangedDir
end sub

Sub DirToInj(Dir)
dim Dirs[9]
Dirs[1]=1
Dirs[2]=2
Dirs[3]=3
Dirs[4]=6
Dirs[5]=9
Dirs[6]=8
Dirs[7]=7
Dirs[8]=4

return (Dirs[Dir])
end sub

Sub PressDir(Dir)
dim Dirs[9]
Dirs[1]=35
Dirs[2]=40
Dirs[3]=34
Dirs[4]=39
Dirs[5]=33
Dirs[6]=38
Dirs[7]=36
Dirs[8]=37

UO.Press(Dirs[Dir],1)
end sub

Sub GoDir(Dir,Prec)
dim Dirs[9]
Dirs[1]=35
Dirs[2]=40
Dirs[3]=34
Dirs[4]=39
Dirs[5]=33
Dirs[6]=38
Dirs[7]=36
Dirs[8]=37

var DistanceX=Abs(UO.GetX()-val(UO.GetGlobal("GlobalGoX")))
var DistanceY=Abs(UO.GetY()-val(UO.GetGlobal("GlobalGoY")))
var GoDistance
if (DistanceX-Prec)<Speed then
  GoDistance=DistanceX-Prec
else
  if (DistanceY-Prec)<Speed then
    GoDistance=DistanceY-Prec
  else
    GoDistance=Speed
  endif
endif

UO.Press(Dirs[Dir],GoDistance)
end sub

Sub IsPass(X,Y)
if UO.GetGlobal("BlindWalk") then
  return true
endif

dim Types[60]
Types[1]=3
Types[2]=25
Types[3]=51
Types[4]=63
Types[5]=113
Types[6]=140
Types[7]=172
Types[8]=219
Types[9]=232
Types[10]=235
Types[11]=239
Types[12]=243
Types[13]=248
Types[14]=251
Types[15]=264
Types[16]=267
Types[17]=282
Types[18]=289
Types[19]=321
Types[20]=379
Types[21]=420
Types[22]=440
Types[23]=476
Types[24]=499
Types[25]=513
Types[26]=542
Types[27]=578
Types[28]=586
Types[29]=622
Types[30]=700
Types[31]=804
Types[32]=1740
Types[33]=1758
Types[34]=1770
Types[35]=1779
Types[36]=1779
Types[37]=1881
Types[38]=1886
Types[39]=1801
Types[40]=1805
Types[41]=1813
Types[42]=1820
Types[43]=1831
Types[44]=1833
Types[45]=1843
Types[46]=1850
Types[47]=1873
Types[48]=1876
Types[49]=1885
Types[50]=1888
Types[51]=1946
Types[52]=1969
Types[53]=2500
Types[54]=2539

for var i=1 TO 53 STEP 2
  if UO.PrivateGetTile(X,Y,-1,Types[i],Types[i+1]) then
    return true
  end if
next
return false
end sub

Sub LogInfo(Line)
if not UO.GetGlobal("Logging")=="0" then
  UO.TextOpen()
  UO.TextPrint(str(UO.GetX())+":"+str(UO.GetY())+" - "+Line);
end if
end sub

Sub Abs(X)
if X>0 then
  return X
else
  return (-X)
end if
end sub
##########################################

Sub GetXY(man)
var xy
x=uo.getx(man)
y=uo.gety(man)
xy=str(x)+','+str(y)
return xy
end sub

Sub ComXY(coordinate,coord)
var myx, myy, x1, y1, L, pref, minx, maxx, miny, maxy
L=len(coordinate)
;uo.print('Длина строки = '+str(L))
;wait(100)
 x1=XY(coordinate,'-',0)
;uo.print('Координаты а: '+x1)
;wait(100)
 y1=XY(coordinate,'-',1)
;uo.print('Координаты б: '+y1)
;wait(100)
 minx=XY(x1,',',0)
;uo.print('Координата minx: '+minx)
;wait(100)
 miny=XY(x1,',',1)
uo.print('Координата miny: '+miny)
wait(100)
 maxx=XY(y1,',',0)
;uo.print('Координата maxx: '+maxx)
;wait(100)
 maxy=XY(y1,',',1)
;uo.print('Координата maxy: '+maxy)
;wait(100)
 myx=XY(coord,',',0)
;uo.print('Координата myx: '+myx)
;wait(1000)
 myy=XY(coord,',',1)
;uo.print('Координата myy: '+myy)
 if minx>maxx then
   x=minx
;uo.print('X1=MinX='+x1)
;wait(100)
   minx=maxx
;uo.print('MinX=MaxX='+minx)
;wait(100)
   maxx=x
;uo.print('maxx=x1='+minx)
;wait(100)
 endif
 if miny>maxy then
   y=miny
;uo.print('Y1=MinY='+y)
;wait(100)
   miny=maxy
;uo.print('MinY=MaxY='+miny)
;wait(100)
   maxy=y
;uo.print('maxy=y1='+maxy)
;wait(100)
 endif
; wait(100)
 if myx>minx && myx<maxx && myy>miny && myy<maxy then
   return true
  else
   return false
 endif
end sub

Sub XY(con,d,c)
var pref, L, z
 L=len(con)
 for pref=0 to L
  if con[pref]==d then
   if c==0 then
     z=left(con,pref)
   endif
   wait(50)
   if c==1 then
     z=right(con,L-pref-1)
   endif
  endif
 next
return z
end sub


Top
   
PostPosted: 2009-03-22 00:17:19 
Offline
User avatar

Joined: 2008-09-26 17:06:16
Posts: 117
vertijok wrote:
вот скрипт на лут но мне надо переделать чтобы он резазал а потом лутал
Code:
sub main()
uo.exec("exec Loottt")
end sub

sub Loottt()
var i,n
var luttuda='luttuda'
Dim Loot[148]
Loot[0]=0x0F0D ; gp
Loot[1]=0x0F7B ; BM
Loot[2]=0x0F7A ; BP
Loot[3]=0x0F84 ; GA
Loot[4]=0x0F85 ; GI
Loot[5]=0x0F86 ; MR
Loot[6]=0x0F88 ; NS
Loot[7]=0x0F8C ; SA
Loot[8]=0x0F8D ; SS
Loot[9]=0x0F90 ; Dead Woods
Loot[10]=0x0F7E ; Sceleton Bones
Loot[11]=0x0F87 ; Eyes of newt
Loot[12]=0x1078 ; Hides
Loot[13]=0x1BFB ; Bolts
Loot[14]=0x0E34 ; Blanc Scroll
Loot[15]=0x0F25 ; Pieces of Amber
Loot[16]=0x0F0D ; Ametist
Loot[17]=0x0F20 ; Tourmaline
Loot[18]=0x0F26 ; Diamond
Loot[19]=0x0F30 ; Diamond
Loot[20]=0x0F8E ; Serpent Scales
Loot[21]=0x14EB ; Treassure Map
Loot[22]=0x0F79 ; Blackmoor
Loot[23]=0x0F3F ; Arrow
Loot[24]=0x0F79 ; Blackmoor
Loot[25]=0x0F91 ; Wirn hart
Loot[26]=0x0F78 ; Bat
Loot[27]=0x1F03 ; ?iaa
Loot[28]=0x1515 ; ieauu
Loot[29]=0x1B76 ; ueo
Loot[30]=0x1414 ; ia??e
Loot[31]=0x1410 ; ?oee
Loot[32]=0x1415 ; aini
Loot[33]=0x1411 ; iiae
Loot[34]=0x1413 ; ai?ei
Loot[35]=0x1412 ; oeai
Loot[36]=0x0F0E ; aooueee
Loot[37]=0x0F0E ; aooueee
Loot[38]=0x0F0E ; aooueee
Loot[39]=0x0F0E ; aooueee
Loot[40]=0x0F0E ; aooueee
Loot[41]=0x1F5F ; ne?ieu
Loot[42]=0x1F5F ; ne?ieu
Loot[43]=0x1F5F ; ne?ieu
Loot[44]=0x1F5F ; ne?ieu
Loot[45]=0x0E76 ; Bag
Loot[46]=0x0E76 ; Bag
Loot[47]=0x09B0 ; Pounch
Loot[48]=0x09B0 ; Pounch
Loot[49]=0x1BDD ; Logs
Loot[50]=0x1BDD ; Logs
Loot[51]=0x1BDD ; Logs
Loot[52]=0x1BDD ; Logs
Loot[53]=0x1BDD ; Logs
Loot[54]=0x1BDD ; Logs
Loot[55]=0x1BDD ; Logs
Loot[56]=0x1BDD ; Logs
Loot[57]=0x1BDD ; Logs
Loot[58]=0x1BDD ; Logs
Loot[59]=0x1BDD ; Logs
Loot[60]=0x1BDD ; Logs
Loot[61]=0x1BDD ; Logs
Loot[62]=0x1BDD ; Logs
Loot[63]=0x1BEF ; eiae
Loot[64]=0x1BEF ; eiae
Loot[65]=0x1BEF ; eiae
Loot[66]=0x1BEF ; eiae
Loot[67]=0x1BEF ; eiae
Loot[68]=0x1BEF ; eiae
Loot[69]=0x1BEF ; eiae
Loot[70]=0x1BEF ; eiae
Loot[71]=0x19B9 ; ?oaa
Loot[72]=0x19B9 ; ?oaa
Loot[73]=0x19B9 ; ?oaa
Loot[74]=0x19B9 ; ?oaa
Loot[75]=0x19B9 ; ?oaa
Loot[76]=0x19B9 ; ?oaa
Loot[77]=0x19B9 ; ?oaa
Loot[78]=0x1F03 ; ?iaa
Loot[79]=0x1515 ; ieauu
Loot[80]=0x1B76 ; ueo
Loot[81]=0x1414 ; ia??e
Loot[82]=0x1410 ; ?oee
Loot[83]=0x1415 ; aini
Loot[84]=0x1411 ; iiae
Loot[85]=0x1413 ; ai?ei
Loot[86]=0x1412 ; oeai
Loot[87]=0x1F03 ; ?iaa
Loot[88]=0x1515 ; ieauu
Loot[89]=0x1B76 ; ueo
Loot[90]=0x1414 ; ia??e
Loot[91]=0x1410 ; ?oee
Loot[92]=0x1415 ; aini
Loot[93]=0x1411 ; iiae
Loot[94]=0x1413 ; ai?ei
Loot[95]=0x1412 ; oeai
Loot[96]=0x1F03 ; ?iaa
Loot[97]=0x1515 ; ieauu
Loot[98]=0x1B76 ; ueo
Loot[99]=0x1414 ; ia??e
Loot[100]=0x1410 ; ?oee
Loot[101]=0x1415 ; aini
Loot[102]=0x1411 ; iiae
Loot[103]=0x1413 ; ai?ei
Loot[104]=0x1412 ; oeai
Loot[105]=0x0E21 ; aeiou
Loot[106]=0x13B9 ; aeeeia
Loot[107]=0x1406 ; iaena
Loot[108]=0x13B1 ; eoe
Loot[109]=0x0F4F ; a?aaeao
Loot[110]=0x13FC ; oy?aeue a?a
Loot[111]=0x13FE ; eaoaia
Loot[112]=0x143E ; aeaaa
Loot[113]=0x143E ; ?oia
Loot[114]=0x0F4C ; aaieiie oiii?
Loot[115]=0x1B7A ; oeo aa?aai
Loot[116]=0x1541 ; iiaycea
Loot[117]=0x0E21 ; aeiou
Loot[118]=0x13B9 ; aeeeia
Loot[119]=0x1406 ; iaena
Loot[120]=0x13B1 ; eoe
Loot[121]=0x0F4F ; a?aaeao
Loot[122]=0x13FC ; oy?aeue a?a
Loot[123]=0x13FE ; eaoaia
Loot[124]=0x143E ; aeaaa
Loot[125]=0x1F14 ; ?oia
Loot[126]=0x0F4C ; aaieiie oiii?
Loot[127]=0x1B7A ; oeo aa?aai
Loot[128]=0x1541 ; iiaycea
Loot[129]=0x0E21 ; aeiou
Loot[130]=0x13B9 ; aeeeia
Loot[131]=0x1406 ; iaena
Loot[132]=0x13B1 ; eoe
Loot[133]=0x0F4F ; a?aaeao
Loot[134]=0x13FC ; oy?aeue a?a
Loot[135]=0x13FE ; eaoaia
Loot[136]=0x143E ; aeaaa
Loot[137]=0x1F14 ; ?oia
Loot[138]=0x0F4C ; aaieiie oiii?
Loot[139]=0x1B7A ; oeo aa?aai
Loot[140]=0x0847 ; amul
Loot[141]=0x0E20 ; aeiou (e?iaaau&#229
Loot[142]=0x0E20 ; aeiou (e?iaaau&#229
Loot[143]=0x0EED ; gp
Loot[144]=0x1086 ; Bracelet of Mana Regeneration
Loot[145]=0x0F03 ; Antifreeze
Loot[146]=0x1F52 ; Paralyze Scroll
Loot[147]=0x0E87 ; Pitchork
Loot[148]=0x0E87 ; Hammer
i = 700
UO.SetReceivingContainer(luttuda)
FOR n=1 TO 148
uo.findtype(Loot[n],"-1","lastcontainer")
if uo.findcount() > 0 then
UO.grab(0, "finditem")
uo.print("Found "+str(uo.findcount()))
Wait(i)
END if
next
UO.UnSetReceivingContainer()
end sub

sub Heal()       ;Хилинг
   If UO.STR==UO.Life Then
      UO.Print("Life is full")
   Else
      UO.SetArm("1")
      UO.BandageSelf()
      wait(1000)
      UO.Arm("1")
      UO.UnSetArm()
   Endif
end sub


а вот и срипт на мининг тут он работает но через некаторое время крэшит клиент
Code:
################################################################
### Переменные #################################################
################################################################
###
### Для начала подготовится, положить в банк мешок(bag) и такой же в MageChest
### В мешки положить реги рекола Black Pearl, Mandrake Root, Blood Moss
### Самое главное выяснить Серийник банка!!!
### В банк положить руны к дому(одного типа!!! Тип рун в банке и в MageChest должны совпадать!!!)
### Положить в MageChest Руны в шахту(одного типа)
###
################################################################
################################################################
################################################################

var kirka, a, name, run, MageChest
var myXX, myYY, p
p=0

### ID друзей для игнора при поиске ПК и Криминал
var Charon='0x00324C05'
var Buiok='0x000C430F'
var friend3='0x001EEB63'

var x, y, coord
var MCave='2558,501-2578,476'      ; диапозон координат пещеры
var BankBrit='1446,1702-1421,1671'   ; диапозон координат Банка в Брите
var Home='1829,786-1843,800'      ; диапозон координат Дома

var kalitka='0x0847'       ; Тип закрытой калитки
var door='0x06A5'      ; тип закрытой двери в дом

var OreBox, bag, bankbox, rune, CraftChest
var bagreg, chest
bag='0x0E76'         ;тип мешка с регами
bankbox='0x40355E29'      ;Id банка (для того, что бы узнать ID банка, командой ",info" -
            ;- на любой предмет и скопировать из полученной информации -
            ;- значение C= -> 0x40156896 <-
 
rune='0x1F14'         ; Тип руны может быть 2-х типов
            ; '0x1F14' и '0x1F15'

CraftChest='0x402C32D2'      ; Сундук Крафта с паками под руду и инготы

MageChest='0x402B6E6A'      ; Сундуг Мага с паками и мешком-с-регами для Рекола

kirka = "0x0E85"       ;Тип кирки. 2 вида может "0x0E85" и "0x0E86"

OreBox = "0x4050B366"      ;Контейнер для руды

var text1, text2

text1="There is no ore|You have no line|That is to far away|You can't think|You have no line of|too far away|mining in rock."

text2="You put the|You loosen some|You can't think|That is to far away|There is no ore|You have no line of|too far away|mining in rock."

run=118            ; Код клавиши с биндом "AlwesRun"

################################################################
###Функция Main ##########################################
################################################################
sub main()
  uo.exec("exec ressurect")
  uo.exec("exec FindMan")
  uo.exec("exec mine")
end sub

sub r()
var r=uo.getrun('self')
uo.print(str(r))
end sub

################################################################
### Функция mine ############################################
################################################################
sub mine()      ; Kopania
  uo.ignorereset()
  walker(2578,480,1)
  var pause=0
  myXX=uo.getX(); zapominaet mesto otkuda nacel kopati
  myYY=uo.getY();
  var PX, PY, PZ, IX, IY
  PX = UO.GetX()
  PY = UO.GetY()
  PZ = UO.GetZ()
  while UO.Weight<=uo.str*4
    For Iy=-4 to 4
      For Ix=-4 to 4
        uo.deletejournal()
        while not UO.InJournal(text1) && uo.weight<=uo.str*4
          if p==1 then
            if not uo.hidden() then
              InJournal('You have hidden',60)
            endif
          endif
          UO.WaitTargetTile(-1,Str(PX+Ix),Str(PY+Iy),Str(PZ))
          uo.usetype(kirka)
          InJournal(text2,0)
          if uo.injournal('You loosen some') then
            pause=pause+1
            if pause>4 then
              wait(10000)
              pause=0
            endif
          else
            pause=0
          endif
        endif
        wait(200)
      wend
    next
    wait(200)
  next
  wait(200)
wend
uo.exec('exec GoBrit')
end sub
################################################################
### Функция FindMan ########################################
################################################################
Sub FindMan()
uo.set('finddistance','20')
var serial, a, b
b=4
uo.ignorereset()
uo.ignore('self')
repeat
    if UO.InJournal("You have been revealed|You can't seem") then
      p=1
      DelTextInJournal("You have been revealed|You can't seem")
      uo.showjournal(20)
    endif
  if p==1 then
     p=0
      if not uo.hidden() then
        uo.warmode(0)
        uo.useskill("Hiding")
      endif
  else
    uo.findman(b)
    wait(500)
    if uo.findcount()>0 || uo.injournal('attacking you') then
      uo.print('ATAC')
      uo.print(uo.getname('finditem')+' '+str(uo.getdistance('finditem')))
      uo.forget('finditem')
      uo.exec('terminate all; exec GoBrit')
    endif
    wait(100)
  endif
  if b==4 then
    b=6
   else
    b=4
  endif
until uo.dead()
end sub

################################################################
### Функция GoBrit ############################################
################################################################
Sub GoBrit()
uo.exec('terminate mine')
uo.ignorereset()
uo.press(run)
wait(50)
uo.press(35)
 if uo.getrun()==0 then
  uo.press(run)
 endif
walker(2581,480,0)
wait(50)
uo.press(35)
wait(50)
uo.press(35)
wait(50)
uo.press(run)
uo.press(35)
wait(50)
 if uo.getrun()==1 then
  uo.press(run)
 endif
walker(1433,1693,1)
wait(5000)
coord=GetXY('self')
if ComXY(BankBrit,coord)==true then
uo.exec('terminate FindMan; exec GoHome')
else
GoBrit()
endif
end sub

sub GoHome()
OpenChest()
wait(1000)
GotoHomeT()
move()
wait(5000)
OpenChest()
wait(2000)
uo.exec('terminate all; exec main')
end sub

################################################################
### Функция OpenChest #########################################
################################################################
sub OpenChest()
uo.findtype('0x0E42',-1,'ground')
if uo.findcount()>0 then
  uo.useobject(MageChest)
  chest=MageChest
else
  uo.sayu(' bank ')
  chest=bankbox
endif
wait(1000)
CheckLag()
uo.findtype(bag,-1,chest)
bagreg=uo.getserial('finditem')
uo.useobject(bagreg)
wait(1000)
CheckLag()
FindRune(chest)
end sub

################################################################
### Функция FindRune ##########################################
################################################################
sub FindRune(b)
var idrune
uo.findtype(rune,-1,b)
idrune=uo.getserial('finditem')
Cast(idrune)
end sub

################################################################
### Функция Cast(rune) ############################################
################################################################
Sub Cast(rune)
var a
coord=GetXY('self')
if ComXY(Home,coord)==true then
  a=true
 else
  a=false
endif
MoveReg(bagreg)
var mana
if uo.bm>0 && uo.bp>0 && uo.mr>0 then
cast:
  if uo.mana < 20 then
    med()
    wait(2000)
    goto cast
  endif
    mana = uo.mana
    uo.cast('Recall',rune)
    DelTextInJournal("fizzle")
    while mana <= uo.mana
      wait(200)
    wend
    if ComXY(MCave,coord)==false then
     if ComXY(Home,coord)==a then
     wait(1000)
     CheckLag()
     if uo.injournal("fizzle") then
      MoveReg(bagreg)
      goto cast
     endif
      wait(200)
     endif
    endif
else
  uo.print('Stop')
  uo.closeuo()
endif
wait(1000)
end sub

################################################################
### Функция Move reg ##########################################
################################################################
sub MoveReg(id)
   uo.print('Move Reagents')
   var a
   dim reg[3]
      reg[0] = "0x0F7A"   ;Black Pearls
      reg[1] = "0x0F7B"   ;Blood Moss
      reg[2] = "0x0F86"   ;Mandrake Roots
   for a=0 to 2
      if uo.count(reg[a])<1 then
         uo.findtype(reg[a],-1,id)
         uo.moveitem('finditem',2,'backpack')
         wait(700)
         CheckLag()
      endif
   next
endsub

################################################################
### Функция-массив Регов ######################################
################################################################
Sub mreg(reg)
reg[0] = "0x0F7A"       ;Black Pearls
reg[1] = "0x0F7B"       ;Blood Moss
reg[2] = "0x0F86"       ;Mandrake Roots
return reg
end sub

################################################################
### Функция meditation #######################################
################################################################
sub med()
uo.print('Meditation')
while uo.mana < uo.int
  UO.UseSkill("Meditation")
  injournal("You are at peace|You lose your concentration",60)
wend
end sub

################################################################
### Функция Goto Home #########################################
################################################################
sub GotoHomeT()
  uo.set('finddistance',4)
  uo.print('Go to Home')
  if type(kalitka)==true then
    uo.press(121)
    CheckLag()
  else
    wait(200)
  endif
 walker(1831,797,0)
  uo.press(121)
  CheckLag()
  if type(kalitka)==false then
 walker(1831,798,0)
    uo.press(121)
    CheckLag()
  endif
  wait(200)
 walker(1836,798,0)
  if type(door)==true then
    uo.press(121)
    CheckLag()
  else
    wait(200)
  endif
 walker(1836,794,0)
  uo.press(121)
  CheckLag()
  wait(500)
  if type(door)==false then
    uo.press(121)
    CheckLag()
  else
    wait(200)
  endif
  CheckLag()
end sub

Sub type(tip)
uo.findtype(tip,-1,'ground')
if uo.findcount()>0 then
  return true
else
  return false
endif
end sub

################################################################
### Функция MoveOre ##########################################
################################################################
sub move()
uo.useobject(CraftChest)
CheckLag()
uo.print('MOVEORE()')
wait(2000)
var e
dim a[4]
a[0] = 0x19B7
a[1] = 0x19BA
a[2] = 0x19B8
a[3] = 0x19B9
uo.useobject(OreBox)
CheckLag()
for e = 0 to 3
  repeat
    uo.findtype(a[e],-1,'backpack')
    uo.moveitem('finditem',0,OreBox)
    wait(900)
    CheckLag()
  until uo.findcount()==0
next
wait(1000)
MoveHi()
end sub

Sub MoveHi()
var Chest, OreBox, HiOreBox
Chest='0x402C32D2'
OreBox = "0x4050B366"   ;Контейнер для руды
HiOreBox = "0x4050B362"   ;Контейнер для "выхи"
var e, c

dim a[4],x[19]
a[0] = 0x19B9      ;4 and more ore
a[1] = 0x19B7      ;1 ore
a[2] = 0x19BA      ;2 ore
a[3] = 0x19B8      ;3 ore

x[0] = '0x09B9'      ;Acid ore
x[1] = '0x09A4'      ;Cristaline ore
x[2] = '0x0085'      ;Dragon ore
x[3] = '0x09D3'      ;Steel ore
x[4] = '0x09E6'      ;Elvin ore
x[5] = '0x09F0'      ;Gorgan ore
x[6] = '0x008F'      ;Send rock ore
x[7] = '0x04C2'      ;Blood rock ore
x[8] = '0x09DA'      ;Vulcan ore
x[9] = '0x0028'      ;Obsidian ore
x[10] = '0x08AF'   ;Plutonium ore
x[11] = '0x09EC'   ;Blood crest ore
x[12] = '0x0455'   ;Black rock ore
x[13] = '0x010F'   ;Krynite ore
x[14] = '0x0BA7'   ;Eldar ore
x[15] = '0x00CE'   ;Valorite ore
x[16] = '0x052D'   ;Mitheril ore
x[17] = '0x07D5'   ;Verite ore
x[18] = '0x0060'   ;Aqua ore
uo.useobject(HiOreBox)
wait(700)
CheckLag()
for e=0 to 3
  for c=0 to 18
    repeat
        uo.findtype(a[e],x[c],OreBox)
      if uo.findcount()>0 then
        uo.moveitem('finditem',0,HiOreBox)
        CheckLag()
        wait(400)
      endif
      wait(100)
    until uo.findcount()==0
  next
next
end sub

sub ressurect()
repeat
  ; ©dark_kynep
  if UO.Life < 1 then
    uo.useobject('self')
    CheckLag()
    uo.warmode(0)
    UO.LClick(974,57)
    CheckLag()
    wait(1000)
    UO.LClick(267,308)
    CheckLag()
    wait(1000)
    UO.LClick(179,201)
    CheckLag()
    wait(1000)
    walker(2468,531,1)
    uo.useobject('0x4001D120')
    CheckLag()
    walker(2466,542,0)
    CheckLag()
    walker(2506,542,0)
    Alive()
  else
    wait(1000)
    ; UO.Print("You are Alive!!!")
  endif
until uo.dead()
end sub

Sub Alive()
OpenChest()
GotoHomeT()
Heal()
OpenChest()
uo.exec('terminate all; exec main')
end sub

sub Heal()
uo.useobject('0x4023D30F')
CheckLag()
wait(500)
uo.findtype('0x0E21',-1,'0x4023D30F')
uo.moveitem('finditem',10,'backpack',10,10,0)
CheckLag()
wait(500)
repeat
  uo.bandageself()
  wait(5000)
until uo.life==uo.str
wait(500)
uo.useobject(CraftChest)
CheckLag()
wait(500)
uo.findtype(kirka,-1,CraftChest)
uo.moveitem('finditem',1,'backpack',100,10,0)
CheckLag()
wait(500)
end sub

################################################################
### Функция паузы по проверке журнала или таймера ########
################################################################
Sub InJournal(t,time)
;uo.print('EXEC INJOURNAL(T,TIME)')
var timer=uo.timer()
DelTextInJournal(t)
if time==0 then
  ;uo.print('TIME==0')
  while not uo.InJournal(t)
    wait(200)
  wend
else
  ;uo.print('TIME<>0')
  while not uo.InJournal(t) && uo.timer()<timer+time
    wait(200)
  wend
endif
end sub

################################################################
### Функция удаления из журнала Текста ########################
################################################################
Sub DelTextInJournal(msg) ; msg это параметр, см. выше как его передают
var nom=UO.InJournal(msg) ; ищем сообщение и в переменную его
if nom>0 then
  UO.SetJournalLine(Nom - 1," ") ; подменим сообщение
  DelTextInJournal(msg) ; вызов функцией самой себя, рекурсия
endif
end sub

################################################################
### Функция отклик сервера ###############################
################################################################
Sub CheckLag()
DelTextInJournal("backpack") ; вытрим ТОЛЬКО нужные нам сообщения в журнале
UO.Click('backpack') ; одиночный клик по вашему backpack
InJournal("backpack",0)
end sub

################################################################
### Функция World save now ####################################
################################################################
Sub ws()
if uo.injournal("World is saving now...") then
  InJournal("World data saving",1800)
endif
end sub


########################################## ХОДИЛКА 3 ##########################
#var Prec=3 # Как близко следует подойти к цели (Precision)
#var MaxTraceDistance=15 # Максимальная длина обхода. Желательно ставить с расчета возможных препятсвий. Если ставить очень #большие числа, кодилка может пойти в обход пол мира чтобы дойти к соседнему дереву.
#var Speed=2 # Длина шага. Сколько шагов делать за раз. Выше 3 ставить смысла нет. Тоесть тупое умножение шагов. Для ламбера #идеально 3, для майнинга - 1.
#var StepTimeOut=400 # Если уперлись в неопознанный обьект, сколько мсек ждать сдвига с места. Если по простому - таймаут #шага. Если поставить сильно маленькие, ходилка начнет трассировать пустые места.
#UO.SetGlobal("Logging","1")  # - показывать отладочные сообщения.
#UO.SetGlobal("BlindWalk","0") # - не использовать проверку тайлов, а использовать ходьбу наощупь. Для майнинга ОБЯЗАТЕЛЬНО #ВКЛЮЧИТЬ.
#В функции IsPass, содержиться список проходимых тайлов.

#Walker(X,Y,Prec) - идем к цели с координатами X,Y. Возвращает 1 в случае успешного достижения цели, и 0 - при невозможном обходе (путь не найден)
#Tracer(StartDir,Direction) - трассировка 1 шага. Возвращает направление по которому получилось сдвинуться с места. StartDir #- направление последнего движения, Direction (-1 или +1) направление обхода. -1 - по часовой стрелке, +1 против часовой #стрелки. Направления скрипт использует личного формата:
#1 - влево вниз
#2 - вниз
#3 - вправо вниз
#4 - вправо
#5 - вправо вверх
#6 - вверх
#7 - влево вверх
#8 - влево
#Tracer(StartDir,Direction) - идеально подходит для рыбалки вдоль берега так как она будет обходить берег бесконечно (1 #запуск функции = 1 шаг обхода).
#####################################################
# WW  W  WW   AA    LL     Kk KK  EE  EE  RRR       #
# WW  W  WW  AA A   LL     Kk K   EEE     R  R      #
# WW  W  WW  AA A   LL     KKK    EEEEE   R R       #
# WW WW  WW  AAAA   LL     KKK    EEE     RRR       #
#  WWW WWW  AA   A   LLLL  KK Kk  EE  EE  R  RR     #
####################################################
var MaxTraceDistance=10
var TraceLoopIncrease=5 #Увеличение MaxTraceDistance при исчерпании количества ходов
var LimitTrace=20 #Сколько шагов в ОБЕ стороны от начальной точки обхода прекращают ходилку (выхода нет).
var Speed=1
var StepTimeOut=600 #Таймаут шага. Устанавливать не в размер пинга, а в размер шага + размер пинга.
# Для ходьбы - 500+Ping
# Для бега/ходьбы на лошади - 300+Ping
# Бег на лошади - 150 + Ping

var CheckCnt=2 #Количество слепых проверок. УВЕЛИЧИВАЕТ В СТОЛЬКО РАЗ ТАЙМАУТ. Использовать только на БЫСТРОМ но НЕСТАБИЛЬНОМ коннекте. При большом пинге будет УЖАС.
var DynamicPause=30 #Минимальные паузы в циклах. Чем меньше число - тем меньше рывков и тем больше нагрузка процессора.

Sub Walker(GoX,GoY,Prec)
uo.warmode(0)
UO.SetGlobal("Logging","0")
UO.SetGlobal("BlindWalk","0")
var LastDir
var MoveRes
var TracerCnt
UO.SetGlobal("GlobalGoX",str(GoX))
UO.SetGlobal("GlobalGoY",str(GoY))
while not IsEnd(GoX,GoY,Prec)
  TracerCnt = MaxTraceDistance
  repeat
    LogInfo('Just walking')
    LastDir=GoUntilHit(GoX,GoY,Prec)
   
    if IsEnd(GoX,GoY,Prec) then
      return 1
    end if
   
    LogInfo('Tracing')
    MoveRes = FullAroundTrace(LastDir,GoX,GoY,Prec,TracerCnt)
    if TracerCnt > LimitTrace then
      return 0
    endif
    TracerCnt = TracerCnt + TraceLoopIncrease
  until MoveRes == 1
wend
return 1
end sub

Sub FullAroundTrace(StartDir,GoX,GoY,Prec,MaxTrace)
var LineX=UO.GetX()
var LineY=UO.GetY()
var CurDir=StartDir
var Direction=CountDirection(GoX,GoY,CurDir,Prec)
var StartX,StartY
var MovesDone=0
repeat
  StartX=UO.GetX()
  StartY=UO.GetY()
  CurDir=Tracer(CurDir,Direction,Prec)
  if (CurDir==GetDir(GoX,GoY,Prec)) then
    return 1
  endif
  if MovesDone>0 and PrevMoveCross(GetDirToDir(UO.GetDir(),Prec),LineX,LineY,GoX,GoY,StartX,StartY,Prec) then
    return 1
  end if
  MovesDone=MovesDone+1
  CurDir=AddToDir(CurDir,-Direction,Prec)
until MovesDone>MaxTrace
return 0
end sub

Sub CountDirection(GoX,GoY,StartDir,Prec)
var GoDir=GetDir(GoX,GoY,Prec)
var MyX=UO.GetX()
var MyY=UO.GetY()
if GoDir<StartDir then
  return -1
end if
if GoDir>StartDir then
  return 1
end if
if Abs(MyX-GoX)>Abs(MyY-GoY) then
  if (GoDir==3 and GoY>MyY) OR (GoDir==7 and GoY<MyY) then
    return -1
  else
    return 1
  end if
else
  if (GoDir==1 and GoX<MyX) or (GoDir==5 and GoX>MyX) then
    return -1
  else
    return 1
  end if
end if
end sub

Sub PrevMoveCross(Dir,x1,y1,x2,y2,StartX,StartY,Prec)
var x3,y3,x4,y4
x3=StartX
y3=StartY
x4=StartX+(XFromDir(Dir)-StartX)*Speed
y4=StartY+(YFromDir(Dir)-StartY)*Speed
return LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec)
end sub

Sub LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec)
if x1==x3 and y1==y3 then
  return false
end if
var z1=(x3-x1)*(y2-y1)-(y3-y1)*(x2-x1)
var z2=(x4-x1)*(y2-y1)-(y4-y1)*(x2-x1)
if z1*z2>0 then
  return false
else
  LogInfo('Vector info:')
  LogInfo('x1= '+str(x1))
  LogInfo('y1= '+str(y1))
  LogInfo('x2= '+str(x2))
  LogInfo('y2= '+str(y2))
  LogInfo('x3= '+str(x3))
  LogInfo('y3= '+str(y3))
  LogInfo('x4= '+str(x4))
  LogInfo('y4= '+str(y4))
  return true
end if
end sub

Sub IsDiap(X,X0,X1,Prec)
if X<=X0+Prec and X>=X1-Prec OR X>=X0-Prec and X<=X1+Prec then
  return true
end if
return false
end sub

Sub GoUntilHit(GoX,GoY,Prec)
var LastDir
LastDir=GetDir(GoX,GoY,Prec)
var CouldMove
repeat
  LastDir=GetDir(GoX,GoY,Prec)
  if LastDir<>0 and not IsEnd(GoX,GoY,Prec) then
    CouldMove=TryDir(LastDir,Prec)
  end if
until LastDir==0 or IsEnd(GoX,GoY,Prec) or not CouldMove
return LastDir
end sub

Sub IsEnd(GoX,GoY,Prec)
if Abs(UO.GetX()-GoX)<=Prec and Abs(UO.GetY()-GoY)<=Prec then
  LogInfo('END FOUND')
  return true
else
  return false
end if
end sub

Sub GetDir(GoX,GoY,Prec)
var MyX=UO.GetX()
var MyY=UO.GetY()
var DiffX=Abs(UO.GetX()-GoX)
var DiffY=Abs(UO.GetY()-GoY)
var GoDir=0
if (DiffX/(DiffY+0.1))>=2 then
  if (MyX>GoX) then
    GoDir=7
  else
    GoDir=3
  end if
else
 
  if (DiffY/(DiffX+0.1))>=2 then
    if (MyY>GoY) then
      GoDir=5
    else
      GoDir=1
    end if
  else
   
    if (MyX>GoX) and (MyY>GoY) then
      GoDir=6
    else
      if (MyX>GoX) and (MyY<GoY) then
        GoDir=8
      else
        if (MyX<GoX) and (MyY>GoY) then
          GoDir=4
        else
          if (MyX<GoX) and (MyY<GoY) then
            GoDir=2
          end if
        end if
      end if
    end if
  end if
end if
return GoDir
end sub

Sub Tracer(StartDir,Direction,Prec)
var CurDir=StartDir
var Result
repeat
  Result=TryDir(CurDir,Prec)
  if not Result then
    CurDir=AddToDir(CurDir,Direction,Prec)
  end if
until Result
return Result
end sub

Sub AddToDir(Dir,Cnt,Prec)
var NewDir=Dir
NewDir=NewDir+Cnt
while NewDir>8
  NewDir=NewDir-8
wend
while NewDir<1
  NewDir=NewDir+8
wend
return NewDir
end sub

Sub TryDir(Dir,Prec)
var BegX=UO.GetX() # Ia?aeuiia O
var BegY=UO.GetY() # Ia?aeuiia Y
var Counter=0
var GoX=BegX
var GoY=BegY
GoX=XFromDir(Dir)
GoY=YFromDir(Dir)
if not IsPass(GoX,GoY) then
  LogInfo(str(GoX)+':'+str(GoY)+' is not passable')
  return false
end if
return TurnAndGoDir(Dir,Prec)
end sub

Sub XFromDir(Dir)
if Dir==2 OR Dir==3 Or Dir==4 then
  return (UO.GetX()+1)
end if
if Dir==6 OR Dir==7 Or Dir==8 then
  return (UO.GetX()-1)
end if
return (UO.GetX())
end sub

Sub YFromDir(Dir)
if Dir==8 OR Dir==1 Or Dir==2 then
  return (UO.GetY()+1)
end if
if Dir==4 OR Dir==5 Or Dir==6 then
  return (UO.GetY()-1)
end if
return (UO.GetY())
end sub

Sub TurnAndGoDir(Dir,Prec)
var StartDir=GetDirToDir(UO.GetDir(),Prec)
var StartX=UO.GetX()
var StartY=UO.GetY()
var EndDir
var Counter=0
var TestCounter=CheckCnt

#Direction Test
repeat
  Counter = 0
  LogInfo('Dir: '+str(StartDir)+' Counter: '+str(Counter))
  PressDir(Dir)
  repeat
    EndDir=GetDirToDir(UO.GetDir(),Prec)
    wait(DynamicPause)
    Counter=Counter+1
  until StartDir<>EndDir or StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause
  TestCounter = TestCounter - 1
  LogInfo('Dir: '+str(EndDir)+' Counter: '+str(Counter))
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause

if Counter>=StepTimeOut/DynamicPause  then
  LogInfo('Direction timeout reached')
  return 0
end if
#End direction Test

if StartY<>UO.GetY() or StartX<>UO.GetX() then
  return Dir
end if

#Start Primary test
TestCounter=CheckCnt
repeat
  GoDir(Dir,Prec)
  Counter=0
  repeat
    wait(DynamicPause)
    Counter=Counter+1
  until StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause
  TestCounter = TestCounter - 1
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause
#End primary test

if Counter>=StepTimeOut/DynamicPause then
  LogInfo('Step timeout reached')
  return 0
else
  return Dir
end if
end sub

Sub GetDirToDir(GotDir,Prec)
var ChangedDir=-GotDir
ChangedDir=AddToDir(ChangedDir,5,Prec)
return ChangedDir
end sub

Sub DirToInj(Dir)
dim Dirs[9]
Dirs[1]=1
Dirs[2]=2
Dirs[3]=3
Dirs[4]=6
Dirs[5]=9
Dirs[6]=8
Dirs[7]=7
Dirs[8]=4

return (Dirs[Dir])
end sub

Sub PressDir(Dir)
dim Dirs[9]
Dirs[1]=35
Dirs[2]=40
Dirs[3]=34
Dirs[4]=39
Dirs[5]=33
Dirs[6]=38
Dirs[7]=36
Dirs[8]=37

UO.Press(Dirs[Dir],1)
end sub

Sub GoDir(Dir,Prec)
dim Dirs[9]
Dirs[1]=35
Dirs[2]=40
Dirs[3]=34
Dirs[4]=39
Dirs[5]=33
Dirs[6]=38
Dirs[7]=36
Dirs[8]=37

var DistanceX=Abs(UO.GetX()-val(UO.GetGlobal("GlobalGoX")))
var DistanceY=Abs(UO.GetY()-val(UO.GetGlobal("GlobalGoY")))
var GoDistance
if (DistanceX-Prec)<Speed then
  GoDistance=DistanceX-Prec
else
  if (DistanceY-Prec)<Speed then
    GoDistance=DistanceY-Prec
  else
    GoDistance=Speed
  endif
endif

UO.Press(Dirs[Dir],GoDistance)
end sub

Sub IsPass(X,Y)
if UO.GetGlobal("BlindWalk") then
  return true
endif

dim Types[60]
Types[1]=3
Types[2]=25
Types[3]=51
Types[4]=63
Types[5]=113
Types[6]=140
Types[7]=172
Types[8]=219
Types[9]=232
Types[10]=235
Types[11]=239
Types[12]=243
Types[13]=248
Types[14]=251
Types[15]=264
Types[16]=267
Types[17]=282
Types[18]=289
Types[19]=321
Types[20]=379
Types[21]=420
Types[22]=440
Types[23]=476
Types[24]=499
Types[25]=513
Types[26]=542
Types[27]=578
Types[28]=586
Types[29]=622
Types[30]=700
Types[31]=804
Types[32]=1740
Types[33]=1758
Types[34]=1770
Types[35]=1779
Types[36]=1779
Types[37]=1881
Types[38]=1886
Types[39]=1801
Types[40]=1805
Types[41]=1813
Types[42]=1820
Types[43]=1831
Types[44]=1833
Types[45]=1843
Types[46]=1850
Types[47]=1873
Types[48]=1876
Types[49]=1885
Types[50]=1888
Types[51]=1946
Types[52]=1969
Types[53]=2500
Types[54]=2539

for var i=1 TO 53 STEP 2
  if UO.PrivateGetTile(X,Y,-1,Types[i],Types[i+1]) then
    return true
  end if
next
return false
end sub

Sub LogInfo(Line)
if not UO.GetGlobal("Logging")=="0" then
  UO.TextOpen()
  UO.TextPrint(str(UO.GetX())+":"+str(UO.GetY())+" - "+Line);
end if
end sub

Sub Abs(X)
if X>0 then
  return X
else
  return (-X)
end if
end sub
##########################################

Sub GetXY(man)
var xy
x=uo.getx(man)
y=uo.gety(man)
xy=str(x)+','+str(y)
return xy
end sub

Sub ComXY(coordinate,coord)
var myx, myy, x1, y1, L, pref, minx, maxx, miny, maxy
L=len(coordinate)
;uo.print('Длина строки = '+str(L))
;wait(100)
 x1=XY(coordinate,'-',0)
;uo.print('Координаты а: '+x1)
;wait(100)
 y1=XY(coordinate,'-',1)
;uo.print('Координаты б: '+y1)
;wait(100)
 minx=XY(x1,',',0)
;uo.print('Координата minx: '+minx)
;wait(100)
 miny=XY(x1,',',1)
uo.print('Координата miny: '+miny)
wait(100)
 maxx=XY(y1,',',0)
;uo.print('Координата maxx: '+maxx)
;wait(100)
 maxy=XY(y1,',',1)
;uo.print('Координата maxy: '+maxy)
;wait(100)
 myx=XY(coord,',',0)
;uo.print('Координата myx: '+myx)
;wait(1000)
 myy=XY(coord,',',1)
;uo.print('Координата myy: '+myy)
 if minx>maxx then
   x=minx
;uo.print('X1=MinX='+x1)
;wait(100)
   minx=maxx
;uo.print('MinX=MaxX='+minx)
;wait(100)
   maxx=x
;uo.print('maxx=x1='+minx)
;wait(100)
 endif
 if miny>maxy then
   y=miny
;uo.print('Y1=MinY='+y)
;wait(100)
   miny=maxy
;uo.print('MinY=MaxY='+miny)
;wait(100)
   maxy=y
;uo.print('maxy=y1='+maxy)
;wait(100)
 endif
; wait(100)
 if myx>minx && myx<maxx && myy>miny && myy<maxy then
   return true
  else
   return false
 endif
end sub

Sub XY(con,d,c)
var pref, L, z
 L=len(con)
 for pref=0 to L
  if con[pref]==d then
   if c==0 then
     z=left(con,pref)
   endif
   wait(50)
   if c==1 then
     z=right(con,L-pref-1)
   endif
  endif
 next
return z
end sub

Некто не поможет мне ???


Top
   
 Post subject:
PostPosted: 2009-03-22 19:55:03 
Offline
Expert!
User avatar

Joined: 2006-02-07 08:51:40
Posts: 1348
Location: г. Старый Оскол
Вот рабочий лут с резкой. Тип дагера вставь.
Code:
Sub Looting()
   var t,l
   t=500
   VAR WaitTime=950
   uo.UseObject('lastcorpse')
   wait(t)
   VAR dag = '0x0F52'
   VAR dagcol = '0x0000'
   dim LootingItem[48]
   uo.Print('Начинаем Лутать...')
   LootingItem[1] = 0x0F03 ## - Antifreeze
   LootingItem[2] = 0x1B76 ## - Platemail Heater
   LootingItem[3] = 0x1B77 ## - Platemail Heater 2
   LootingItem[4] = 0x1415 ## - Platemail Gauntlets
   LootingItem[5] = 0x1416 ## - Platemail Gauntlets 2
   LootingItem[6] = 0x1411 ## - Platemail Legs
   LootingItem[7] = 0x141A ## - Platemail Legs 2
   LootingItem[8] = 0x1410  ## - Platemail Arms
   LootingItem[9] = 0x1419  ## - Platemail Helm
   LootingItem[10] = 0x1412  ## - Platemail Helm 2
   LootingItem[11] = 0x1418 ## - Platemail Gloves
   LootingItem[12] = 0x1414 ## - Platemail Gloves 2
   LootingItem[13] = 0x1413 ## - Platemail Gorget
   LootingItem[14] = 0x1086  ## - Bracelet
   LootingItem[15] = 0x0EED  ## - Gold Coins
   LootingItem[16] = 0x13B9  ## - Viking Sword
   LootingItem[17] = 0x0F4D  ## - Bardiche
   LootingItem[18] = 0x1406  ## - War Mace
   LootingItem[19] = 0x0F51  ## - Dagger
   LootingItem[20] = 0x0F45  ## - executioners axe
   LootingItem[21] = 0x0E87  ## - Pitchfork
   LootingItem[22] = 0x0F62 ## - Spear
   LootingItem[23] = 0x0F4B ## - double axe
   LootingItem[24] = 0x1442 ## - two handed axe
   LootingItem[25] = 0x143E ## - halberd
   LootingItem[26] = 0x13B1 ## - Bow
   LootingItem[27] = 0x13FC ## - Heavy Crossbow
   LootingItem[28] = 0x0F4F ## - Crossbow
   LootingItem[29] = 0x0E21 ## - Clear Bandage
   LootingItem[30] = 0x0F0E ## - Banki
   LootingItem[31] = 0x1F4C ## - recall scroll
   LootingItem[32] = 0x1F5F ## - FS Scroll
   LootingItem[33] = 0x1F52 ## - Paralyze Scroll
   LootingItem[34] = 0x1F50 ## - MR Scroll
   LootingItem[35] = 0x0E76 ## - Bag
   LootingItem[36] = 0x0E79 ## - belt pouch
   LootingItem[37] = 0x09B0 ## - belt pouch 2
   LootingItem[38] = 0x1BFB ## - CrossBow Bolt
   LootingItem[39] = 0x0F3F ## - Bow Arrow
   LootingItem[40] = 0x0F7B ## - blood moss
   LootingItem[41] = 0x0F8D ## - ss
   LootingItem[42] = 0x0F8C ## - sa
   LootingItem[43] = 0x0F88 ## - ns
   LootingItem[44] = 0x0F7A ## - bp
   LootingItem[45] = 0x0F84 ## - gl
   LootingItem[46] = 0x0F86 ## - mr
   LootingItem[47] = 0x0F85 ## - gs
   LootingItem[48] = 0x1BDD ## - Logs
   #LootingItem[] =  ## -
   #LootingItem[] =  ## -
   #LootingItem[] =  ## -
   #LootingItem[] =  ## -
   #LootingItem[] =  ## -
   
   if UO.GetQuantity('lastcorpse') then
      UO.SetArm('temp')
      UO.WaitTargetObject('lastcorpse')
      UO.FindType(dag, dagcol, 'backpack')
      UO.UseObject('finditem') ;dagger
      wait(1000)
      UO.Arm('temp')
      wait(1500)
   endif
   
   #UO.SetReceivingContainer('0x400105D8') ; loot store bag
   
   For l = 1 to 47
      UO.FindType(LootingItem[l],-1,'ground')
      if UO.GetQuantity('finditem') then
         repeat
            uo.moveitem('finditem', '-1', 'backpack', 150, 132, 0)
            wait(WaitTime)
            UO.FindType(LootingItem[l], '-1', 'ground')
            wait(100)
         until UO.FindCount() == 0
      endif
     
      if UO.GetQuantity('lastcorpse') then
         UO.FindType(LootingItem[l], '-1', 'lastcorpse')
         if UO.GetQuantity('finditem') then
            if LootingItem[l]==0x1078 then
               UO.WaitTargetObject('finditem')
               UO.UseType('0x0F9E')
            else
               repeat
                  uo.moveitem('finditem', '-1', 'backpack', 150, 132, 0)
                  wait(WaitTime)
                  UO.FindType(LootingItem[l], '-1', 'lastcorpse')
                  wait(100)
               until UO.FindCount() == 0
            endif
         endif
      endif
   next
   uo.Print('Закончили...')
   #UO.UnSetReceivingContainer()
end sub


Пробуй.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited