Yoko

All sides of Injection
It is currently 2025-11-05 00:24:55

All times are UTC+02:00




Post new topic  Reply to topic  [ 9 posts ] 
Author Message
PostPosted: 2006-03-13 13:05:01 
Offline

Joined: 2004-07-02 09:47:30
Posts: 43
Quote:
sub mine_spot()
var maxMineTime=1000
var times=0
var timeout=0
While UO.InJournal("You stop")==0
UO.Print("Mining time!")
UO.DeleteJournal()
UO.WaitTargetTile("1339",STR(UO.GetX()),STR(UO.GetY()),"0")
UO.UseType("pickaxe")
timeout=0
times = times +1
if times>20 then
wait(maxMineTime)
times = 0
endif
Repeat
timeout=timeout+200
Wait(200)
UO.Print("Waiting...")
Until UO.InJournal("You put") OR UO.InJournal("There is no ore") OR timeout>maxMineTime
Wend
return 0
end sub


Не переходит к следуйщему тайлу при сообщение от уо "There is no ore here to mine." Why? :oops:


Top
   
 Post subject:
PostPosted: 2006-03-13 13:29:24 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
так он и не будет переходить%) потому что это процедура для рытья 1 тайла;)


Top
   
 Post subject:
PostPosted: 2006-03-13 13:32:56 
Offline

Joined: 2004-07-02 09:47:30
Posts: 43
Знаю, не полный дурак :) Если нужны все процедуры, то вот:

Quote:
sub go_mining()
var cycle=1
var path="2wswsws4wnwswnwsws2wsw2ko5enesenesene4so4ek2l3e2n3w3n2wn2e2s2e2s4nw3ni"
var test=0
var i=0
var j
UO.SetCatchBag("oresBag")
UO.DeleteJournal()

While i<LEN(path)
if VAL(path[i]) then
j=VAL(path[i])
i=i+1
else
j=1
endif

Repeat
if test<>1 then
UO.DeleteJournal()
mine_spot()
end if

UO.Print("New Location!")
if not make_step(path[i]) then
UO.Print("Probably Stuck!")
UO.Print("Hope it is a Worldsave")
endif
j=j-1
Until j==0

i = i + 1
if cycle && i==LEN(path) then
i=0
endif
Wend
end sub


sub mine_spot()
var maxMineTime=1000
var times=0
var timeout=0
While UO.InJournal("You stop")==0
UO.Print("Mining time!")
UO.DeleteJournal()
UO.WaitTargetTile("1339",STR(UO.GetX()),STR(UO.GetY()),"0")
UO.UseType("pickaxe")
timeout=0
times = times +1
if times>20 then
wait(maxMineTime)
times = 0
endif
Repeat
timeout=timeout+200
Wait(200)
UO.Print("Waiting...")
Until UO.InJournal("You put") OR UO.InJournal("There is no ore") OR timeout>maxMineTime
Wend
return 0
end sub


sub record_path()
var x
var y
var path=""
UO.DeleteJournal()
Repeat
x=UO.GetX()
y=UO.GetY()
if waitNewPos(x,y) then
path=path+extract_dir(x,y,UO.GetX(),UO.GetY())
endif
Until UO.InJournal("stop")
path = compressPath(path)
UO.TextClear()
UO.TextOpen()
UO.TextPrint("Your path is:")
UO.TextPrint(path)
end sub


sub send_step(keycode,dir)
var x = UO.GetX()
var y = UO.GetY()
var timeout = 0
if UO.GetDir()<>dir then
UO.Press(keycode)
Repeat
wait(50)
Until UO.GetDir()==dir
endif
UO.Press(keycode)
Repeat
timeout=timeout+50
wait(50)
Until x<>UO.GetX() || y<>UO.GetY() || timeout>2000
if timeout>2000 then
return 0
endif
return 1
end sub


sub waitNewPos(x,y)
while x==UO.GetX() && y==UO.GetY()
if UO.InJournal("stop") then
return 0
endif
wend
return 1
end sub

sub compressPath(path)
Var i=0
Var j=0
Var newPath=""
while i<LEN(path)
j=1
while path[i]==path[i+1] AND j<9
i=i+1
j=j+1
wend
if j==1 then
newPath=newPath+path[i]
else
newPath=newPath+STR(j)+path[i]
endif
i=i+1
wend
return newPath
end sub

sub extract_dir(x,y,a,b)
if x>a then
if y==b then
return "i"
else
if y>b then
return "n"
else
return "w"
endif
endif
else
if x<a then
if y==b then
return "l"
else
if y>b then
return "e"
else
return "s"
endif
endif
else
if y>b then
return "o"
else
return "k"
endif
endif
endif
end sub

sub make_step(dir)
if dir=="e" then
send_step(39,1)
return 1
endif
if dir=="l" then
send_step(34,2)
return 1
endif
if dir=="s" then
send_step(40,3)
return 1
endif
if dir=="k" then
send_step(35,4)
return 1
endif
if dir=="w" then
send_step(37,5)
return 1
endif
if dir=="i" then
send_step(36,6)
return 1
endif
if dir=="n" then
send_step(38,7)
return 1
endif
if dir=="o" then
send_step(33,0)
return 1
endif
if dir=="d" then
While UO.Count("0x19b9")
UO.Drop("0x19b9")
wait(1000)
Wend
wait(200)
return 1
endif
UO.Print("Recall Time!")
return 0
end sub


Top
   
 Post subject:
PostPosted: 2006-03-13 13:50:35 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
страный макрос;) изобретение самоката...
у бедись что управление из mine_spot() передается дальше


Top
   
 Post subject:
PostPosted: 2006-03-13 14:00:27 
Offline

Joined: 2006-02-03 06:53:36
Posts: 64
как я понял, переходить он должет когда увидет в журнале строчку "You stop", а не "There is no ore here to mine"


Top
   
 Post subject:
PostPosted: 2006-03-13 14:11:46 
Offline

Joined: 2004-07-02 09:47:30
Posts: 43
Я тоже так понял, но он этого не делает :lol: Why?


Top
   
 Post subject:
PostPosted: 2006-03-13 14:14:01 
Offline

Joined: 2006-02-03 06:53:36
Posts: 64
а сообщение "You stop" в журнале появляеться?


Top
   
 Post subject:
PostPosted: 2006-03-13 14:16:48 
Offline

Joined: 2004-07-02 09:47:30
Posts: 43
Нет=) Ну скрипт то я содрал, решил для безопастности ничего не трогать. Палки в колёса не вставляет, и фиг бы с ней=)


Top
   
 Post subject:
PostPosted: 2006-03-13 14:21:53 
Offline

Joined: 2006-02-03 06:53:36
Posts: 64
это
While UO.InJournal("You stop")==0
поменяй на это
While UO.InJournal("There is no ore")==0


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 9 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited