Yoko

All sides of Injection
It is currently 2024-03-29 01:11:35

All times are UTC+02:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Mining
PostPosted: 2010-02-18 04:36:19 
Offline

Joined: 2009-03-10 09:43:01
Posts: 78
Code:
#ABAIXO: Limite das coordenadas (.where), Se passar do limite o char volta
var limitW    = 0         #LIMIT X de WEST (lefta)
var limitE    = 0         #LIMIT X de EAST (right)
var limitN    = 0         #LIMIT Y de NORTH (top)
var limitS   = 1600      #LIMIT Y de SOUTH (bottom)

var passos       = 4            #NUMBER OF TILES TO WALK AFTER MINE AROUND
var volta       = 6            #NUMERO TILES TO WALKBAC AFTER CROSS A LIMIT
var peso      = 360      #WEIGHT TO GO BANK

#CHOSE 0 Banker at mine | 1 to recall to bank | 2 to recall to your container
var guardar      = 1            #MODE Banker at Mine/Recall to banker/Recall to your container

var bau          = 'bau'         #CONTAINER qwith your ores
var runemina    = 'runebook 9'   #RUNE Runebook and number of Rune of Mine
var runeguardar   = 'runebook 3'   #RUNE Runebook and number of Rune of Banker or your Container
var tent1      = 3            #TRYS to BEFORE GO TO ANOTHER TILE TO MINE
var tent2      = 2            #TRYS EXTRASto BEFORE GO TO ANOTHER TILE TO MINE IF YOU GOT AN ORE AT THIS TILE
#(ANTI-"BUG" i you got no skill to mine some ore )

#MENSAGENS:
var outro   = 'Tente miner|You cann|O alvo|Nao ha|Skill M|Voce nao'   #MSG to go to another tile
var pegou   = 'You put'               #MSG when you found an ore
var falha     = 'Voce nao con'            #MSG when you fail to get a ore
var bank   = 'You have'            #MSG when you have open you bank

var orefora   = 'Iron'          #NAME OF ORES TO DROP
var orepular= 'Ceramic|Silver'      #NAME TO ORES TO IGNORE WHEN YOU FOUND IT

var try

sub mining() ; By ChavinhO (para Mina de Minoc DMS)
   var x,y,ore,asd=1
   uo.charprint('0x0045','Iniciando macro...')
   pickaxe()
   while uo.findcount('pickaxe')==0 or uo.getquantity('pickaxe')==0
      for x = -2 to 2
         for y = -2 to 2
            if (uo.weight >= peso) then
                  guardarores()
            endif
            if ( num(x) + num(y) ) < 4 and ( num(x) + num(y) ) > 0 then
                  ore=0
                  try=0
                     repeat
                     UO.DeleteJournal()
                        uo.waittargettile('#0x400', str(uo.GetX() + x), str(uo.GetY() + y), STR(UO.GetZ()))
                       uo.useobject('pickaxe')
                     repeat
                        wait(30)
                        until UO.InJournal( outro+ '|' +pegou )
                        if UO.InJournal( pegou ) then
                           ore=1
                           ore()
                        endif
                         if uo.injournal( falha ) then
                        try=try+1
                         endif
                     until UO.InJournal( outro ) or (try>=tent1 and ore==0) or try>=tent1+tent2
               endif
            next
      next
      walk()
   wend
end sub

sub ore()
    var l, c, n , j, lm
   if UO.InJournal( orepular+ '|' +orefora ) then
      if UO.InJournal( orefora ) then
         j=1
      endif
      try=100
   endif
   uo.ignorereset()
    uo.findtype('-1','-1','backpack')
    l=uo.findcount('finditem')-1
    while l>0
        uo.ignore('finditem')
        uo.findtype('-1','-1','backpack')
        l=l-1
    wend
    uo.findtype('-1','-1','backpack')
   if j==1 then
      UO.MoveItem('finditem','-1','ground')
   else
      lm=UO.LastMessage()
       uo.click('finditem')
       repeat
          wait(1)
      until UO.LastMessage()<>lm
       c=uo.getcolor('finditem')
      n=uo.getname('finditem')
      uo.charprint(c,n)
   endif
   uo.charprint('0x1152','Peso: ' +str(uo.weight)+ '(' +str(peso)+ ')')
   uo.ignorereset()
