Вопрос по скрипту (Мининг)

Ask for scripts here

Moderators: Murderator+, Murderator

Post Reply
Nightmare
Posts: 10
Joined: 2009-01-09 23:44:28
Contact:

Вопрос по скрипту (Мининг)

Post by Nightmare »

Code: Select all

sub collecting() 

var i,s=0,flag=0
var f=file("C:\rock2.txt")
dim RockX[500],RockY[500],RockT[500]
var Count=0

while not flag ==1
 
   uo.usetype ('0x0E85')
   WaitForTarget()
   
   while uo.targeting()
   wait(100)
   wend
   
   if  uo.LastTile(1)==UO.GetX("self") then
      if uo.lastTile(2)==UO.GetY("self")  then
         flag=1
      endif
   endif

   
   if flag == 0 then
      RockX[Count]=uo.LastTile(1)
      RockY[Count]=uo.lastTile(2)
      RockT[Count]=uo.LastTile(0)
      uo.print('Найдена кочка № '+str(count)+': x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
       

      Count = Count+1
   
   endif
   
   
wend


uo.print ("Найдено " + str(Count) + " кочек")
#################################################
################Запись в файл####################
#################################################

f.open()
f.create()
s=safe call f.writeln(Count)
   for i=0 to Count-1
   s=safe call f.writeln(str(RockT[i])+' '+str(RockX[i])+' '+str(RockY[i]))
   next
f.close()

#################################################
#################################################
#################################################


end sub



#################################################
#################################################
#################################################
#################################################
#################################################
#################################################


sub mining()

var i,flag,j
var Count
var f=file("C:\rock2.txt")
dim RockX[500],RockY[500],RockT[500]
uo.deletejournal()

#################################################
###############Загружаем из файла################
#################################################

uo.print('Загружаем координаты из файла...')
f.open()
Count=safe call f.readNumber()

uo.print("Загружено "+str(Count)+ " кочек")

for i=0 to Count-1
RockT[i]=safe call f.ReadNumber()
RockX[i]=safe call f.ReadNumber()
RockY[i]=safe call f.ReadNumber()
next
f.close()


#################################################
###############Ходим по координатам##############
#################################################

while UO.Weight<650
uo.deletejournal()
   if Count>0 then
   for i=0 to Count-1
      flag=0
      j=0
      uo.print('Идем к кочке '+str(i)+': x='+str(Rockx[i])+' y='+str(RockY[i]))

      while not flag==1
         flag=gotoxy(RockX[i],RockY[i])
         wait (1000)
      wend
       
      while not uo.Hidden('self')
         UO.UseSkill('Hiding')
         wait (2000)
      wend
       
uo.deletejournal()
 GetRock(str(RockT[i]),str(RockX[i]),str(RockY[i]),str(uo.getz()))
       
   next
   endif
wend

uo.print ("Выкопано")   

end sub


##################################################################

sub GetRock(tile,x,y,z)

uo.print('Начинаем копку...')

while not UO.InJournal("Try") and not UO.InJournal("location") and not UO.InJournal("Попробуйте") and not UO.InJournal("far away") and not UO.InJournal("nothing") and not UO.InJournal ("Тут не осталось руды") and not UO.InJournal("дотянуться")
   uo.deletejournal()
   UO.Waittargettile(tile,x,y,z)
   uo.print ("Используем кирку...")
   UO.Usetype("0x0E85")
             
   while not UO.InJournal("You put") and not UO.InJournal("location") and not UO.InJournal("Попробуйте") and not UO.InJournal("дотянуться") and not UO.InJournal("no ore") and not UO.InJournal ("Тут не осталось руды") and not UO.InJournal("but fail") and not UO.InJournal("nothing") and not UO.InJournal("Try")
      wait (1000)
   wend
wend



end sub
##########################################
#############Дополнительные###############
################Функции###################
##########################################


sub abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
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 WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub


Суть скрипта в том что нужно замаркать точки и патом можно начинать копать.... Я замаркал точки, начинаю капать... С первой точки чар выкапывает всю руду и на ней так и заступоревается... к следующей точки переходить не желает... Помогите пожалуйста разобраться в чем проблема...
Botinokk
Posts: 62
Joined: 2006-09-08 04:46:12

Post by Botinokk »

Code: Select all

sub collecting() 

var i,s=0,flag=0
var f=file("D:\_GAMES\Uo\Inject\rock.txt")
dim RockX[500],RockY[500],RockT[500]
var Count=0

while not flag ==1
 
   uo.usetype ('0x0E85')
   WaitForTarget()
   
   while uo.targeting()
   wait(100)
   wend
   
   if  uo.LastTile(1)==UO.GetX("self") then
      if uo.lastTile(2)==UO.GetY("self")  then
         flag=1
      endif
   endif

   
   if flag == 0 then
      RockX[Count]=uo.LastTile(1)
      RockY[Count]=uo.lastTile(2)
      RockT[Count]=uo.LastTile(0)
      uo.print('Найдена кочка № '+str(count)+': x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
       

      Count = Count+1
   
   endif
   
   
wend


uo.print ("Найдено " + str(Count) + " кочек")
#################################################
################Запись в файл####################
#################################################

f.open()
f.create()
s=safe call f.writeln(Count)
   for i=0 to Count-1
   s=safe call f.writeln(str(RockT[i])+' '+str(RockX[i])+' '+str(RockY[i]))
   next
f.close()

#################################################
#################################################
#################################################


end sub



#################################################
#################################################
#################################################
#################################################
#################################################
#################################################


sub mining()

var i,flag,j
var Count
var f=file("D:\_GAMES\Uo\Inject\rock.txt")
dim RockX[500],RockY[500],RockT[500]
uo.deletejournal()

#################################################
###############Загружаем из файла################
#################################################

uo.print('Загружаем координаты из файла...')
f.open()
Count=safe call f.readNumber()

uo.print("Загружено "+str(Count)+ " кочек")

for i=0 to Count-1
RockT[i]=safe call f.ReadNumber()
RockX[i]=safe call f.ReadNumber()
RockY[i]=safe call f.ReadNumber()
next
f.close()


#################################################
###############Ходим по координатам##############
#################################################

while UO.Weight<650
uo.deletejournal()
   if Count>0 then
   for i=0 to Count-1
      flag=0
      j=0
      uo.print('Идем к кочке '+str(i)+': x='+str(Rockx[i])+' y='+str(RockY[i]))

      while not flag==1
         flag=gotoxy(RockX[i],RockY[i])
         wait (1000)
      wend
       
       
uo.deletejournal()
 GetRock(str(RockT[i]),str(RockX[i]),str(RockY[i]),str(uo.getz()))
       
   next
   endif
wend

uo.print ("Выкопано")   

end sub


##################################################################

sub GetRock(tile,x,y,z)

uo.print('Начинаем копку...')

while not UO.InJournal("Try") and not UO.InJournal("location") and not UO.InJournal("Попробуйте") and not UO.InJournal("far away") and not UO.InJournal("There is no ore here to mine.") and not UO.InJournal ("Тут не осталось руды") and not UO.InJournal("дотянуться") and not UO.InJournal("You put the iron ores in your pack.")
   uo.deletejournal()
   UO.Waittargettile(tile,x,y,z)
   uo.print ("Используем кирку...")
   UO.Usetype("0x0E85")
             
   while not UO.InJournal("You put") and not UO.InJournal("location") and not UO.InJournal("Попробуйте") and not UO.InJournal("дотянуться") and not UO.InJournal("There is no ore here to mine.") and not UO.InJournal ("Тут не осталось руды") and not UO.InJournal("but fail") and not UO.InJournal("nothing") and not UO.InJournal("Try") and not UO.InJournal("You put the iron ores in your pack.")
      wait (1000)
   wend
wend



end sub
##########################################
#############Дополнительные###############
################Функции###################
##########################################


sub abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
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 WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub



Попробуй мой,он у меня правда сломался почемуто )) но мож у тя начнет работать.
Botinokk
Posts: 62
Joined: 2006-09-08 04:46:12

