Yoko

All sides of Injection
It is currently 2025-12-23 20:11:52

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2005-07-01 16:29:47 
Offline

Joined: 2005-06-19 12:38:06
Posts: 4
--------------------------------------------------------------------------

Kak propisat shtobi kogda ktota atakuet srazu zapuskalsa runebook, tb. puskalsa ToRecall() i potom kogda vso slozhil v bank vozrashaetsa obratno i prodalzhaet rubit...


---------------------------------------------------------------------------

###########
### Код ###
###########
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=324,TopY=65
dim TreeX[500], TreeY[500],TreeT[500]
dim TreeTile[10]
var flag=0,treeCount=0,clicks=0,flag2=0
######################
### Меню / Options ###
######################
############################################################################################
var f=file("C:\trees3.dat") ## - Путь к файлу в котором будут хранится координаты Деревьев.
###
var Area=1 ## Размер обрабатываемой территории, можно менять от 1 до 4.
###
var TryHiding=0 ## 1 - Перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет .
###
var TryRecall=1 ## 1 - После того как соберет LogsQty логов, будет пытаться реколиться домой,
# складывать логи в сундук и реколиться обратно (нужно указать Рунбук в которой,1 ая руна домой, а 9 ая в лес), 0 - не будет.
###
var LogsQty=750 ## Количество логов, добыв которое надо реколиться домой.
###
var GetFromFile=1 ## 0 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
#(сначала соберите а потом считывайте из файла).
###
uo.exec("set norbcheck 1")# Для рекола.
###
uo.exec("set norbcalc 1") # Для рекола .
###
############################################################################################
########################
### Графика деревьев ###
########################
TreeTile[0]=3283
TreeTile[1]=3277
TreeTile[2]=3293
TreeTile[3]=3296
TreeTile[4]=3302
TreeTile[5]=3299
TreeTile[6]=3290
TreeTile[7]=3288
TreeTile[8]=3286
TreeTile[9]=3280

uo.exec("filterspeech on")
uo.exec("filterspeech add 'Where do you want to use the pickaxe?'")

uo.print('Izveelies Cirvi: ')
uo.exec('addobject axe')
while uo.targeting()
wait(100)
wend

if TryRecall==1 then
uo.print('Izveelies Ruunas graamatu: ')
uo.exec('addobject Runebook')
while uo.targeting()
wait(100)
wend
end if

#####################################
### Загружаем координаты из файла ###
#####################################
if GetFromFile==1 then
uo.print('Gruziijam koardinaates no faila...')
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('Izveelies kapli: ')
uo.exec('addobject Pickaxe')
while uo.targeting()
wait(100)
wend
uo.print('Savaacam izmeetaatos gruzhus...')
for q=1 to Area
if q==2 then
gotoxy(uo.getx()+20,uo.gety()-10)
end if
if q==3 then
gotoxy(uo.getx(),uo.gety()+20)
end if
if q==4 then
gotoxy(uo.getx()-20,uo.gety())
end if
for r=0 to 3
if r==1 then
gotoxy(uo.getx()+10,uo.gety())
end if
if r==2 then
gotoxy(uo.getx(),uo.gety()+10)
end if
if r==3 then
gotoxy(uo.getx()-10,uo.gety())
end if
for j=0 to 8
for i=0 to 8
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Кликаем на тайл ###
#######################
uo.useobject('Pickaxe')
waitForTarget()
uo.DeleteJournal()

WaitForTryRock()

