подолжаю мучаться ....
вот скрипт на ходилку по координатам
Code:
sub mining()
var i,flag
var Count
var f=file("F:\rock1.txt")
dim RockX[500],RockY[500],RockT[500]
#################################################
###############Загружаем из файла################
#################################################
uo.print('Загружаем координаты из файла...')
f.open()
Count=safe call f.readNumber()
uo.print("Загружено "+str(Count)+ " кочек")
for i=0 to Count
RockT[i]=safe call f.ReadNumber()
RockX[i]=safe call f.ReadNumber()
RockY[i]=safe call f.ReadNumber()
next
f.close()
#################################################
###############Ходим по координатам##############
#################################################
for i=0 to Count
uo.print('Идем к кочке '+str(i)+': x='+str(RockX[i])+' y='+str(RockY[i]))
flag=gotoxy(RockX[i],RockY[i])
while not flag==1
wait (200)
wend
GetRock(str(RockT[i]),str(RockX[i]),str(RockY[i]),str(uo.getz()))
uo.print ("Выкопано")
next
end sub
##################################################################
sub GetRock(type,x,y,z)
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(type,x,y,z)
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
return 0
в этой строчке пишет что переменная уже определена
Code:
GetRock(str(RockT[i]),str(RockX[i]),str(RockY[i]),str(uo.getz()))
дополнительные функции ( может в них глюк ) :
Code:
##########################################
#############Дополнительные###############
################Функции###################
##########################################
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