Post by Botinokk »

а в итоге найди sub GetRock(tile,x,y,z)

и поменяй на ниже указал,все будет работать,а вообще макрос хреновый очень хреновый,ходилка не очем ваще,если макрос сбивается то все запускай заново и то не факт что он будет корректно работать.



Code: Select all

sub GetRock(tile,x,y,z) 

uo.print('Начинаем копку...')

while not UO.InJournal("Try") and not UO.InJournal("location") and not UO.InJournal("Попробуйте") and not UO.InJournal("far away") and not UO.InJournal("There is no ore here to mine.") and not UO.InJournal ("Тут не осталось руды") and not UO.InJournal("дотянуться") and not UO.InJournal("You put the iron ores in your pack.")
   uo.deletejournal()
   UO.Waittargettile(tile,x,y,z)
   uo.print ("Используем кирку...")
   UO.Usetype("0x0E85")
             
   while not UO.InJournal("You put") and not UO.InJournal("location") and not UO.InJournal("Попробуйте") and not UO.InJournal("дотянуться") and not UO.InJournal("There is no ore here to mine.") and not UO.InJournal ("Тут не осталось руды") and not UO.InJournal("but fail") and not UO.InJournal("nothing") and not UO.InJournal("Try") and not UO.InJournal("You put the iron ores in your pack.")
      wait (1000)
   wend
wend



end sub
Nightmare
Posts: 10
Joined: 2009-01-09 23:44:28
Contact:

Post by Nightmare »

Спасибо тебе скрипт ожил, а есть еще один вопрос.... бывают места где чар неуспевает выкопать руду ну там пиши чтото типа "...you loosen some rock's".... Может быть в скрипте можно увеличить задержку между капанием ?
Post Reply