endsub

sub pickaxe()
if uo.count('0x0E85')>0 then
   uo.addobject('pickaxe','_0x0E85')
   uo.useobject('backpack')
   return
endif
if uo.count('0x0E86')>0 then
   uo.addobject('pickaxe','_0x0E86')
   uo.useobject('backpack')
   return
endif
uo.charprint('0x0022','Voce nao tem Pickaxe!')
endsub

sub walk()
   var cl,lastdir,py=UO.GetY(),px=UO.GetX(),d ,t
   dim DIR[8]
   DIR[0] = 33
   DIR[1] = 39
   DIR[2] = 34
   DIR[3] = 40
   DIR[4] = 35
   DIR[5] = 37
   DIR[6] = 36
   DIR[7] = 38
   repeat
      t=passos
      d=UO.Random(8)
      py=UO.GetY()
      px=UO.GetX()
      while t>0
         if uo.getdir()<>d then
               uo.press(DIR[d])
            endif
            wait(35)
            uo.press(DIR[d])
            t=t-1
         if  (UO.GetX() < limitW) or (UO.GetX() > limitfix(limitE)) or (UO.GetY() < limitN) or (UO.GetY() > limitfix(limitS)) then
            if uo.getdir()>3 then
               d=uo.getdir()-4
            else
               d=uo.getdir()+4
            endif
            t=volta
            endif
      wend
   until (px <> UO.GetX()) or (py <> UO.GetY())   
endsub

sub limitfix(x)
   if x==0 then
      return 10000
   endif
   return x
endsub

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

sub GuardarOres()
   if guardar==0 then
      oresbank()
   else
      recall('recall '+runeguardar)
      oresbank()
      recall('recall '+runemina)
   endif
endsub

sub recall(runa)
   var timer=uo.timer() + 80
    var px=uo.getx('self'),py=uo.gety('self')
    uo.exec(runa)
    while px==uo.getx('self') and py==uo.gety('self')
        if uo.timer() >= timer then
            uo.useskill('Meditation')
            recall(runa)
        endif
        wait(5)
    wend
endsub

sub oresbank()
   var n,b,l=0,lm,i
   DIM ID[12]
   ID[1]='0x19B9'
   ID[2]='0x19B8'
   ID[3]='0x19BA'
   ID[4]='0x19B7'
   ID[5] = '0x0F16'
   ID[6] = '0x0F10'
   ID[7] = '0x0F0F'
   ID[8] = '0x0F18'
   ID[9] = '0x0F26'
   ID[10] = '0x0F11'
   ID[11] = '0x0F15'
   ID[12] = '0x0F13'
    uo.deletejournal()
    if guardar==2 then
       uo.useobject(bau)
       b=uo.getserial('bau')
    else
       uo.msg('bank')
       repeat
           wait(5)
       until uo.injournal( bank )
         b=uo.getserial('lastcontainer')
      endif
   For i=1 To 12
      while uo.count(ID[i]) > 0
         UO.FindType(ID[i],'-1','backpack')
           while not uo.ContainerOF('finditem')==b
               UO.moveitem('finditem','-1',b)
               wait(5)
           wend
      wend
   Next
    uo.textclear()
    uo.ignorereset()
    uo.deletejournal()
   For i=1 To 4
       uo.findtype(ID[i],'-1',b)
       l=uo.findcount('finditem')
      while l>0
         lm=UO.LastMessage()
         uo.click('finditem')
         repeat
            wait(1)
         until UO.LastMessage()<>lm
         n=uo.getname('finditem')
         uo.exec('showjournal 1')
         uo.ignore('finditem')
         uo.findtype(ID[i],'-1',b)
         l=l-1
      wend
   next
end sub


Top
   
 Post subject: Re: Mining
PostPosted: 2010-02-19 10:47:35 
Offline

Joined: 2009-03-10 09:43:01
Posts: 78
fix: this line was changed ( sub walk() )
if (UO.GetX() < limitW) or (UO.GetX() > limitfix(limitE)) or (UO.GetY() < limitN) or (UO.GetY() > limitfix(limitS)) then


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 6 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