Yoko

All sides of Injection
It is currently 2025-12-04 10:46:28

All times are UTC+02:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 2006-12-25 12:07:06 
Offline

Joined: 2005-01-21 15:45:19
Posts: 31
Линия 209: Рантайм эррор - инваилд оперэйшн фор зыс тайп.
Code:
sub Lumber()
var i=0,j=0,k=0,r=0,q=0,ii,jj, a=0
var TopX=324,TopY=65                
dim TreeX[300], TreeY[300],TreeT[300]
dim TreeTile[300]
var flag=0,treeCount=0,clicks=0,flag2=0
var f=file("C:\trees.dat")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var Area=3       ## Размер обрабатываемой территории, можно менять от 1 до 4.

var TryHiding=0  ## 1 - перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет

var TryRecall=1  ## 1 - после того как соберет LogsQty логов, будет пытаться реколиться домой, складывать логи на пол и реколиться обратно (нужно выбрать две руны), 0 - не будет.   

var LogsQty=1250 ## Количество логов, добыв которое надо реколиться домой.

var RecallFromScroll=1 ## 1 - с рун, 0 - из рунбука

var GetFromFile=1 ## 1 - координаты деревьев будут считыватся из файла, 0 - собиратся из клиента

var Const=2 ## во сколько раз увеличивать размер тестовой территории (коэффициент)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

                              #Графика деревьев
TreeTile[0]=3283                              
TreeTile[1]=3277
TreeTile[2]=3293
TreeTile[3]=3296
TreeTile[4]=3302
TreeTile[5]=3299
TreeTile[6]=3290
TreeTile[7]=3288
TreeTile[8]=3286
TreeTile[9]=3280

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

uo.print('Выбери топор: ')
uo.exec('addobject axe')
wait(5000)

                              #Загружаем координаты из файла
if GetFromFile==1 then
   uo.print('Загружаем координаты из файла...')
   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()
end if
                              #Ходим по собранным координатам
while 1==1
   if treeCount>0 then
      for i=1 to treeCount
         if TryRecall==1 AND uo.Count('ZLK')>=LogsQty then
            ToRecall(RecallFromScroll)
         end if
         uo.print('Идем к дереву '+str(i)+': x='+str(treex[i])+' y='+str(treey[i]))         
         flag=gotoxy(treex[i],treey[i])
         if flag==1 then   
            if TryHiding==1 then
               ToHide()
            end if         
            GetTree(str(treeT[i]),str(treeX[i]),str(TreeY[i]),str(uo.getz()))
         end if         
      next
   end if
wend   
end sub

sub GetTree(type,x,y,z)
var i
   uo.print('Начинаем рубку дерева...')
   for i=0 to 30
      if uo.warmode()==1 then
         return 0
      end if
      wait(200)
      uo.deletejournal()
      uo.waittargettile(type,x,y,z)
      uo.useobject('axe')
      if WaitForChange()==1 then
         return 1
      end if   
   next
   return 0
end sub

sub ToRecall(FromScroll)
    RecallToHome(FromScroll)
    wait(1000)
    Unload()
    wait(1000)
end sub


