Mining помогите
Posted: 2008-05-06 16:59:02
Code: Select all
sub minamine()
#константы
VAR Kirka = '0x0E85' ; Тип кирки
VAR MaxVes =6500
VAR TileNum = '2573' ; Тайл пещеры
#Переменные
VAR x, y, t, k, oldx, oldy, wh, togg
#Сообщения
VAR ms1 = "there is no more ore here to mine"
VAR ms2 = "Select a place to mine."
VAR ms3 = "You are too far away"
VAR ms4 = "You loosen some rocks"
VAR ms5 = "You put the"
VAR ms6 = "You have no line of sight to that location"
VAR ms7 = "your tool broke."
#Поехали!
while 1
wait(300)
oldx = uo.getx() #Запомним где мы: вдруг в тупике?
oldy = uo.gety()
UO.Set('quiet','1') #Заканали сообщения...
for y=-2 to 2
for x=-2 to 2
k = 0
repeat
UO.DeleteJournal()
t = UO.Timer()
k = k + 1
UO.CancelTarget()
wait(500)
UO.WaitTargetTile( TileNum, STR( UO.GetX() + x ), STR( UO.GetY() + y ), 0)
UO.UseType( Kirka )
repeat
wait(500)
until UO.InJournal(ms1) OR UO.InJournal(ms2) OR UO.InJournal(ms3) OR UO.InJournal(ms4) OR UO.InJournal(ms5) OR UO.InJournal(ms6) OR UO.InJournal(ms7)
If UO.Weight > MaxVes Then
; Фууу....
UO.Print(" Overweight!" )
return
Endif
until ( NOT UO.InJournal(ms4) AND NOT UO.InJournal(ms3) OR (k > 7) )
next
next
UO.Set('quiet','0') #Пошли?
uo.print( 'Ходилка задействована.') #Удобно для отладки...
wait(300)
oldx = uo.getx() #Еще раз на всякий.
oldy = uo.gety()
if wh == '1' then #Вправо
uo.press (33)
uo.press (33)
uo.press (33)
else #Влево
uo.press (35)
uo.press (35)
uo.press (35)
endif
wait(300)
if (uo.getx() == oldx) and (uo.gety() == oldy) then
uo.print('Тупик!')
if wh == '1' then #Переключить wh и сдвинуца вверх
uo.press(36)
uo.press(36)
uo.press(36)
wh = '0'
else
wh = '1'
uo.press(36)
uo.press(36)
uo.press(36)
end if
else
uo.print('Проходим.')
endif
wait(300) # иии.... заново!
wend
endsub
Code: Select all
sub main ()
var i, x, y, z, t, x1, y1, down, pick
UO.exec('terminate reconnector')
UO.exec('exec reconnector')
save()
UO.DeleteJournal ()
UO.Print ("select place to mine")
UO.infotile ()
wait (5000)
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 ("cannot see that") and not UO.inJournal ("far away")
wait (1000)
if UO.InJournal ("element") then
goto theend
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 (2000, "finditem")
wait (1000)
UO.ServerPrint (".hungry")
wait (1000)
if UO.LastMessage () == "You aren't hungry at all" then
UO.exec ("usetype '0x097B'")
wait (2000)
endif
else
wait (60000)
endif
endif
wend
theend:
end sub
sub carry ()
UO.findtype (0x19B9, 0x0602, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0000, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0231, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x045E, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0585, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x006F, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0481, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0042, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x009C, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0602 , 1)
UO.grab (2000, "finditem")
wait (1000)
end sub
sub take ()
while not UO.Dead ()
UO.findtype (0x19B9, 0x0000, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x07DF, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0482, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x045E, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x07D6, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x006F, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x05D7, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x094E, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x0940, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x09F9, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x094A, 1)
UO.grab (2000, "finditem")
wait (1000)
UO.findtype (0x19B9, 0x045E, 1)
UO.grab (2000, "finditem")
wait (1000)
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 save()
if UO.injournal('Saving World State') then
UO.print('lalala')
UO.Print('-------------------------')
Wait(30000)
UO.deletejournal()
endif
deathchk()
end sub
sub deathchk()
if UO.dead() then
uo.print('lalala?!')
UO.Print('-------------------------')
UO.Snap()
UO.exec('terminate all')
endif
end sub
sub Reconnector()
var RFlag
RFlag = 1
Repeat
While (UO.ObjAtLayer('Bpack') == '')
if RFlag Then
RFlag = 0
endif
Wait(20000) # WorldSave Protection
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.LClick(616,459)
Wait(3000)
WEnd
Wait(3000)
if (RFlag == 0) Then
RFlag = 1
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
Заранее сенкс откликнувшимся ....