Lumberjacking
Moderators: Murderator+, Murderator
Lumberjacking
ООООчень прошу выложить здесь скрипт на рубку дерева без всяких реколлов. Скока не пытаюсь я переделать этот скрипт, всё равно не работает. У меня дом в лесу, в глуши.
Re: Lumberjacking
Leo wrote:ООООчень прошу выложить здесь скрипт на рубку дерева без всяких реколлов. Скока не пытаюсь я переделать этот скрипт, всё равно не работает. У меня дом в лесу, в глуши.
Лови если не пашет пиши :
Code: Select all
##################
### Переменные ###
##################
##################################################################################################################
###
var FileName=('C:\trees.dat') ## - Путь к файлу в котором будут хранится координаты деревьев.
###
var TryHiding=1 ## 1 - Перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет .
###
var GetFromFile=1 ## 1 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
### (сначала соберите а потом считывайте из файла).
###
var LogsQty=1500 ## - Количество логов при котором чар складывает логи в чек.
###
var QuantityImpact=15 ## - Сколько раз чар будет ударять по дереву, прежде чем перейдет к другому.(стандарт - 15)
###
##################################################################################################################
###
### После настройки:
### Идите в лес в котором вы хотите рубить.
### Запустите cкрипт GoLumberjacking(), Инжект попросит вас указать Топор
### (появится прицел, прицелом на топор который вы с собой взяли),
### затем инжект попросит вас указать Рунбук(появится прицел, прицелом на него) ,Руну(прицелом на неё) и Сундук для логов.
### После этого чар пойдет по координатам и будет вырубать деревья.
###########
### Код ###
###########
sub GoLumberjacking()
uo.Print('Выбери Топор: ')
uo.Exec('addobject Axe')
while uo.Targeting()
wait(100)
wend
uo.Exec('exec Lumberjacking')
end sub
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj,f
var TopX=324,TopY=65
dim TreeX[5000],TreeY[5000],TreeT[5000]
dim TreeTile[29]
var flag=0,TreeCount=0,clicks=0,flag2=0
########################
### Графика деревьев ###
########################
TreeTile[0]=3277
TreeTile[1]=3280
TreeTile[2]=3283
TreeTile[3]=3286
TreeTile[4]=3289
TreeTile[5]=3291
TreeTile[6]=3294
TreeTile[7]=3296
TreeTile[8]=3299
TreeTile[9]=3302
TreeTile[10]=3393
TreeTile[11]=3394
TreeTile[12]=3395
TreeTile[13]=3396
TreeTile[14]=3415
TreeTile[15]=3416
TreeTile[16]=3417
TreeTile[17]=3418
TreeTile[18]=3419
TreeTile[19]=3438
TreeTile[20]=3439
TreeTile[21]=3440
TreeTile[22]=3441
TreeTile[23]=3442
TreeTile[24]=3460
TreeTile[25]=3461
TreeTile[26]=3462
TreeTile[27]=3290
TreeTile[28]=3288
uo.FilterSpeech('on')
uo.FilterSpeech('add', 'Where do you want to use the pickaxe?')
#####################################
### Загружаем координаты из файла ###
#####################################
if GetFromFile==1 then
uo.Print('Загружаем координаты из файла...')
f=file(FileName)
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('Выбери Кирку: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print('Собираем координаты деревьев в округе...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Кликаем на тайл ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
###############################
### Проверяем дерево ли это ###
###############################
flag=0
for k=0 to 28
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 28
if uo.LastTile(0)==TreeTile[k] then
flag=1
end if
next
end if
if uo.Lasttile(1)==uo.GetX() and uo.Lasttile(2)==uo.GetY() then
flag=3
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('Найдено дерево номер '+str(TreeCount)+' : 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('Найдено дерево номер '+str(TreeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
end if
end if
until (flag==3) or (TreeCount==5000)
uo.FilterSpeech('off')
uo.Print('Анализ закончен, координаты деревьев записаны в файл ' + FileName)
SaveToFile(TreeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Деревьев найдено: '+str(TreeCount))
wait(2000)
######################################
### Ходим по собранным координатам ###
######################################
while 1==1
if TreeCount>0 then
for i=1 to TreeCount
uo.Print('Идем к дереву номер '+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 SaveToFile(TreeCount,TreeX,TreeY,TreeT)
var s=0,i=0,f
f=file(FileName)
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 GetTree(Type,X,Y,Z)
var i
uo.Print('Начинаем рубку дерева...')
for i=0 to QuantityImpact
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 WaitForRecall()
var Text1=uo.GetName()+': The spell fizzles.'
var LastX=uo.GetX()
var LastY=uo.GetY()
var mess=''
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 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 Text4='That is too far away.'
var Text5="You can't do much in your current state."
var mess
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 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 Numb(x-myX)<=1 and Numb(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 Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub
sub InfoLogs()
uo.Print('У вас всего '+str(uo.Count('0x1BDD'))+' логов в сумке')
uo.Print('Из них '+str(uo.Count('0x1BDD','0x0000'))+' простых и ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' цветных')
end sub
sub ToHide()
while not uo.Hidden()
uo.Print('Пытаемся уйти в хайд...')
uo.DeleteJournal()
uo.Exec('warmode 0')
uo.UseSkill('Stealth')
wait(4100)
wend
wait(100)
end sub
sub Terminate()
uo.Exec('terminate Lumberjacking')
end sub
sub CheckLag()
if uo.Waiting()>0 then
uo.Exec('canceltarget')
end if
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(50)
until uo.InJournal('backpack')
end sub
Code: Select all
var XX = 0
var YY = 0
var XXX = 0
var YYY = 0
var f
var i,j=0
var cpx=833
var timeoutcount=0
var pathteleport=0
var rc=0
var timeout=0
var tmpx=0
var tmpy=0
var tmpid=0
var pop=0
sub main()
dim Tree11[11]
dim Tree12[11]
dim Tree21[11]
dim Tree22[11]
Tree11[1]=1
Tree11[2]=1
Tree11[3]=1
Tree11[4]=0
Tree11[5]=1
Tree11[6]=1
Tree11[7]=1
Tree11[8]=1
Tree11[9]=0
Tree11[10]=0
Tree11[11]=1
Tree12[1]=0
Tree12[2]=0
Tree12[3]=0
Tree12[4]=0
Tree12[5]=1
Tree12[6]=1
Tree12[7]=1
Tree12[8]=1
Tree12[9]=1
Tree12[10]=1
Tree12[11]=1
Tree21[1]=1
Tree21[2]=1
Tree21[3]=0
Tree21[4]=1
Tree21[5]=1
Tree21[6]=1
Tree21[7]=0
Tree21[8]=1
Tree21[9]=1
Tree21[10]=1
Tree21[11]=0
Tree22[1]=1
Tree22[2]=0
Tree22[3]=0
Tree22[4]=1
Tree22[5]=1
Tree22[6]=0
Tree22[7]=1
Tree22[8]=0
Tree22[9]=1
Tree22[10]=1
Tree22[11]=0
var posx = UO.Getx()
var posy = UO.Gety()
var Shagy = 0
var tm = 0
var t = 0
var kf = 1
var Napr = 1
var str=""
var stnum=9
var i=0
var mine=0
YY = 10
Vik:
kf=0
Vikapivanie:
if Napr==1 then
if Tree11[ShagY+1] == 0 then
UO.Print("Слева пропускаем")
Goto Vikapivanie2
endif
else
Uo.Print(str(ShagY))
if Tree21[ShagY+2] == 0 then
UO.Print("Слева пропускаем")
Goto Vikapivanie2
endif
endif
uo.usetype("0x0F49")
repeat
Wait(200)
until UO.Targeting()
uo.LClick(332,263)
tm=0
uo.deletejournal()
wtt:
tm = tm + 500
Wait(500)
if uo.injournal("There are no")<>0 OR uo.injournal("You put")<>0 OR tm > 18000 OR uo.injournal("fail")<>0 then
Goto nwtt
endif
Goto wtt
nwtt:
UO.Print(UO.Journal(0))
if uo.injournal("There are no") OR uo.injournal("Try mining") OR uo.injournal("Iron") OR UO.Journal(0)=="What do you want to use this on?" then
UO.Print("1 Ready")
kf=0
Goto Vikapivanie2
else
if uo.injournal("fail") then
kf=kf+1
UO.Print("Попытка "+str(kf))
if kf==6 then
kf=0
Goto Vikapivanie2
endif
endif
Goto Vikapivanie
endif
kf=0
Vikapivanie2:
if Napr==1 then
if Tree12[ShagY+1] == 0 then
UO.Print("Справа пропускаем")
Goto Go
endif
else
Uo.Print(str(ShagY))
if Tree22[ShagY+2] == 0 then
UO.Print("Справа пропускаем")
Goto Go
endif
endif
uo.usetype("0x0F49")
repeat
Wait(200)
until UO.Targeting()
uo.LClick(416,337)
tm=0
uo.deletejournal()
wtt2:
tm = tm + 500
Wait(500)
if uo.injournal("There are no")<>0 OR uo.injournal("You put")<>0 OR tm > 18000 OR uo.injournal("fail")<>0 then
Goto nwtt2
endif
Goto wtt2
nwtt2:
UO.Print(UO.Journal(0))
if uo.injournal("There are no") OR uo.injournal("Try mining") OR uo.injournal("Iron") OR UO.Journal(0)=="What do you want to use this on?" then
UO.Print("2 Ready")
Goto Go
else
if uo.injournal("fail") then
kf=kf+1
UO.Print("Попытка "+str(kf))
if kf==6 then
Goto Go
endif
endif
Goto Vikapivanie2
endif
Go:
if ShagY == YY and Napr==1 then
Napr = 2
While not UO.GetX()==posx+8
Wait(500)
UO.Press(34)
CheckLag()
wend
Shagy = Shagy - 1
else
if ShagY == -1 and Napr==2 then
Napr = 1
While not UO.GetX()==posx
Wait(500)
UO.Press(36)
CheckLag()
wend
Shagy = Shagy + 1
else
if Napr==1 then
Shagy = Shagy + 1
While not UO.GetY()==posy-Shagy*3
UO.PRINT("UO.GetY() " + str(UO.GetY()))
UO.PRINT("posy-Shagy*3 " + str(posy-Shagy*3))
Wait(500)
UO.Press(33)
CheckLag()
wend
else
While not UO.GetY()==posy-Shagy*3
UO.PRINT("UO.GetY() " + str(UO.GetY()))
UO.PRINT("posy-Shagy*3 " + str(posy-Shagy*3))
Wait(500)
UO.Press(35)
CheckLag()
wend
Shagy = Shagy - 1
endif
endif
end if
Goto Vik
Terminate:
end sub
sub CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
repeat
wait(500)
until UO.InJournal('backpack')
end sub
Без пояснений ничего не поймете а пояснять некогда