sub RecallToHome(FromScroll)      
   var flagg=0
   var ff=file("C:\sunduk.dat")
   var treeCount=0
   var i
   dim TreeX[1], TreeY[1],TreeT[1]
   dim TreeTile[1]
                              #Загружаем координаты сундука из файла
   uo.print('Загружаем координаты сундука из файла...')
   ff.open()
   TreeCount=safe call ff.readNumber()
   for i=1 to TreeCount   
       TreeT[i]=safe call ff.ReadNumber()
       TreeX[i]=safe call ff.ReadNumber()       
       TreeY[i]=safe call ff.ReadNumber()       
    next   
   ff.close()
                              #идем к сундуку

   if treeCount>0 then
      for i=1 to treeCount
         uo.print('Идем к сундуку '+str(i)+': x='+str(treex[i])+' y='+str(treey[i]))         
         flagg=gotoxy(treex[i],treey[i])
         if flagg==1 then   
         unload()
         end if         
      next
   end if
   
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 WaitForChange()
var Text1=uo.getname()+': You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There is nothing here to chop.'
var Text3="You can't reach this."
var Text37="That is too far away."
var mess
   for var i=0 to 200
      mess=uo.journal(0)
      if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 OR uo.Journal(0)==Text37 then
         return 1
      end if   
      if uo.Journal(0)==Text1 then
         return 0
      end if         
      if mess[0]=='Y' AND mess[1]=='o' AND mess[2]=='u' AND mess[4]=='p' AND mess[5]=='u' AND mess[6]=='t' then
         return 0
      end if
      wait(50)
   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
      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 abs(x-myX)<=1 AND abs(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 abs(num)
   if num>=0 then
      return num
   else
      return num*(-1)
   end if
end sub   

sub main()
Lumber()
end sub

sub Unload()
var UnloadCont='0x40345722' #ID сейфа
VAR Exit, i
DIM Ore[5]
Ore[0]=0x1bdd
Ore[1]=0x1bdd
Ore[2]=0x1bdd
Ore[3]=0x1bdd

UO.SetReceivingContainer(UnloadCont) ; storecontainer
wait(500)


For i=0 to 3
Exit=0
repeat
UO.FindType(Ore[i])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
CheckLag()
wait(1500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
wait(3000)
end sub

sub CheckLag()
   UO.DeleteJournal()
   UO.Click('backpack')

      repeat
      wait(500)
   until UO.InJournal('backpack')
end sub

Плиз глянте, а то я на свой не опытный глаз ничего не заметил =(


Last edited by Deathclaw on 2006-12-26 12:01:03, edited 2 times in total.

Top
   
 Post subject:
PostPosted: 2006-12-25 18:26:57 
Offline

Joined: 2005-04-19 18:00:29
Posts: 2259
Location: Московская область
Строку бы вывел чтоли, в которой ошибка.

1ое предположение: Файл не существует,недоступен для чтения, защищён или информация которая в нём содержится не соответствует требуемой скрипту.

З.Ы. "Закрыв файл через close, вторично его открыть в данной сессии уже не получится".


Top
   
 Post subject:
PostPosted: 2006-12-26 12:02:47 
Offline

Joined: 2005-01-21 15:45:19
Posts: 31
Блин я хотел но не понял как выделить. Вообщем это в функции gotoXY(x,y)
а сама строчка это

Code:
   if abs(x-myX)<=1 AND abs(y-myY)<=2 then


Top
   
 Post subject:
PostPosted: 2006-12-28 10:40:26 
Offline

Joined: 2005-01-21 15:45:19
Posts: 31
Ну что поможете?
Да и ещё вопросег по какому принцыпу надо писать координаты деревьев в trees.dat . я потыкался, и на скольбко понял самое первое идёт число деревьев потом их координаты, я так сделал (только на 10 деревьев) и он начал считыват только перестал ходит, мне дали готовый на определённое место но я хочу по другому зхделать и ни как не получается, помогите плиз.


Top
   
 Post subject:
PostPosted: 2006-12-28 13:15:08 
Offline
User avatar

Joined: 2006-12-18 11:33:01
Posts: 44
Возми норм скрипт типо
Code:
  ############################################ 
### Lumberjacking /Drw    ###
############################################
###Dragon World / www.drw.ru       ###
############################################
### Переделал : Unfogiven       ###
############################################
##################
######
##################
###################################################################################################
var f=file("C:\trees3.dat") ## -Файл с координатоми  деревьев.
###
var TryHiding=0 ## Нужен хайд 0-нет 1-да .
###
var LogsQty=600 ## - Скоко логов чтоб летел домой
###
var GetFromFile=1 ## Брать координаты из файла  0-нет 1-да
###
###
var EatingFood=0 ## 1 - Кушать нодо? .   0-нет 1-да
###
var SSpeak=0 ## 1 -Исп. Спирит Спик  0-нет 1-да.
###
var TypeFood='0x097B' ## -Тип Еды
###
var Chest='0x401258E1' ## -ИД сундука для логов
###
var Trytodrop=1 ## Будеим ли сами идти к сундуку.
###
var ContX=1316 ##Кооадинаты Х сундука
###
var ContY=950 ##Координаты Y сундука
###
var oldX,oldY,time ## - Для реколла
###
###########
### Вот ###
###########
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
########################
### ###
########################
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?'")

uo.Print('De topor')
uo.Exec('addobject Axe')
while uo.Targeting()
wait(100)
wend

#####################################
###  ###
#####################################
if GetFromFile==1 then
uo.Print('Taks')
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('De topor 2')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print('Taks')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
##################
###############################
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('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('Derevo '+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('Àíàëèç çàêîí÷åí, êîîðäèíàòû äåðåâüåâ çàïèñàíû â ôàéë C:\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Derevo: '+str(treeCount))
wait(2000)
######################################
######
######################################
while 1==1
if treeCount>0 then
for i=1 to treeCount
end if
if Trytodrop==1 and uo.Count('ZLK')>=LogsQty then
GotoXY(uo.getx(Chest),uo.gety(Chest))
DropLogs()
end if
uo.Print('Derevo '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
InfoLogs()
flag=GotoXY(TreeX[i],TreeY[i])
if flag==1 then
if TryHiding==1 then
ToHide()
end if
GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ()))
end if
next
end if
wend
end sub

Sub GetTree(Type,X,Y,Z)
var i
uo.Print('Hide....')
for i=0 to 15
if uo.Warmode()==1 then
return 0
end if
wait(200)
uo.DeleteJournal()
uo.WaitTargetTile(Type,X,Y,Z)
uo.UseObject('Axe')
if WaitForChange()==1 then
return 1
end if
next
return 0
end sub

Sub ToHide()
if SSpeak==1 then
UO.Useskill('Spirit Speak')   
wait(3000)
endif
while not uo.Hidden()
uo.Print('Hide...')
uo.DeleteJournal()
uo.UseSkill('Stealth')
wait(3000)
wend
wait(100)
end sub


Sub WaitForHide()
var Text1=uo.GetName()+": You have hidden yourself well"
var Text2=uo.GetName()+": You can't seem to hide here."
var mess
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text1 then
return 1
end if
if uo.Journal(0)==Text2 then
return 0
end if
wait(50)
next
return 0
end sub

Sub WaitForChange()
var Text1=uo.GetName()+': You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There are no logs here to chop.'
var Text3="You can't reach this."
var Text4="That is too far away."
var Text5="You can't do much in your current state."
var mess
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' and mess[4]=='p' and mess[5]=='u' and mess[6]=='t' then
return 0
end if
wait(50)
next
return 0
end sub

Sub WaitForTryRock()
var Text1="That is too far away."
var Text2="Try mining in rock."
var Text3="There is no ore here to mine."
var Text4="You have no line of sight to that location"
var Text5="You can't see the target"
for var i=0 to 50
if uo.Journal(0)==Text1 or uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text5 then
return 1
end if
wait(200)
next
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
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 DropLogs()
if uo.Waiting() then
uo.CancelTarget()
end if
var a,Exit
dim Logs[1]
Logs[0]=0x1BDD
uo.Print('Kidaem.')
uo.SetReceivingContainer(Chest)
wait(500)
for a=0 to 0
Exit=0
repeat
uo.FindType(Logs[a])
if uo.GetQuantity('finditem')>0 then
uo.Grab('0','finditem')
wait(1500)
GotoXY(ContX,ContY)
uo.useobject("0x401258E1")
else
Exit=1
end if
until Exit==1
next
if EatingFood==1 then
EatingFood()
end if
uo.UnSetReceivingContainer(Chest)
uo.Print('Taks.')
end sub


Sub InfoLogs()
uo.Print(U nas'+str(uo.Count('0x1BDD'))+' U nas')
uo.Print('U nas'+str(uo.Count('0x1BDD','0x0000'))+' ïðîñòûõ è ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' öâåòíûõ')
end sub

Sub Open(Container)
uo.DeleteJournal()
uo.UseObject(Container)
repeat
wait(500)
until uo.InJournal('Contains')
end sub


Sub EatingFood()
ToEat()
DropFood()
end sub

Sub ToEat()
uo.SetReceivingContainer('backpack')
Open(Chest)
uo.FindType(TypeFood,'-1',Chest)
uo.Grab('50','finditem')
wait(500)
repeat
Checklag()
uo.UseType(TypeFood)
wait(1000)
until uo.InJournal('You are simply too full to eat any more!')
uo.UnsetReceivingContainer()
end sub

Sub DropFood()
if uo.Waiting() then
uo.CancelTarget()
end if
var f,Exit
dim Food[1]
Food[0]=TypeFood
uo.SetReceivingContainer(Chest)
wait(500)
for f=0 to 0
Exit=0
repeat
uo.FindType(Food[f])
if uo.GetQuantity('finditem')>0 then
uo.Grab('0','finditem')
wait(1500)
else
Exit=1
end if
until Exit==1
next
uo.UnSetReceivingContainer(Chest)
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


sub cheklag()
uo.deletejournal()
uo.click('backpack')
repeat
wait(10)
until uo.InJournal("backpack")
end sub

sub Reconnector()
var ReconnectTime, RFlag
ReconnectTime = '0'
RFlag = 1
Repeat
While (UO.ObjAtLayer('Bpack') == '')
if RFlag Then
ReconnectTime = MakeTime()
RFlag = 0
endif
Wait(20000) # WorldSave Protection
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.LDblClick(357,164)
UO.LClick(616,459)
Wait(3000)
WEnd
Wait(3000)
if (RFlag == 0) and (ReconnectTime <> '0') Then
wait(1000)
UO.TextOpen()
UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
RFlag = 1
ReconnectTime = '0'
endif
Until false
end sub

sub MakeTime()
VAR D, T, Ret, i
Ret = STR(UO.Time())
T = ""
For i = 0 To Len(Ret)
T = Ret[Len(Ret)-i] + T
If (I == 2) OR (I == 4) Then
T = ":" + T
EndIf
Next
Ret = STR(UO.Date())
D = ""
For i = 0 To Len(Ret)
D = Ret[Len(Ret)-i] + D
If (I == 2) OR (I == 4) Then
D = "." + D
EndIf
Next
Ret = T + " @ " + D
RETURN Ret
end sub


Прописоваешь координаты деревьев (не далеко от сейва).
И прописоваешь координаты (X,Y) сундкка.
Запускаешь,указываешь,рубишь.


Top
   
 Post subject:
PostPosted: 2007-01-25 10:14:39 
Offline

Joined: 2005-01-21 15:45:19
Posts: 31
Блин, сначал осказао что вариэйбл U аниндефинед,что бы как-то выкрутится кинул её к реколу (var oldX,oldY,time,U ## - для рекола) потом мне начало говорить что что-то не верно со строчкой

Code:
uo.Print(U nas'+str(uo.Count('0x1BDD'))+' U nas') 


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

All times are UTC+02:00


Who is online

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