Yoko

All sides of Injection
It is currently 2025-12-23 22:17:53

All times are UTC+02:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 2006-02-22 14:50:12 
Offline

Joined: 2006-02-22 14:47:08
Posts: 5
Вот хочу что бы в этом скрипте можно было указать координаты дома что бы по оканчанию рубки он не шел по 2 кругу а шел домой тока не по руне а пешком я рублю не далеко от дома!

Quote:
sub Lumber()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=0,TopY=0
dim TreeX[100], TreeY[100],TreeT[100]
dim TreeTile[100]
var flag=0,treeCount=0,clicks=0,flag2=0
var f=file("C:\trees.dat")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var Treesnum=10 ## Количесво деревьев вводимых вручную.
var TryHiding=1 ## 1 - перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет
var LogsQty=500 ## Количество логов, добыв которое надо остановиться.
var GetFromFile=0 ## 1 - координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

uo.exec('addobject axe')
while uo.targeting()
wait(100)
wend

#Загружаем координаты из файла
if GetFromFile==1 then
uo.print('Загружаем координаты из файла...')
f.open()
TreeCount=safe call f.readNumber()
for i=1 to TreeCount
TreeT[i]=safe call f.ReadNumber()
TreeX[i]=safe call f.ReadNumber()
TreeY[i]=safe call f.ReadNumber()
next
f.close()
else
#Собираем координаты из клиента
uo.print('Click on the trees one by one please...')

for i=1 to Treesnum

