Yoko

All sides of Injection
It is currently 2025-12-23 20:27:17

All times are UTC+02:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 2006-08-20 05:52:46 
Offline

Joined: 2006-08-02 06:17:59
Posts: 3
Why this script is saving me the all the tiles for target the trees in the file al in 1 x y and z like this:

1 1 1
1 1 1
1 1 1

Code:
sub Lumber()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=0,TopY=0
dim TreeX[100], TreeY[100],TreeT[100]
dim TreeTile[100]
var flag=0,treeCount=0,clicks=0,flag2=0
var f=file("C:\arboles.dat")  ## archivo donde guarda los arboles

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var Treesnum=5 ## Numero de arboles para una ruta nueva maximo 100
var GetFromFile=0 ## 0 para crear primero una nueva  ruta, 1 para que lea una ruta ya guardada.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
uo.print('Selecciona tu hacha')
uo.exec('addobject hacha')
while uo.targeting()
wait(100)
wend

uo.print('Selecciona tu daga')
uo.exec('addobject daga')
while uo.targeting()
wait(100)
wend

if GetFromFile==1 then
uo.print('Recuperando datos de archivo')
f.open()
TreeCount=safe call f.readNumber()
for i=1 to TreeCount
TreeT=safe call f.ReadNumber()
TreeX=safe call f.ReadNumber()
TreeY=safe call f.ReadNumber()
next
f.close()
else

uo.print('Selecciona los arboles de 1 en 1...')

for i=1 to Treesnum

uo.DeleteJournal()
uo.useobject('daga')
WaitForTarget()
while uo.targeting()
wait(100)
wend

treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.lastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.print('Nuevo arbol añadido: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))

next
uo.print('Ruta completa. Coordenadas salvadas en C:\arboles.dat')
guardarruta(treeCount,TreeX,TreeY,TreeT)

end if
uo.print('Arboles totales: '+str(treeCount))
wait(2000)

while 1==1
if treeCount>0 then
   for i=1 to treeCount
      uo.print('Camino al arbol '+str(i)+': x='+str(treex)+' y='+str(treey))
      #move(treex+1,treey+1)
      move(treex,treey)
      talar(str(treeT),str(treeX),str(TreeY))
   next
end if
wend
end sub


sub guardarruta(TreeCount,TreeX,TreeY,TreeT)
var f=file("C:\arboles.dat")
var s=0,i=0
f.open()
f.create()
s=safe call f.writeln(TreeCount)
for i=1 to TreeCount
s=safe call f.writeln(str(TreeT)+' '+str(treeX)+' '+str(TreeY))
next
f.close()
end sub

sub WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub

sub talar(t,x1,y1)
var a=0
uo.deletejournal()
while a < 7
if UO.InJournal('There are no logs here to chop') then
   a=8
   uo.deletejournal()
end if
if a < 7 then

uo.waittargettile(t,x1,y1,0)
wait(1600)

uo.useobject('hacha')
wait(7000)
a = a + 1
end if
wend

end sub



sub Move(x,y)
  var cx,cy,e=0,dir=1,M="-40-231-657"
  while dir<>0
     cx=uo.getx()
     cy=uo.gety()
     dir=(cy<y)+2*(cy>y)+4*(cx<x)+8*(cx>x)
     if dir<>0 then
        MoveK(val(M[dir]))
        if cx==uo.getx() && cy==uo.gety() then
           e=e+1
           if e>=2 then
              stack_solving()
           endif
           if e==40 then
              return 0
           endif
          else
             e=0
        endif
     endif
  wend
  return 1
endsub

sub MoveK(dir)
  var x,y,time,Key="06172435"
  if UO.GetDir()<>dir then
     UO.Press(val(Key[dir])+33)
     time=500
     if UO.GetDir()<>dir then
        if time==0 then
           return 0
        endif
        wait(5)
        time=time-5
     endif
  endif
  x=UO.GetX()
  y=UO.GetY()
  time=500
  UO.Press(val(Key[dir])+33)
  while x==UO.GetX() && y==UO.GetY() && time>0
     time=time-5
     wait(5)
  wend
  return time>0   
end sub
sub stack_solving()
        uo.press(38)
        uo.press(38)
        uo.press(37)
   uo.press(37)
   uo.press(38)
        uo.press(38)
        uo.press(39)
        uo.press(39)
end sub



sub main()
lumber()
end sub










Top
   
 Post subject:
PostPosted: 2006-08-20 11:45:29 
Offline
Expert!
User avatar

Joined: 2005-09-14 15:31:58
Posts: 2152
Location: Latvia
you mean he saves nothing ? only "1 1 1" ? I guess then you have some errors in script.
if he saves normal numbers with cord. X Y and Z then you have nothing to worry about, the script will walk and chop by those cordinates...

_________________
Уроки языка Injection
Основные команды языка Injection
Yoko Injection Code Sweeper
Drw (2009) скрипты
2017 Начал играть на Uorpg.net


Top
   
 Post subject:
PostPosted: 2006-08-20 17:04:02 
Offline

Joined: 2006-08-02 06:17:59
Posts: 3
yes is saving like this and i can't find the mistake:

Code:
5   #number of trees
1 1 1  #number 1 x y z
1 1 1   #number 2  x y z
1 1 1  #number 3   x y z
1 1 1  #number 4   x y z
1 1 1   #number 5   x y z
 


Top
   
 Post subject:
PostPosted: 2007-08-20 00:50:43 
Offline

Joined: 2007-07-09 18:48:42
Posts: 54
Ребят переведите етот скрипт пожауйста! первый таргет на Топор, на что надо вешать втрой таргет и он у меня почему то у меня упорно кудато идёт (Camino al arbol 1: x=0 y=0). ПОдскажите что и где мне надо поменять что бы просто рубить !


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 4 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:  
Powered by phpBB® Forum Software © phpBB Limited