Yoko

All sides of Injection
It is currently 2024-03-28 13:52:20

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: Lumber
PostPosted: 2010-02-14 14:15:02 
Offline

Joined: 2009-03-10 09:43:01
Posts: 78
Code:
#------------------START OF CONFIG FUNCTIONS (ADD TREES TO FILE) -----------------
sub config()
    var f=file('trees.dat')
    var w,n=0,i

    dim aX[300]
    dim aY[300]
    dim aID[300]
    uo.exec('filterspeech add party')
    uo.exec('filterspeech on')
    uo.say('')

    uo.charprint('0x0045','Lumber (by xinxilas ChavinhO)')
    uo.charprint('0x0035','Choose the trees')
    uo.charprint('0x0022','Select your char to finalize')

    loop:
        uo.say('/add')
        while not uo.targeting()
            wait(10)
        wend
        while uo.targeting()
            wait(10)
        wend

        if uo.lasttile(0)==400 then
            if n>0 then
                f.open()
                f.create()
                w=safe call f.writeln(str(n))
                for i=1 to n
                    w=safe call f.writeln(str(aX[i])+' '+str(aY[i])+' '+str(aID[i]))
                next
                f.close()
            endif
            goto fim
        endif

        if aID(str(uo.lasttile(0)))==0 then
            uo.charprint('0x0022','Invalid Tree.')
            goto loop
        endif

        if n>=1 then
            for i=1 to n
                if str(aX[i])+' '+str(aY[i]) == str(uo.lasttile(1))+' '+str(uo.lasttile(2)) then
                    uo.charprint('0x0022','Repeated Tree')
                    goto loop
                endif
            next
        endif

        n=n+1
        aID[n] = uo.lasttile(0)
        aX[n] = uo.lasttile(1)
        aY[n] = uo.lasttile(2)
        uo.charprint('0x0045','Tree added('+str(n)+')')
    goto loop
    fim:
    if n>0 then
        uo.charprint('0x0045','Trees: '+str(n))
        uo.charprint('0x0045','OK! get your runes and start the macro')
        if n<76 then
            uo.charprint('0x0022','Recomended more then 75 arvores.')
        endif
    else
        uo.charprint('0x0022','The File wasnt modified/created.')
    endif
    uo.exec('filterspeech clear')
    uo.exec('filterspeech off')
end sub

Sub aID( type )
var i
DIM tree[23]
tree[0] = '3274'
tree[1] = '3275'
tree[2] = '3276'
tree[3] = '3277'
tree[4] = '3280'
tree[5] = '3283'
tree[6] = '3286'
tree[7] = '3288'
tree[8] = '3289'
tree[9] = '3290'
tree[10] = '3291'
tree[11] = '3292'
tree[12] = '3293'
tree[13] = '3294'
tree[14] = '3295'
tree[15] = '3296'
tree[16] = '3299'
tree[17] = '3302'
tree[18] = '3394'
tree[19] = '3395'
tree[20] = '3417'
tree[21] = '3440'
tree[22] = '3461'
for i = 0 to 22
if tree[i]==type then
return 1
endif
next
return 0
endsub
#------------------END OF CONFIG FUNCTIONS (ADD TREES TO FILE) -----------------



Code:
#--------------------START COMMENTS--------------------
# MARK AN RUNE NEAR OF THE FIRST TREE
# ANTI-PKILLERS (GUARDS, BANDS, POTS, CURE)
# MAKE SURE YOU HAVE BANDS AND HEAL POTS (IT WORKS WIHTOUT THIS ITEMS)
# BRING A RUNE ON YOUR BACKPACK TO HELP THE MACRO...
# ...SO YOU CAN BACK EXATLY WHERE YOU WERE WHEN YOU GOT YOUR WEIGHT LIMIT
# FEATURE: TEXTBOX WITH ALL YOUR LOGS AT BANK
# FEATURE: STATUS INFOS(LOGS, TREES, HOW MANY BACKS TO BANK) CLICK ON YOUR CHAR
# FEATURE: TO SEE ALL YOUR LOGS AT BACKPACK, CLICK ON YOUR BACKPACK
# IF YOU ARE NOT GM LUMBERJACKING, IT SHOWS ALSO YOUR SKILL
# TO START: ,EXEC LUMBER
#                                                                                                         by XINXILAS CHAVINHO
#------------------END COMMENTS-----------------

