Господа срочно нужна ваша помощь аборигенам с Zulu , у нас катастрофа - не рубятся пальмы
Чар находится в пространстве в 2ве клетки которые со всех сторон окружены банановыми деревьями и там рубит , при запуске скрипта с любым значением радиуса чар просто куда то хочет убежать , но уж точно не рубить.
Буду безгранично признателен за любую помощь или совет .
sub main() lumberjack(5) # В склбках указать радиус деревьев end sub sub lumberjack(distance) var this_tree, treenum=0, tree_num,x,y, hatchet dim tree[4] tree[0]="0x0DA6" # - pear tree tree[1]="0x0D9E" # - peach tree tree[2]="0x0CAA" # - banana tree tree[3]="0x0D9A" # - apple tree hatchet="0x0f49" # Тип топора uo.disarm() uo.ignorereset() uo.set("finddistance",str(distance)) repeat tree_num=0 repeat uo.findtype(tree[tree_num],"-1","ground") this_tree=uo.getserial("finditem") tree_num=tree_num+1 until tree_num>3 or this_tree<>"0x00000000" if this_tree<>"0x00000000" then treenum=treenum+1 uo.waittargetobject(this_tree) uo.addobject("tree"+str(treenum)) uo.ignore(this_tree) endif until this_tree=="0x00000000" uo.ignorereset() while not uo.dead() for tree_num=1 to treenum if uo.dead() then return endif this_tree=uo.getserial("tree"+str(tree_num)) go_to(this_tree) uo.deletejournal() uo.waittargetobject(this_tree) uo.usetype(hatchet) repeat wait(100) until uo.injournal("away") or uo.injournal("stop lumberjacking.") next wend end sub sub go_to(what) var x,y,dist_x,dist_y,dx,dy repeat dist_x=uo.getx()-uo.getx(what) dist_y=uo.gety()-uo.gety(what) dx=35+sign(dist_x) dy=34-sign(dist_y) x=uo.getx() y=uo.gety() if abs(dist_x)>2 then uo.press(dx) uo.press(dx) endif if abs(dist_y)>2 then uo.press(dy) uo.press(dy) endif if abs(dist_x)==abs(dist_y) and abs(dist_y)>2 then if dx==36 and dy==33 then uo.press(38) uo.press(38) endif if dx==36 and dy==35 then uo.press(37) uo.press(37) endif if dx==34 and dy==33 then uo.press(39) uo.press(39) endif if dx==34 and dy==35 then uo.press(40) uo.press(40) endif endif until abs(dist_x)<=2 and abs(dist_y)<=2 end sub sub abs(x) var y if x<0 then y=-x else y=x endif return y end sub sub sign(what) var ret if what<0 then ret=-1 else ret=1 endif return ret end sub sub grabs() var what repeat uo.findtype("0x0E76","-1","ground") what=uo.getserial("finditem") if what<>"0x00000000" then uo.waittargetobject(what) uo.grab() uo.ignore(what) endif until what=='0x00000000' end sub
Last edited by PAIN^j18.9 on 2005-06-15 04:13:58, edited 1 time in total.
PAIN^j18.9 wrote:Господа срочно нужна ваша помощь аборигенам с Zulu , у нас катастрофа - не рубятся пальмы
Чар находится в пространстве в 2ве клетки которые со всех сторон окружены банановыми деревьями и там рубит , при запуске скрипта с любым значением радиуса чар просто куда то хочет убежать , но уж точно не рубить.
Буду безгранично признателен за любую помощь или совет .
sub main() lumberjack(5) # В склбках указать радиус деревьев end sub sub lumberjack(distance) var this_tree, treenum=0, tree_num,x,y, hatchet dim tree[4] tree[0]="0x0DA6" # - pear tree tree[1]="0x0D9E" # - peach tree tree[2]="0x0CAA" # - banana tree tree[3]="0x0D9A" # - apple tree hatchet="0x0f49" # Тип топора uo.disarm() uo.ignorereset() uo.set("finddistance",str(distance)) repeat tree_num=0 repeat uo.findtype(tree[tree_num],"-1","ground") this_tree=uo.getserial("finditem") tree_num=tree_num+1 until tree_num>3 or this_tree<>"0x00000000" if this_tree<>"0x00000000" then treenum=treenum+1 uo.waittargetobject(this_tree) uo.addobject("tree"+str(treenum)) uo.ignore(this_tree) endif until this_tree=="0x00000000" uo.ignorereset() while not uo.dead() for tree_num=1 to treenum if uo.dead() then return endif this_tree=uo.getserial("tree"+str(tree_num)) go_to(this_tree) uo.deletejournal() uo.waittargetobject(this_tree) uo.usetype(hatchet) repeat wait(100) until uo.injournal("away") or uo.injournal("stop lumberjacking.") next wend end sub sub go_to(what) var x,y,dist_x,dist_y,dx,dy repeat dist_x=uo.getx()-uo.getx(what) dist_y=uo.gety()-uo.gety(what) dx=35+sign(dist_x) dy=34-sign(dist_y) x=uo.getx() y=uo.gety() if abs(dist_x)>2 then uo.press(dx) uo.press(dx) endif if abs(dist_y)>2 then uo.press(dy) uo.press(dy) endif if abs(dist_x)==abs(dist_y) and abs(dist_y)>2 then if dx==36 and dy==33 then uo.press(38) uo.press(38) endif if dx==36 and dy==35 then uo.press(37) uo.press(37) endif if dx==34 and dy==33 then uo.press(39) uo.press(39) endif if dx==34 and dy==35 then uo.press(40) uo.press(40) endif endif until abs(dist_x)<=2 and abs(dist_y)<=2 end sub sub abs(x) var y if x<0 then y=-x else y=x endif return y end sub sub sign(what) var ret if what<0 then ret=-1 else ret=1 endif return ret end sub sub grabs() var what repeat uo.findtype("0x0E76","-1","ground") what=uo.getserial("finditem") if what<>"0x00000000" then uo.waittargetobject(what) uo.grab() uo.ignore(what) endif until what=='0x00000000' end sub