MaG1StR_Yoda | Дата: Пятница, 26.06.2020, 20:04 | Сообщение # 1 |
Генералиссимус
Группа: Администраторы
Сообщений: 1026
Статус: Оффлайн
| Вырубаем прозрачность(желательно).Лочим логи и дедвуды на 1 клетку к дому, запускаем setup : 1-й таргет на прилоканые логи , далее биндим деревья сколько душе угодно , в конце таргетом на себя . Запускаем sub LumberJacking() и поехали ------------------------------------------------------------- sub LumberJacking() var trees = 0 dim treeTile[100] dim treeX[100] dim treeY[100] dim treeZ[100] trees = loadPointsTXYZ(treeTile, treeX, treeY, treeZ, 'tree.txt') var f = 1 repeat uo.print('Walk to tree #' + STR(f)) GotoXY(treeX[f], treeY[f]) Lumber(treeTile[f], treeX[f], treeY[f], treeZ[f]) if (uo.weight > uo.str*3.2) then uo.print('Walk to unload') GotoXY(treeX[0], treeY[0]) unload('0x1BDD', '0x0000', 2) #Logs unload('0x0F90', '0x0044', 2) #Dead wood end if f = f + 1 if (f >= trees) then f = 1 end if until uo.life == 0 uo.print('you dead') end sub
sub setup() dim tileArr[100] dim xArr[100] dim yArr[100] dim zArr[100] uo.AddType('hatchet', '0x0F43') uo.saveconfig() var points = markPoints(tileArr, xArr, yArr, zArr) savePointsTXYZ(tileArr, xArr, yArr, zArr, 'tree.txt', points) end sub
sub Lumber(tile, x, y, z) var msg1 = 'You place' var msg2 = 'You fail to get' var msg3 = "There's not enough wood here to chop" var msg4 = 'That is too far away' var msg5 = 'attacking you' var done = 0 var counter = 0 var delay = 500 uo.deletejournal() uo.waittargettile(tile, x, y, z) uo.usetype('hatchet') repeat if (uo.injournal(msg1) or uo.injournal(msg2)) then #i?ioann eaao counter = 0 end if if (uo.injournal(msg3) or uo.injournal(msg4)) then #i?ioann caeii?eeny done = 1 end if if (counter > 10000) then #i?ioann ia eaao, i?iaoai ia?aou niiaa CheckLag() if (uo.targeting()) then uo.waittargettile(tile, x, y, z) end if uo.waittargettile(tile, x, y, z) uo.usetype('hatchet') counter = 0 end if uo.deletejournal() wait(delay) counter = counter + delay until done or uo.Life == 0 end sub
sub unLoad(type, color, distance) var inBackpack = '' var onGround = '' uo.Set('finddistance', distance) uo.FindType(type, color, 'ground') if (uo.FindCount()) then onGround = uo.GetSerial('finditem') end if uo.FindType(type, color) if (uo.FindCount()) then inBackpack = uo.GetSerial('finditem') end if if (onGround <> '' and inBackpack <> '') then var x, y, z x = uo.GetX(onGround) y = uo.GetY(onGround) z = uo.GetZ(onGround) CheckLag() uo.MoveItem(inBackpack, 0, onGround, x, y, z) wait(1500) CheckLag() end if uo.Set('finddistance', 14) end sub
sub markPoints(tileArr, xArr, yArr, zArr) var count = 0 var done = 0 var tile, x, y, z repeat uo.UseType('hatchet') wait(1000) while uo.targeting() wait(500) wend tile = uo.LastTile(0) x = uo.LastTile(1) y = uo.LastTile(2) z = uo.LastTile(3) if (x == uo.GetX() and y == uo.GetY()) then done = 1 else tileArr [count]= tile xArr [count]= x yArr [count]= y zArr [count]= z count = count + 1 uo.print('Added point #' + STR(count) + ' (' + STR(x) +', ' + STR(y) + ')') end if until done uo.print('Done. ' + STR(count) + ' points added') return count end sub
sub savePointsTXYZ(tileArr, xArr, yArr, zArr, name, cnt) var fl = File(name) fl.open() fl.create() safecall fl.writeln(STR(cnt)) for var f = 0 to cnt - 1 safecall fl.writeln(STR(tileArr[f]) + ' ' + STR(xArr[f]) + ' ' + STR(yArr[f]) + ' ' + STR(zArr[f])) next uo.print(STR(cnt) + ' points saved') fl.close() end sub
sub loadPointsTXYZ(tileArr, xArr, yArr, zArr, name) var fl = File(name) fl.open() var cnt = safecall fl.ReadNumber() for var f = 0 to cnt - 1 tileArr [f]= safecall fl.ReadNumber() xArr [f]= safecall fl.ReadNumber() yArr [f]= safecall fl.ReadNumber() zArr [f]= safecall fl.ReadNumber() next fl.close() uo.print(STR(cnt) + ' points loaded') return cnt end sub
sub CheckLag() if (uo.Waiting() or uo.targeting()) then uo.canceltarget() end if uo.DeleteJournal() uo.Click('backpack') repeat wait(100) until uo.InJournal('backpack') uo.DeleteJournal() 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
|
|
| |