#------------------START LUMBER SCRIPT-----------------

    #--------------------START CONFIG--------------------
    var f=file('trees.dat')         #NAME of file to keep the Trees infos
    var toofar='Isto esta'            #MSGs (when you did not reach the tree)
    var putlog='Voce pos'            #MSGs (when put logs on backpack)
    var logsover='Nao ha ma'            #MSGs ( tree whitout choops(logs) )
    var fail='Voce nao con|Skills L'   #MSGs (when you failed)   
    var attacked='Vortex|attacks you'      #MSGs (dangerous things)
    var bank='You have'               #MSG  (when bank opens)
    var potheal='.drinkheal'                #MSG heal potion bind of your shard(or use ',useobject X' ',usetype X' etc..)
    var tent1=4            #HOW MANY TRYS to get logs before goes to next tree
    var tent2=4            #EXTRA-TRYS in case your char already got and log on the tree at the moment
                     #(TRYS and EXTRA TRYS is a protection in case you are not skill GM)
    var weight=350                  #WEIGHT LIMIT
    var runebank='runebook 4'         #RUNEBOOK and NUMBER of bank rune
    var runelogs='runebook 5'         #RUNEBOOK and NUMBER of first tree rune
    var colorm = 44                  #COLOR OF TEXTS when you got an Log
                           #1=same color of the log
    #--------------------END  CONFIG--------------------

sub lumber()
 dim aID[500]
 dim aX[500]
 dim aY[500]
 var a, i, try, log
 
 starting()
 
 f.open()
 a=safe call f.readNumber()
 for i=1 to a
  aX[i]=safe call f.ReadNumber()
  aY[i]=safe call f.ReadNumber()
  aID[i]=safe call f.ReadNumber()
 next
 f.close()

 loop:
  for i=1 to a
   if ( uo.weight > weight ) then
    uo.charprint('0x0022','You get your weight limit')
    guardar.logs()
   endif
   log=0
   try=0
   irarvore(aX[i],aY[i])
   uo.charprint('0x0050','Tree: '+str(i)+' ('+str(a)+')')
   repeat
    status()
    uo.deletejournal()
    uo.waittargettile(aID[i], aX[i], aY[i], 0)
    uo.useobject('hatchet')
    repeat
     wait(10)
     status()
    until uo.injournal( toofar + '|' + putlog + '|' + logsover  + '|' + attacked + '|' + fail ) or uo.life<uo.str
    if uo.injournal( putlog ) then
     msg.log()
     log=1
    endif
    if uo.injournal( fail ) then
     try=try+1
     uo.charprint('0x0007', 'Try: ' + str(try) + '/' + str(log*tent1+tent2) )
    endif
    if uo.life<uo.str or uo.injournal( attacked ) then
     perigo()
    endif
   until uo.injournal( toofar + '|' + logsover ) or (try==tent1 and log==0) or try==tent1+tent2
   if log==1 then
    uo.setglobal('arvores',val(uo.getglobal('arvores'))+1)
   endif
  next
  uo.charprint('0x0022','Trees ended')
  recall('recall '+runelogs)
 goto loop
end sub

sub starting()
 uo.setglobal('arvores','')
 uo.setglobal('bank','')
 uo.setglobal('logs','')
 hatchet()
 uo.charprint('0x0007','Strating Script.')
 uo.charprint('0x0045','By ChavinhO!')
 recall('recall '+runelogs)
 uo.deletejournal()
endsub

sub hatchet()
uo.useobject('backpack')
if uo.count('0x0F44') or uo.count('0x0F43') then
 if uo.count('0x0F44') then
  uo.findtype('0x0F44','-1','my')
 endif
 if uo.count('0x0F43') then
  uo.findtype('0x0F43','-1','my')
 endif
 uo.addobject('hatchet','finditem')
else
 uo.charprint('0x0022','You have no Hatchet')
 uo.charprint('0x0022','Script stopped')
 uo.exec('terminate all')
endif
endsub

sub guardar.logs()
 if uo.count('0x1F14') then
  uo.findtype('0x1F14','-1','backpack')
  uo.cast('Mark','finditem')
  wait(6000)
 endif
 recall('recall '+runebank)
 uo.setglobal('bank',val(uo.getglobal('bank'))+1)
 logs.bank()
 if uo.count('0x1F14') then
  uo.findtype('0x1F14','-1','backpack')
  recall('runa')
 else
  recall('recall '+runelogs)
 endif 
endsub

sub logstobank()
 var b,c,n
 uo.deletejournal()
 uo.msg('bank')
 repeat
  wait(5)
 until uo.injournal( bank )
 b=uo.getserial('lastcontainer')
 while uo.count('0x1BDD')>0
   uo.findtype('0x1BDD','-1','backpack')
   while not uo.ContainerOF('finditem')==b
    UO.moveitem('finditem','-1',b)
    wait(5)
   wend
   if uo.getcolor('finditem')=='0x0000' then
    uo.setglobal('logs',val(uo.getglobal('logs'))+uo.getquantity('finditem'))
   endif
  wend
 showlogs(b)
endsub