###############################
### Проверяем дерево ли это ###
###############################
flag=0
for k=0 to 9
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 9
if uo.LastTile(0)==TreeTile[k] then
flag=1
end if
next
end if
#########################
### Кликнули на ствол ###
#########################
if flag==1 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if treeX[ii]==uo.lastTile(1) AND treeY[ii]==uo.lastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.lastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.print('Labus Detected: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
end if
end if
##########################
### Кликнули по листве ###
##########################
if flag==2 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if treeX[ii]==uo.lastTile(1) AND treeY[ii]==uo.lastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.LastTile(2)
TreeT[treeCount]=uo.LastTile(0)-1
uo.print('Labus Detected: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
end if
end if
next
next
next
next
uo.exec("filterspeech off")
uo.print('Asins analiizes beigtas, juusu organismaa ir paaraak daudz alkohola C:\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.print('Koks atrasts: '+str(treeCount))
wait(2000)
######################################
### Ходим по собранным координатам ###
######################################
while 1==1
if treeCount>0 then
for i=1 to treeCount
if TryRecall==1 and |||| uo.InJournal('is attacking you') or |||| uo.Count('ZLK')>=LogsQty then
ToRecall()
uo.DeleteJournal()
end if
uo.print('Chaapojam pie koka '+str(i)+': x='+str(treex[i])+' y='+str(treey[i]))
infologs()
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('Saakam kapaat koku...')
for i=0 to 15
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 ToRecall()
VAR Meshok='0x4006B68B' ## - ID сундука в который чар должен складывать логи
RecallToHome()
wait(500)
uo.press(36)
wait(500)
uo.press(36)
wait(500)
uo.sayu ('bank')
repeat
wait(500)
repeat
wait(500)
repeat
wait(500)
repeat
wait(600)
UO.SetReceivingContainer(Meshok)
uo.findtype('ZLK')
wait(500)
UO.Grab('all','finditem')
infologs()
wait(500)
until uo.GetQuantity('finditem')==0
UO.UnSetReceivingContainer()
UO.SetReceivingContainer(Meshok)
uo.findtype('ZLK')
wait(500)
UO.Grab('all','finditem')
infologs()
wait(500)
until uo.GetQuantity('finditem')==0
UO.UnSetReceivingContainer()
UO.SetReceivingContainer(Meshok)
uo.findtype('ZLK')
wait(500)
UO.Grab('all','finditem')
infologs()
wait(500)
until uo.GetQuantity('finditem')==0
UO.UnSetReceivingContainer()
RecallToLumber()
end sub

sub RecallToHome()
UO.Print("!!Lecam uz maajaam!!")
uo.exec("recall Runebook 2")
wait(10000)
end sub

sub RecallToLumber()
UO.Print("!!Lecam uz mezhu[uz rokaam]!!")
uo.exec("recall Runebook 3")
wait(10000)
end sub

sub ToHide()
while not UO.Hidden()
uo.print('Meejginam nosleepties...')
uo.deletejournal()
UO.UseSkill("Stealth")
wait(4100)
wend
wait(100)
end sub


sub WaitForRecall()
var Text1=uo.getname()+": The spell fizzles."
var mess='',lastX=uo.getX(),lastY=uo.getY()
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text1 then
return 0
end if
if uo.getX()<>lastX OR uo.getY()<>LastY then
return 1
end if
wait(50)
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 decide not to chop wood for now.'
var Text2='There is nothing here to chop.'
var Text3='There is no wood left to harvest.'
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 WaitForTryRock()
var Text1="That is too far away."
var Text2="Try mining in rock."
var Text3="There is no ore here to mine."
var Text4="You have no line of sight to that location"
var Text5="You can't see the target"
for var i=0 to 50
if uo.Journal(0)==Text1 OR uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 OR uo.Journal(0)==Text4 OR uo.Journal(0)==Text5 then
return 1
end if
wait(200)
next
return 0
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 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 SaveToFile(TreeCount,TreeX,TreeY,TreeT)
var f=file("C:\trees3.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 infologs()
UO.Print('Jums ir tikai '+Str(UO.Count('0x1BDD'))+' kiegelju backpackaa')
UO.Print('No tiem '+Str(UO.Count('0x1BDD','0x0000'))+' parastie ' +str(uo.count('0x1BDD')-uo.count('0x1BDD','0x0000'))+' ugunsdroshie')
end sub

##############################################################
### ВНИМАНИЕ!!! В СКРИПТЕ РУНБУКИ НАСТРОЕНЫ ПОД DRW (шард) ###
##############################################################


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

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