uo.DeleteJournal()
#Кликаем на тайл
uo.usetype('0x0E85')
WaitForTarget()
while uo.targeting()
wait(100)
wend
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.lastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.print('One more tree found: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
next
uo.print('Input completed. Coordinates saved to C:\trees.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.print('Trees total: '+str(treeCount))
wait(2000)

UO.Exec("exec r")

#Ходим по собранным координатам
while 1==1
if treeCount>0 then
for i=1 to treeCount
uo.print('Idem k derevu '+str(i)+': x='+str(treex[i])+' y='+str(treey[i]))
flag=gotoxy(treex[i],treey[i])
if flag==1 then
if TryHiding==1 then

ToHide()
end if
GetTree(str(treeT[i]),str(treeX[i]),str(TreeY[i]),str(uo.getz()))
end if
next
end if
wend
end sub

sub GetTree(type,x,y,z)
var i
uo.print('Chopping...')
for i=0 to 30
if uo.warmode()==1 then
return 0
end if
wait(200)
uo.deletejournal()
uo.waittargettile(type,x,y,z)
uo.useobject('axe')
if WaitForChange()==1 then
return 1
end if
next
return 0

end sub

sub ToHide()
var i
if uo.hidden() then
return 1
end if
uo.print('Trying to Hide...')
for i=1 to 15
uo.deletejournal()
uo.useskill('Hiding')
if WaitForHide()==1 then
return 1
end if
next
return 0
end sub

sub WaitForHide()
var Text1=uo.getname()+": You have hidden yourself well"
var Text2=uo.getname()+": You can't seem to hide here."
var mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text1 then
return 1
end if
if uo.Journal(0)==Text2 then
return 0
end if
wait(50)
next
return 0
end sub

sub WaitForChange()
var Text1=uo.getname()+': You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There are no logs here to chop.'
var Text3="You can't reach this."
var mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
if mess[0]=='Y' AND mess[1]=='o' AND mess[2]=='u' AND mess[4]=='p' AND mess[5]=='u' AND mess[6]=='t' then
return 0
end if
wait(50)
next
return 0
end sub

sub WaitForChangeXY(myX,myY,lastX,lastY)
for var i=1 to 50
if lastX<>myX OR lastY<>myY then
return 1
end if
wait(200)
next
return 0
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 abs(x-myX)<=1 AND abs(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 abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

sub WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub

sub WaitForChange()
var Text1=uo.getname()+': You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There are no logs here to chop.'
var Text3="You can't reach this."
var mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
if mess[0]=='Y' AND mess[1]=='o' AND mess[2]=='u' AND mess[4]=='p' AND mess[5]=='u' AND mess[6]=='t' then
return 0
end if
wait(50)
next
return 0
end sub

sub SaveToFile(TreeCount,TreeX,TreeY,TreeT)
var f=file("C:\trees.dat")
var s=0,i=0
f.open()
f.create()
s=safe call f.writeln(TreeCount)
for i=1 to TreeCount
s=safe call f.writeln(str(TreeT[i])+' '+str(treeX[i])+' '+str(TreeY[i]))
next
f.close()
end sub

sub main()
Lumber()
end sub

sub r()
st:
If UO.InJournal("Персонал")>0 or UO.InJournal("Персонал сервера!")>0 or UO.InJournal("EP:")>0 or UO.InJournal("Личинка")>0 or UO.InJournal("Имперец")>0 or UO.InJournal("Evil")>0 or UO.InJournal("GM")>0 or UO.InJournal("Seer")>0 or UO.InJournal("Counselor")>0 or UO.InJournal("Hammurapi")>0 or UO.InJournal("Shield")>0 or UO.InJournal("Ink")>0 or UO.InJournal("Hammurapi")>0 or UO.InJournal("LKnight")>0 or UO.InJournal("AcidLeha")>0 or UO.InJournal("Equilibrium")>0 or UO.InJournal("Kounselor")>0 or UO.InJournal("Counselor")>0 or UO.InJournal("Voland")>0 or UO.InJournal("AcidLeha")>0 or UO.InJournal("Vidar")>0 or UO.InJournal("Ink")>0 or UO.InJournal("Inc")>0 or UO.InJournal("Inquizitor")>0 or UO.InJournal("Hammurapi:")>0 or UO.InJournal("AcidLeha:")>0 or UO.InJournal("Lknight:")>0 or UO.InJournal("Malj")>0 or UO.InJournal("Ink:")>0 or UO.InJournal("Inc:")>0 or UO.InJournal("Inquizitor:")>0 or UO.InJournal("<")>0 or UO.InJournal("Привет")>0 or UO.InJournal("Хм")>0 or UO.InJournal("Здесь?")>0 or UO.InJournal("Milady")>0 or UO.InJournal("Тут?")>0 or UO.InJournal("Гном")>0 or UO.InJournal("Светлый")>0 or UO.InJournal("Орк")>0 or UO.InJournal("уровня")>0 or UO.InJournal("Темный")>0 or UO.InJournal("newbie")>0 or UO.InJournal("Inquisitor")>0 or UO.InJournal("inquisitor")or UO.InJournal("Inquisitor:o") or UO.InJournal("inquisitor:") or UO.InJournal("драко") Then

if UO.countground(0x0ed4)>0 or UO.countground(0x0ed5)>0 or UO.countground(0x0ed6)>0 or UO.countground(0x1183)>0 or UO.countground(0x1184)>0 or UO.countground(0x0edb)>0 or UO.countground(0x0edc)>0 or UO.countground(0x0FAB)>0 then
While not UO.InJournal("privetik")
UO.Playwav("C:\sound108.wav")
Wait(1500)
Wend
end if
While not UO.InJournal("privetik")
UO.Playwav("C:\sound108.wav")
Wait(1500)
Wend
End if
wait(1000)
goto st
end sub


Top
   
 Post subject:
PostPosted: 2007-08-20 01:10:37 
Offline

Joined: 2007-07-09 18:48:42
Posts: 54
Блин я ваще когда зпускаю его он мпишит ошибку (Line 183: parse error)


Top
   
 Post subject:
PostPosted: 2007-08-20 01:14:15 
Offline
User avatar

Joined: 2007-02-21 20:15:57
Posts: 479
Code:
sub Lumber() 
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=0,TopY=0
dim TreeX[100], TreeY[100],TreeT[100]
dim TreeTile[100]
var flag=0,treeCount=0,clicks=0,flag2=0
var f=file("C:\trees.dat")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var Treesnum=10 ## Количесво деревьев вводимых вручную.
var TryHiding=1 ## 1 - перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет
var LogsQty=500 ## Количество логов, добыв которое надо остановиться.
var GetFromFile=0 ## 1 - координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

uo.exec('addobject axe')
while uo.targeting()
wait(100)
wend

#Загружаем координаты из файла
if GetFromFile==1 then
uo.print('Загружаем координаты из файла...')
f.open()
TreeCount=safe call f.readNumber()
for i=1 to TreeCount
TreeT[i]=safe call f.ReadNumber()
TreeX[i]=safe call f.ReadNumber()
TreeY[i]=safe call f.ReadNumber()
next
f.close()
else
#Собираем координаты из клиента
uo.print('Click on the trees one by one please...')

for i=1 to Treesnum

uo.DeleteJournal()
#Кликаем на тайл
uo.usetype('0x0E85')
WaitForTarget()
while uo.targeting()
wait(100)
wend
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.lastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.print('One more tree found: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
next
uo.print('Input completed. Coordinates saved to C:\trees.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.print('Trees total: '+str(treeCount))
wait(2000)

UO.Exec("exec r")

#Ходим по собранным координатам
while 1==1
if treeCount>0 then
for i=1 to treeCount
uo.print('Idem k derevu '+str(i)+': x='+str(treex[i])+' y='+str(treey[i]))
flag=gotoxy(treex[i],treey[i])
if flag==1 then
if TryHiding==1 then

ToHide()
end if
GetTree(str(treeT[i]),str(treeX[i]),str(TreeY[i]),str(uo.getz()))
end if
next
end if
wend
end sub

sub GetTree(type,x,y,z)
var i
uo.print('Chopping...')
for i=0 to 30
if uo.warmode()==1 then
return 0
end if
wait(200)
uo.deletejournal()
uo.waittargettile(type,x,y,z)
uo.useobject('axe')
if WaitForChange()==1 then
return 1
end if
next
return 0

end sub

sub ToHide()
var i
if uo.hidden() then
return 1
end if
uo.print('Trying to Hide...')
for i=1 to 15
uo.deletejournal()
uo.useskill('Hiding')
if WaitForHide()==1 then
return 1
end if
next
return 0
end sub

sub WaitForHide()
var Text1=uo.getname()+": You have hidden yourself well"
var Text2=uo.getname()+": You can't seem to hide here."
var mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text1 then
return 1
end if
if uo.Journal(0)==Text2 then
return 0
end if
wait(50)
next
return 0
end sub

sub WaitForChange()
var Text1=uo.getname()+': You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There are no logs here to chop.'
var Text3="You can't reach this."
var mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
if mess[0]=='Y' AND mess[1]=='o' AND mess[2]=='u' AND mess[4]=='p' AND mess[5]=='u' AND mess[6]=='t' then
return 0
end if
wait(50)
next
return 0
end sub

sub WaitForChangeXY(myX,myY,lastX,lastY)
for var i=1 to 50
if lastX<>myX OR lastY<>myY then
return 1
end if
wait(200)
next
return 0
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 abs(x-myX)<=1 AND abs(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 abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

sub WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub

sub WaitForChange()
var Text1=uo.getname()+': You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There are no logs here to chop.'
var Text3="You can't reach this."
var mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
if mess[0]=='Y' AND mess[1]=='o' AND mess[2]=='u' AND mess[4]=='p' AND mess[5]=='u' AND mess[6]=='t' then
return 0
end if
wait(50)
next
return 0
end sub

sub SaveToFile(TreeCount,TreeX,TreeY,TreeT)
var f=file("C:\trees.dat")
var s=0,i=0
f.open()
f.create()
s=safe call f.writeln(TreeCount)
for i=1 to TreeCount
s=safe call f.writeln(str(TreeT[i])+' '+str(treeX[i])+' '+str(TreeY[i]))
next
f.close()
end sub

sub main()
Lumber()
end sub

sub r()
st:
If UO.InJournal("Персонал")>0 or UO.InJournal("Персонал сервера!")>0 or UO.InJournal("EP:")>0 or UO.InJournal("Личинка")>0 or UO.InJournal("Имперец")>0 or UO.InJournal("Evil")>0 or UO.InJournal("GM")>0 or UO.InJournal("Seer")>0 or UO.InJournal("Counselor")>0 or UO.InJournal("Hammurapi")>0 or UO.InJournal("Shield")>0 or UO.InJournal("Ink")>0 or UO.InJournal("Hammurapi")>0 or UO.InJournal("LKnight")>0 or UO.InJournal("AcidLeha")>0 or UO.InJournal("Equilibrium")>0 or UO.InJournal("Kounselor")>0 or UO.InJournal("Counselor")>0 or UO.InJournal("Voland")>0 or UO.InJournal("AcidLeha")>0 or UO.InJournal("Vidar")>0 or UO.InJournal("Ink")>0 or UO.InJournal("Inc")>0 or UO.InJournal("Inquizitor")>0 or UO.InJournal("Hammurapi:")>0 or UO.InJournal("AcidLeha:")>0 or UO.InJournal("Lknight:")>0 or UO.InJournal("Malj")>0 or UO.InJournal("Ink:")>0 or UO.InJournal("Inc:")>0 or UO.InJournal("Inquizitor:")>0 or UO.InJournal("<")>0 or UO.InJournal("Привет")>0 or UO.InJournal("Хм")>0 or UO.InJournal("Здесь?")>0 or UO.InJournal("Milady")>0 or UO.InJournal("Тут?")>0 or UO.InJournal("Гном")>0 or UO.InJournal("Светлый")>0 or UO.InJournal("Орк")>0 or UO.InJournal("уровня")>0 or UO.InJournal("Темный")>0 or UO.InJournal("newbie")>0 or UO.InJournal("Inquisitor")>0 or UO.InJournal("inquisitor")or UO.InJournal("Inquisitor:o") or UO.InJournal("inquisitor:") or UO.InJournal("драко") Then

if UO.countground(0x0ed4)>0 or UO.countground(0x0ed5)>0 or UO.countground(0x0ed6)>0 or UO.countground(0x1183)>0 or UO.countground(0x1184)>0 or UO.countground(0x0edb)>0 or UO.countground(0x0edc)>0 or UO.countground(0x0FAB)>0 then
While not UO.InJournal("privetik")
UO.Playwav("C:\sound108.wav")
Wait(1500)
Wend
end if
While not UO.InJournal("privetik")
UO.Playwav("C:\sound108.wav")
Wait(1500)
Wend
End if
wait(1000)
goto st
end sub

_________________
Шард Антарес
Ururu


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 8 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