Psimorph wrote:
И по мойму, лучше вставить проверку на UO.InJournal
Тоесть
repeat
основной скрипт
until UO.InJournal('всё вырыто уже тут')
if UO.InJournal('всё вырыто уже тут') then
i=i+1
endif
так не проще?
################MINIG####################################
;--------------------------- Flags ----------------------------
; 0-Actions flag. If =1 ResidentACT paused script and run self
; 1-Elemental flag
; 2-World save flag
; 99-Pause main script flag
;--------------------------------------------------------------
sub ResidentMSG()
VAR i
UO.DeleteJournal()
;------------------ Clear global var -------------------------
for i=0 to 2
UO.SetEasyUO(i,"0")
next
;-------------------- Check situations -----------------------
while 1==1
If UO.InJournal("OOPS") then
UO.SetJournalLine(UO.InJournal("OOPS")-1,"Fixed")
UO.SetEasyUO(1,"1")
UO.SetEasyUO(0,"1")
endif
If UO.InJournal("Elemental is attacking you") AND UO.GetEasyUO(0)=="0" then
UO.SetJournalLine(UO.InJournal("Elemental is attacking you")-1,"Fixed")
UO.SetEasyUO(1,"1")
UO.SetEasyUO(0,"1")
endif
If UO.InJournal("World save") then
UO.SetJournalLine(UO.InJournal("World save")-1,"Fixed")
UO.SetEasyUO(2,"1")
UO.SetEasyUO(0,"1")
endif
wait(250)
wend
end sub
;-------------------- Action for situation --------------------
sub ResidentACT()
UO.SetEasyUO(99,"0")
while 1==1
if UO.GetEasyUO(0)=="1" then
UO.SetEasyUO(99,"1") ;Pause main script
if UO.GetEasyUO(1)=="1" then
KillElem()
UO.SetEasyUO(1,"0")
endif
if UO.GetEasyUO(2)=="1" then
UO.Click('self')
repeat
wait(500)
until UO.InJournal("Dirath: Dirath")
UO.SetEasyUO(2,"0")
endif
UO.SetEasyUO(0,"0")
UO.SetEasyUO(99,"0")
endif
wait(250)
wend
end sub
;------------- Pause main script while situations -------------
sub CheckPause()
if UO.GetEasyUO(99)=="1" then
repeat
wait(100)
until UO.GetEasyUO(99)=="0"
endif
end sub
;==================== Main mining script ======================
sub mine()
VAR i,TileY,TileX,DirX,DirY
UO.Exec('exec alarm') ; alarm when char lose HP
UO.Exec('exec ResidentMSG') ; check messages
UO.Exec('exec ResidentACT') ; action on messages
While NOT UO.Dead()
UO.DeleteJournal()
DirX=1
DirY=1
For TileY=1 to 7
For TileX=1 to 16
ToHide()
CheckPause()
digit()
walk(1*DirX,0)
next
ToHide()
CheckPause()
digit()
DirX=-1*DirX
walk(0,1*DirY)
next
ToHide()
CheckPause()
digit()
DirY=-1*DirY
unloadore()
walk(5645-UO.GetX(),1050-UO.GetY())
wend
end sub
;-------------------- Try to mine under self ------------------
sub digit()
VAR Last=0,LastTimer
VAR MaxWeight=650
if UO.Weight>=MaxWeight then
unloadore()
endif
repeat
CheckLag() ; deleting journal
UO.WaitTargetSelf()
UO.UseType('0x0E85')
LastTimer=UO.Timer()
repeat
wait(100)
until UO.InJournal("You put") OR UO.InJournal("You loosen") OR UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("OOPS") OR UO.InJournal("attacking you") OR LastTimer+150<UO.Timer()
wait(1000)
CheckPause()
if UO.InJournal('You loosen') then
repeat
wait(100)
until UO.InJournal("You put") OR LastTimer+105<UO.Timer()
endif
until UO.InJournal("There is no") OR UO.InJournal("That is too")
wait(1000)
CheckPause()
end sub
;------------------------- Unload ore -------------------------
sub unloadore()
VAR TempX,TempY,i,Exit
DIM Ore[5]
TempX=UO.GetX()
TempY=UO.GetY()
CheckPause()
walk(5646-TempX,1057-TempY)
CheckPause()
ToHide()
CheckPause()
Ore[0]=0x19B9 ; 4 and more ore
Ore[1]=0x19B7 ; 1 ore
Ore[2]=0x19BA ; 2 ore
Ore[3]=0x19B8 ; 3 ore
UO.SetReceivingContainer('0x400BF86D') ; storecontainer
wait(500)
For i=0 to 3
Exit=0
repeat
UO.FindType(Ore[i])
CheckLag()
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
CheckLag()
wait(1500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
walk(TempX-5446,TempY-1057)
CheckPause()
ToHide()
CheckPause()
end sub
;----------- Morf in Daemon, kill elem and loot him -----------
sub killelem()
VAR Count, LastTimer
UO.UseType('0x0F0E','0x0631') ; inviz potion
repeat
If UO.Mana>=50 then
UO.WaitMenu('What','Daemon')
UO.Cast('Polymorph')
wait(8000)
else
while UO.Mana<50
UO.UseType('0x0F0E','0x09DF') ; total mana potion
wait(3000)
wend
endif
until UO.STR>200 ; U'r not morfed char max Strength
LastTimer=UO.Timer()
repeat
UO.BandageSelf()
wait(4000)
until UO.Life==UO.STR OR LastTimer+170<UO.Timer()
UO.UseType(0x1B76) ; heater shield
UO.UseType(0x1413) ; platemail gorget
UO.DeleteJournal()
UO.WarMode(1)
UO.UseSkill('Meditation') ; reveal self
; "Corpse autoopen" in "main" need be checked
repeat
wait(5000)
until UO.InJournal('Body') OR UO.InJournal('You can')
If UO.InJournal('You can') then
UO.WaitTargetGround('0x19B9') ; 4 and more ore
wait(1500)
UO.Grab('all')
UO.WaitTargetGround('0x0EED') ; gold coins
wait(500)
UO.Grab('all')
Else
UO.WaitTargetObject('lastcorpse')
UO.UseType('0x0F51') ; dagger
wait(500)
UO.FindType('0x19B9',-1,'lastcorpse') ; ore
wait(500)
UO.Grab(0,'finditem')
UO.FindType('0x0EED',-1,'lastcorpse') ; coins
wait(500)
UO.Grab(0,'finditem')
UO.FindType('0x1BF5',-1,'lastcorpse') ; ings
wait(500)
UO.Grab(0,'finditem')
UO.FindType('0x0E76',-1,'lastcorpse') ; bag
wait(500)
UO.Grab(0,'finditem')
endif
UO.WarMode('flip')
wait(1000)
UO.WarMode(0)
wait(1000)
LastTimer=UO.Timer()
if UO.Life<170 then ; U'r max HP
repeat
UO.BandageSelf()
wait(4000)
until UO.Life>170 OR LastTimer+170<UO.Timer()
endif
ToHide()
end sub
sub tohide()
while NOT UO.Hidden()
UO.DeleteJournal()
if UO.Life<170 then
UO.UseType('0x0F0E','0x0631') ; inviz potion
wait(2000)
else
UO.UseSkill('Hiding')
repeat
wait(50)
until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied')
endif
UO.WarMode('flip')
wait(100)
UO.Warmode(0)
wend
end sub
sub CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
repeat
wait(50)
until UO.InJournal('backpack')
end sub
sub gong(times) ; play wav-file
VAR i
for i=1 to times
UO.Exec("playwav c:\game\uo\cow")
wait(1200) ; time to play sample at once
next
end sub
sub alarm()
while 1==1
wait(1000)
if UO.Life<170 then
gong(1)
endif
wend
end sub
sub walk(dx,dy)
VAR i, walkwait=300
If dx<>0 then
If dx>0 then
If UO.GetDir()<>2 then
UO.Press(34)
wait(walkwait)
CheckPause()
Endif
For i=1 to dx
UO.Press(34)
wait(walkwait)
CheckPause()
next
Else
If UO.GetDir()<>6 then
UO.Press(36)
wait(walkwait)
CheckPause()
Endif
For i=1 to dx*-1
UO.Press(36)
wait(walkwait)
CheckPause()
next
Endif
endif
If dy<>0 then
If dy>0 then
If UO.GetDir()<>4 then
UO.Press(35)
wait(walkwait)
CheckPause()
Endif
For i=1 to dy
UO.Press(35)
wait(walkwait)
CheckPause()
next
Else
If UO.GetDir()<>0 then
UO.Press(33)
wait(walkwait)
CheckPause()
Endif
For i=1 to dy*-1
UO.Press(33)
wait(walkwait)
CheckPause()
next
Endif
endif
wait(1000)
end sub
этот лучше