Page 1 of 1

Народ помгите в вопросе с минингом на НДВ

Posted: 2010-05-07 07:26:54
by KpuMu
Подправьте пожалуйста, чар при врезании в стену впереди своего пути становится и копает только то место где стопорнулся. И если можно вставьте чтоб он шел не только вперед но и возвращался.

Вот сам скрипт

UO.Set('finddistance','1')
UO.Set('distance','1')

sub main ()
var i, x, y, z, t, x1, y1, down, pick
UO.DeleteJournal ()

UO.Print ("select place to mine")
UO.infotile ()
wait (1000)
t=UO.lasttile (0)
z=UO.lasttile (3)

down = 1

UO.unequip ("Rhand")
wait (1000)
UO.FindType ("0x0E85")
wait (1000)
pick = UO.GetSerial ("finditem")
UO.equip ("Rhand", pick)

while not UO.Dead ()

UO.DeleteJournal ()
x=UO.GetX ()
y=UO.GetY ()

UO.exec ("waittargettile '" + str(t) + "' '" + str(x) + "' '" + str(y) + "' '" + str(z) + "'")
UO.useobject (pick)

while not UO.inJournal ("no more ore") and not UO.inJournal ("tool broke") and not UO.InJournal ("stop mining")and not UO.InJournal ("You cannot mine that") and not UO.inJournal ("cannot see that") and not UO.inJournal ("far away")
wait (1000)
if UO.InJournal ("element") then
UO.ServerPrint ("die")
endif
wend

if UO.InJournal ("tool broke") then
UO.FindType ("0x0E85")
wait (1000)
pick = UO.GetSerial ("finditem")
UO.equip ("Rhand", pick)
endif

x1=x+down
y1=y
repeat:
gotoxy (x1, y1, 0)

carry ()

x=UO.GetX ()
y=UO.GetY ()

if x<>x1 or y<>y1 then
if not UO.InJournal ("You are too fatigued to move") then
y=y+1
gotoxy (x, y, 0)
down=-down

carry ()

wait (1000)
UO.findtype ("ore", -1, 1)
UO.grab (60000, "finditem")
wait (1000)

hungry()
wait (1000)
endif
else
wait (1000)
endif
endif
wend
theend:
end sub

sub carry ()
UO.findtype (0x19B9, 0x094A, 1)
UO.grab (60000, "finditem")
wait (300)
end sub

sub take ()
while not UO.Dead ()
UO.findtype (0x19B9, 0x094A, 1)
UO.grab (60000, "finditem")
wait (300)
wend
end sub

sub gotoxy(x,y,prec)
var ld=0,ldc=0
var dx,dy
var mx,my
var ox,oy,mk,k
#uo.print(">")
#uo.track("1",str(x),str(y))
start:
mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if
if dx<=prec then
return
end if
if not ldc then
uo.print(STR(dx))
end if
if dx<3 then
mk=70
else
mk=15
end if

ox=mx
oy=my
for k=1 to mk
mx=UO.GetX()
my=UO.GetY()
if mx<>ox or my<>oy then
goto sdidapl
end if
wait(10)
next
sdidapl:

mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if

if dx<=prec then
return
end if
if ld==dx then
ldc=ldc+1
if ldc>15 then
uo.print("Can not reach location!")
return
end if
else
ld=dx
end if

if mx==x then
if my==y then
return
endif
if my>y then
#UO.Print("UR")
UO.Press(33)
goto start
endif
#UO.Print("DL")
UO.Press(35)
goto start
end if
if mx<x then
if my>y then
#UO.Print("R")
UO.Press(39)
goto start
endif
if my==y then
#UO.Print("DR")
UO.Press(34)
goto start
endif
#UO.Print("D")
UO.Press(40)
goto start
end if
if my<y then
#UO.Print("L")
UO.Press(37)
goto start
endif
if my==y then
#UO.Print("LU")
UO.Press(36)
goto start
endif
#UO.Print("U")
UO.Press(38)
goto start
end sub

sub hungry()
var GHS, Hung_i, Meal
GHS = 0
Meal = '0x097b'
GHS = GetHungryStatus()
UO.TextPrint('GHS = '+STR(GHS))
If (GHS > 1) then
For Hung_i = 0 To (GHS - 2)
Eat(Meal)
Wait(350)
Next
EndIf
end sub

sub Eat(wtEat)
If UO.Count(wtEat) then
UO.UseType(wtEat)
else
If UO.CountGround(wtEat) then
UO.UseFromGround(wtEat)
else
UO.Print('No meal found.')
endif
endif
end sub

sub GetHungryStatus()
VAR Ret_i, Cycle_i, LastStr
DIM HArr[11]
HArr[0] = "You are absolutely stuffed!"
HArr[1] = "You are stuffed"
HArr[2] = "You aren't hungry at all"
HArr[3] = "You are a little hungry"
HArr[4] = "You are somewhat hungry"
HArr[5] = "You are REALLY hungry"
HArr[6] = "Your stomash hurts"
HArr[7] = "Your stomash hurts and you feel dizzy"
HArr[8] = "You are starving"
HArr[9] = "You are almost dying of hunger"
HArr[10] = "You are DYING of hunger..."
UO.DeleteJournal()
UO.ServerPrint(".hungry")
Ret_i = 0
Cycle_i = 0
Wait(400)
For Cycle_i = 0 To 10
If CheckMsg(HArr[Cycle_i],'System') Then
Ret_i = Cycle_i
EndIf
Next
RETURN Ret_i
end sub

sub CheckMsg(cMsg, Spirit)
var ij
ij = UO.InJournal(cMsg)
if ij Then
if (UO.JournalSerial(ij+1) == Spirit) then
return ij+1
else
if (Spirit == 'System') and (UO.JournalSerial(ij+1) == '0x01010101') then
return ij+1
endif
endif
else
return 0
endif
end sub




И еще 1 проблема когда вылазиет элемент он начинает кричать пока не перейдет на другой таил. В чем проблема?