хелп со скриптом на мининг =)
Posted: 2008-03-31 14:30:05
помогите плиз со скриптом... он должен сначала спросить 6 точек в пещере, записать их в файл... потом ходить по ним.. но.. гора ошибок и не чего более...
был бы очень благодарен... а то не чего в голову не идет
Code: Select all
sub mining()
FindTile()
end sub
###############################################################
################ поиск тайлов #################################
###############################################################
sub FindTile()
var flag=0
var count
var i
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"
dim TileX[6], TileY[6], TileT[6]
UO.print('Выберите рунку для рекола')
uo.exec('addobject rune')
while uo.targeting()
wait(100)
wend
uo.print("Выберите кирку")
uo.exec('addobject kirka')
while uo.targeting()
wait(100)
wend
###############################################
uo.print("Собираем координаты")
for i=0 to 6
uo.useObject("kirka")
uo.deleteJournal()
count = 0
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
TileX[count] = uo.lastTile(1)
TileY[count] = uo.lastTile(2)
tileT[count] = uo.lastTile(0)
## if uo.Lasttile(1)==uo.getX() and uo.Lasttile(2)==uo.gety() then
## uo.print("Анализ окончен, найдено:"+str(count)+" тайлов")
## flag=1
## end if
count = count + 1
SaveToFile(count,TileX,TileY,TileT)
uo.print("Найден тайл с координатами x:"+str(TileX)+" y:"+str(TileY))
end if
next
#####################################
while 1==1
for i=1 to count
uo.Print('Идем к тайлу '+str(i))
flag=GotoXY(TileX[i],TileY[i])
obkobka()
next
wend
end sub
#################################################################
################ сохранение в файл ##############################
#################################################################
sub SaveToFile(count,TileX,TileY,TileT)
var file=file("c:\test.dat") ## путь к файлу в который записываются координаты
var s=0, i=0
f.open()
f.create()
s=safe call f.write(count)
for i=1 to count
s=safe call f.writeln(str(TileT[i])+' '+str(TileX[i])+' '+str(TileY[i]))
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 obkopka()
var mx, my, mz, i, j
mx = UO.GetX("self")
my = UO.GetY("self")
mz = UO.GetZ("self")
for i = mx-2 to mx+2
for j = my-2 to my+2
hidding()
UO.Print("Копаем в координатах: "+str(mx-i)+" "+str(my-j))
while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock") and not UO.InJournal("Iron Ore") and not UO.InJournal("Copper") and not UO.InJournal("Rusty Ore")
UO.DeleteJournal()
if uo.waiting() then
uo.canceltarget()
endif
uo.findman( -1 )
if uo.findcount() then
recal()
uo.exec('terminate mining')
endif
UO.Waittargettile("1341", str(i), str(j), str(mz))
uo.usetype('0x0E85')
while not UO.InJournal("You put") and not UO.InJournal("heavy") and not UO.InJournal("location") and not UO.InJournal("no ore") and not UO.InJournal("but fail") and not UO.InJournal("far away") and not UO.InJournal("in rock") and AntiMacro()
wait (1000)
if uo.weight>600 then
recal()
endif
uo.findman( -1 )
if uo.findcount() then
recal()
uo.exec('terminate all')
endif
wend
wend
UO.DeleteJournal()
next
next
hidding()
end sub
###########################################################################
sub hidding()
while not uo.Hidden()
uo.WarMode("0")
uo.print('Прячемся')
uo.UseSkill("Hiding")
wait(3500)
wend
end sub
###########################################################################
sub recal()
if uo.waiting() then
uo.canceltarget()
endif
uo.print ("Сьбываемся")
uo.waittargetobject('rune')
uo.cast('Recall')
wait(3500)
uo.exec('terminate all')
end sub
####################################################################################################################
sub DoubleCheck()
dim reindex[8]
reindex[0] = 11
reindex[1] = 12
reindex[2] = 13
reindex[3] = 10
reindex[4] = 16
reindex[5] = 14
reindex[6] = 17
reindex[7] = 15
var GumpID = 0
var ButtonID = 0
var ButtonText
for var i = 18 to 19
GumpID = val(Mid(uo.LastGump('command', i), 16, 4))
ButtonID = reindex[GumpID-2225]
ButtonText = uo.LastGump('command', ButtonID)
uo.LClick(Val(Mid(ButtonText, 7, 3)), Val(Mid(ButtonText, 11, 3)))
repeat
wait(500)
until uo.LastGump('text', 4) <> "0"
next
end sub
sub AntiMacro()
if not uo.LastGump('replyed') then
if uo.LastGump('text', 0) == 'Antimacros System' then
DoubleCheck()
return 0
end if
end if
return 1
end sub
был бы очень благодарен... а то не чего в голову не идет