sub status()
 var x, l,uid,n=uo.getname('self')
        if uo.injournal(n) then
          uo.deletejournal(n)
            uo.findtype('0x1BDD','0x0000','backpack')
            x=uo.getquantity('finditem')+val(uo.getglobal('logs'))
            uo.charprint('0x0047','..went to bank '+str(val(uo.getglobal('bank')))+' times.')
            uo.charprint('0x0047','..cutted '+str(val(uo.getglobal('arvores')))+' trees.')
            uo.charprint('0x0047','..tem '+str(x)+' normal logs.')
            if uo.skillval('Lumberjacking',1) < 1000 then
                uo.print('You have '+ str(uo.skillval('Lumberjacking',1)) + ' LumberJacking.')
            endif
         endif
         if uo.injournal('backpack') then
           uid=uo.getserial('backpack')
           showlogs(uid)
          uo.deletejournal('backpack')
         endif
endsub

sub msg.log()
 var l, c, n
 uo.ignorereset()
 uo.deletejournal('logs')
 uo.findtype('0x1BDD','-1','backpack')
 l=uo.findcount('finditem')-1
 while l>0
  uo.ignore('finditem')
  uo.findtype('0x1BDD','-1','backpack')
  l=l-1
 wend
 uo.findtype('0x1BDD','-1','backpack')
 uo.click('finditem')
 repeat
  wait(1)
 until uo.injournal('log')
 c=uo.getcolor('finditem')
 if colorm<>1 then
  c=colorm
 endif
 n=uo.getname('finditem')
 uo.charprint( c,'You have: '+n )
 uo.ignorereset()
endsub

sub showlogs(uid)
 var l,n
 if not uid==uo.getserial('backpack') then
  uo.exec('textclear')
 endif
 uo.ignorereset()
 uo.deletejournal('logs')
 uo.findtype('0x1BDD','-1',uid)
 l=uo.findcount('finditem')
 while l>0
  uo.deletejournal('logs')
  uo.click('finditem')
  repeat
   wait(1)
  until uo.injournal('log')
  n=uo.getname('finditem')
  uo.print('Voce tem: '+n)
  if not uid==uo.getserial('backpack') then
   uo.exec('showjournal 1')
  endif
  uo.ignore('finditem')
  uo.findtype('0x1BDD','-1',uid)
  l=l-1
 wend
 uo.ignorereset()
endsub

sub recall(runa)
 var px=uo.getx('self'),py=uo.gety('self'),timer
 timer=uo.timer() + 80
 if runa=='runa' then
  uo.cast('Recall','finditem')
 else
  uo.exec(runa)
 endif
 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 irarvore(x,y)
dim key[8]
key[0] = '383933'
key[1] = '383739'
key[2] = '394034'
key[3] = '373840'
key[4] = '403735'
key[5] = '403937'
key[6] = '373836'
key[7] = '394038'
var myX,myY,t=0,d,d2,z,m=0,mydir
repeat
 myX=uo.getX();
 myY=uo.getY();
 if x==myX then
  if y>myY then
    uo.Press(35)
  endif
  if y<myY then
    uo.Press(33)
  endif
 else
  if x<myX then
   if y==myY then
    uo.Press(36)
   else
    if y<myY then
     uo.Press(38)
    endif
    if y>myY then
     uo.Press(37)
    endif
   endif
  endif
  if x>myX then
   if y==myY then
    uo.Press(34)
   else
    if y<myY then
     uo.Press(39)
    endif
    if y>myY then
     uo.Press(40)
    endif
   endif
  endif
 endif
 if uo.getx()==myX and uo.gety()==myY then
  if t==4 then
   t=0
   mydir=uo.getdir()
   d=val(MID(key[mydir],0,2))
   d2=val(MID(key[mydir],2,2))
   for z=1 to 4
    uo.press(d)
   next
   if uo.getx()==myX and uo.gety()==myY then
    for z=1 to 3
     uo.press(d2)
    next
   endif
  else
   t=t+1
  endif
 endif
 wait(70)
endif
until (num(x-uo.getx())<=1 and num(y-uo.gety())<=2) or (num(x-uo.getx())<=2 and num(y-uo.gety())<=1)
end sub

sub num(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

sub perigo()
var t1=0,t2=0,t3=0,t4=0
repeat
 if t1 < uo.timer() then
  uo.msg('guards')
  t1=UO.Timer() + 10
 endif
 if uo.poisoned('self') then
  if t2 < uo.timer() then
   uo.cast('Cure','self')
   t2=UO.Timer() + 25
   wait(100)
  endif
 else
  if t3< uo.timer() then
   uo.bandageself()
   wait(120)
   t3=UO.Timer() + 70
  endif
 endif
 if uo.life < 75 then
  if t4 < uo.timer() then
   uo.msg('.drinkheal')
   t4=UO.Timer() + 160
   wait(100)
  endif
 endif
 wait(20)
until uo.life>=uo.str
uo.exec('exec guards')
end sub

sub guards()
var i
for i=1 to 6
uo.msg('guards')
wait(1000)
next
endsub
#------------------START LUMBER SCRIPT-----------------


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

All times are UTC+02:00


Who is online

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