Yoko

All sides of Injection
It is currently 2025-10-30 00:15:26

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2007-04-26 20:55:29 
Offline

Joined: 2006-11-25 17:44:44
Posts: 258
Вот такой вот скрипт на ламбер.Играю на Зулу.Чар рубит долго и упорно, но в какой то момент он подходит к следущему дереву и говорит "You must equipt that to lumberjack".И стоит, тупит, пока дважды не жмакнешь по топору, что в руке.И дальше все остальные деревья рубит с такими же претензиями, пока скрипт не перезапустишь.С чем это может быть связано и как решить?
Code:
####################################
### Lumberjacking / Рубка деревьев  #### #######
####################################
### По мотивам реавторского скрипта BETEPAHА ###
####################################
##################
### Переменные ######
##################
var f=file("C:\trees3.dat") ## - Путь к файлу в котором будут хранится координаты деревьев.
###
###
var GetFromFile=1 ## 1 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
### (сначала соберите а потом считывайте из файла).
###
###
var TypeFood='0x097E' ## - Тип еды которую будем кушать.(сейчас фиштейки)
###########
### Код ###
###########
sub Axa()
var i
for i=0 to 20
 Lumberjacking()
next
end sub
###################################
##################################
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=324,TopY=65
dim TreeX[5000], TreeY[5000],TreeT[5000]
dim TreeTile[29]
var flag=0,treeCount=0,clicks=0,flag2=0
var Axe='0x0F43'

########################
### Графика деревьев ###
########################
TreeTile[0]=3277
TreeTile[1]=3280
TreeTile[2]=3283
TreeTile[3]=3286
TreeTile[4]=3289
TreeTile[5]=3291
TreeTile[6]=3294
TreeTile[7]=3296
TreeTile[8]=3299
TreeTile[9]=3302
TreeTile[10]=3393
TreeTile[11]=3394
TreeTile[12]=3395
TreeTile[13]=3396
TreeTile[14]=3415
TreeTile[15]=3416
TreeTile[16]=3417
TreeTile[17]=3418
TreeTile[18]=3419
TreeTile[19]=3438
TreeTile[20]=3439
TreeTile[21]=3440
TreeTile[22]=3441
TreeTile[23]=3442
TreeTile[24]=3460
TreeTile[25]=3461
TreeTile[26]=3462
TreeTile[27]=3290
TreeTile[28]=3288

uo.Exec("filterspeech on")
uo.Exec("filterspeech add 'Where do you want to use the pickaxe?'")

#####################################
### Загружаем координаты из файла ###
#####################################
if GetFromFile==1 then
uo.Print('Zagrujaem koordinaty iz faila...')
f.open()
treeCount=safe call f.ReadNumber()
for i=1 to treeCount
TreeT[i]=safe call f.ReadNumber()
TreeX[i]=safe call f.ReadNumber()
TreeY[i]=safe call f.ReadNumber()
next
f.close()
else
######################################
### Собираем координаты из клиента ###
######################################
uo.Print('Vyberite kirku ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print("Sobiraem koordinaty derev'ev v okruge...")
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Кликаем на тайл ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
wait(2000)
uo.DeleteJournal()
###############################
### Проверяем дерево ли это ###
###############################
flag=0
for k=0 to 28
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 28
if uo.LastTile(0)==TreeTile[k] then
flag=1
end if
next
end if
if uo.Lasttile(1)==uo.getX() and uo.Lasttile(2)==uo.gety() then
flag=3
end if
#########################
### Кликнули на ствол ###
#########################
if flag==1 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
TreeY[treeCount]=uo.LastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.Print('Naideno derevo '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))+' '+str(treeCount))
end if
end if
##########################
### Кликнули по листве ###
##########################
if flag==2 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
TreeY[treeCount]=uo.LastTile(2)
TreeT[treeCount]=uo.LastTile(0)-1
uo.print('Найдено дерево '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
end if
end if
until (Flag==3) or (treeCount==500)
uo.Exec("filterspeech off")
uo.Print('Analiz zakonchen, koordinaty derev-ev zapisany v fail C:\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Деревьев найдено: '+str(treeCount))
wait(2000)
######################################
### Ходим по собранным координатам ###
######################################
while 1==1
  if treeCount>0 then
    for i=1 to treeCount
     
 
     uo.Print('Idem k derevu '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
     InfoLogs()
     flag=Gotoxy(TreeX[i],TreeY[i])
     if flag==1 then
       GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ()))
     end if
   next
  end if
wend
end sub

sub Pause()
UO.DeleteJournal()
uo.useskill('Hiding')
 while NOT uo.stamina==uo.dex
  wait(5000)
  uo.print('paused for refreshion')
wend
uo.print('Continued...')
end sub

Sub GetTree(Type,X,Y,Z)
var i,t
var maxt = 1000
t=uo.timer()
uo.Print('Nachimaem rubru dereva...')
uo.WaitTargetTile(Type,X,Y,Z)
uo.usetype('Axe')
while NOT (uo.injournal('You stop lumberjacking') or uo.injournal('There is no wood left there') or uo.injournal('That is too far away') or ((t + maxt) < UO.Timer()))
    uo.print('stoim, tupim...')
    wait(1000)
wend   
uo.deletejournal()
return 0
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 WaitForChangeXY(myX,myY,lastX,lastY)
for var i=1 to 50
if lastX<>myX or lastY<>myY then
return 1
end if
wait(200)
next
return 0
end sub

Sub Gotoxy(x,y)
var myX,myY,lastX=0,lastY=0,i,halt=0,z,r=0
for i=1 to 60
if uo.stamina<10 then
uo.print('Nado by otdohnut')
ToEat()
pause()
end if
myX=uo.getX();
myY=uo.getY();
if LastX==myX and LastY==myY then
halt=halt+1
else
halt=0
end if
if halt>=10 then
if uo.GetDir()==1 then
for z=0 to 8
uo.Press(40)
next
end if
if uo.GetDir()==3 then
for z=0 to 8
uo.Press(37)
next
end if
if uo.GetDir()==5 then
for z=0 to 8
uo.Press(38)
next
end if
if uo.GetDir()==7 then
for z=0 to 8
uo.Press(39)
next
end if
halt=15
end if
if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
return 1
end if
if x<=myX then
if y<=myY then
for z=0 to 3
uo.Press(38)
next
else
for z=0 to 3
uo.Press(37)
next
end if
else
if y<=myY then
for z=0 to 3
uo.Press(39)
next
else
for z=0 to 3
uo.Press(40)
next
end if
end if
lastX=myX
lastY=myY
wait(200)
next
return 0
end sub

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

Sub SaveToFile(treeCount,TreeX,TreeY,TreeT)
var f=file("C:\trees3.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[i])+' '+str(TreeX[i])+' '+str(TreeY[i]))
next
f.close()
end sub

Sub ToEat()
uo.deletejournal()
uo.FindType(TypeFood)
if uo.FindCount()>0 then
 repeat
   uo.UseType(TypeFood)
   wait(1000)
 until uo.InJournal('stuffed!')
else 
 uo.print('a edy to i netu!')
end if
end sub

Sub CheckLag()
if uo.Waiting()>0 then
uo.Exec('canceltarget')
end if
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(50)
until uo.InJournal('backpack')
end sub



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 8 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