Прошу помоши! Скрипт лумбер + ходилка.
Posted: 2009-04-03 16:58:51
Как то криво работает сама ходилка. Не понимаю в чем дело.
Может ли кто помочь. Персонаж на отказ не хочет идти на East. Не могу понять почему! ведь вроде бы все правильно написано.
Переходя от дерева от дерева к дереву не хочет идти на East, вместо этого делает шаги West - North - West....
Сорри если не правиьно оформил топик(
sub lumber()
chop( 3299 , 680 , 1137 , 0 )
wait(250)
end sub
sub dir(dr)
wait(300)
var a=uo.getdir("self")
if dr<>a then
if dr==0 then
uo.press(33)
wait(300)
uo.print(dr)
endif
if dr==1 then
uo.press(39)
wait(300)
uo.print(dr)
endif
if dr==2 then
uo.press(34)
wait(300)
uo.print(dr)
endif
if dr==3 then
uo.press(40)
wait(300)
uo.print(dr)
endif
if dr==4 then
uo.press(35)
wait(300)
uo.print(dr)
end if
if dr==5 then
uo.press(37)
wait(300)
uo.print(dr)
endif
if dr==6 then
uo.press(36)
wait(300)
uo.print(dr)
endif
if dr==7 then
uo.press(38)
wait(300)
uo.print(dr)
endif
endif
end sub
sub moveto(x, y)
var xch, ych, dch, a=0
while x < uo.getx("self") and y < uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(38)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(3)
uo.press(40)
wait(300)
dir(5)
uo.press(37)
wait(300)
endif
if x == uo.getx("self") && y == uo.gety("self") then
return
end if
wend
while x > uo.getx("self") and y < uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(39)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(5)
uo.press(37)
wait(300)
dir(7)
uo.press(38)
wait(300)
endif
wend
while x > uo.getx("self") and y > uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(40)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(7)
uo.press(38)
wait(300)
dir(1)
uo.press(39)
wait(300)
endif
if x == uo.getx("self") && y == uo.gety("self") then
return x
end if
wend
while x < uo.getx("self") and y > uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(37)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(1)
uo.press(39)
wait(300)
dir(3)
uo.press(40)
wait(300)
endif
wend
movetostart:
while x < uo.getx("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(36)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(2)
uo.press(34)
wait(300)
dir(4)
uo.press(35)
wait(300)
endif
wend
while y < uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(33)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(4)
uo.press(35)
wait(300)
dir(6)
uo.press(36)
wait(300)
endif
wend
while x > uo.getx("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(34)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(6)
uo.press(36)
wait(300)
dir(0)
uo.press(33)
wait(300)
endif
wend
while y > uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(35)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(0)
uo.press(33)
wait(300)
dir(2)
uo.press(34)
wait(300)
endif
wend
if a==1 then
a=0
goto movetostart
endif
end sub
sub chop(tile, x, y, z)
moveto(x-1, y-1)
var a = 0
UO.DeleteJournal()
UO.Print (STR(x))
UO.Print (STR(y))
while uo.injournal("There are no logs")==0 and uo.injournal("That`s too far away to chop.")==0 and a<>15 and uo.injournal("chop")==0
uo.deletejournal()
uo.exec("waittargettile '"+STR(tile)+"' '"+STR(x)+"' '"+STR(y)+"' '"+STR(z)+"'")
#wait(3000)
wait(150)
uo.usetype("0x0f43")
wait(500)
while uo.injournal("Âû ïîëîæèëè")==0 AND uo.injournal("fail to")==0 AND uo.injournal("Targeting Cancelled")==0 AND uo.injournal("chop")==0 and UO.InJournal("There are no logs")==0
wait(200)
wend
a=a+1
if uo.injournal("oak")<>0 then
wait(2000)
endif
if uo.injournal("elven")<>0 then
wait(2000)
endif
if uo.injournal("deadwood")<>0 then
wait(2000)
endif
wend
wait(500)
uo.deletejournal()
uo.print(a)
end sub
Может ли кто помочь. Персонаж на отказ не хочет идти на East. Не могу понять почему! ведь вроде бы все правильно написано.
Переходя от дерева от дерева к дереву не хочет идти на East, вместо этого делает шаги West - North - West....
Сорри если не правиьно оформил топик(
sub lumber()
chop( 3299 , 680 , 1137 , 0 )
wait(250)
end sub
sub dir(dr)
wait(300)
var a=uo.getdir("self")
if dr<>a then
if dr==0 then
uo.press(33)
wait(300)
uo.print(dr)
endif
if dr==1 then
uo.press(39)
wait(300)
uo.print(dr)
endif
if dr==2 then
uo.press(34)
wait(300)
uo.print(dr)
endif
if dr==3 then
uo.press(40)
wait(300)
uo.print(dr)
endif
if dr==4 then
uo.press(35)
wait(300)
uo.print(dr)
end if
if dr==5 then
uo.press(37)
wait(300)
uo.print(dr)
endif
if dr==6 then
uo.press(36)
wait(300)
uo.print(dr)
endif
if dr==7 then
uo.press(38)
wait(300)
uo.print(dr)
endif
endif
end sub
sub moveto(x, y)
var xch, ych, dch, a=0
while x < uo.getx("self") and y < uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(38)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(3)
uo.press(40)
wait(300)
dir(5)
uo.press(37)
wait(300)
endif
if x == uo.getx("self") && y == uo.gety("self") then
return
end if
wend
while x > uo.getx("self") and y < uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(39)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(5)
uo.press(37)
wait(300)
dir(7)
uo.press(38)
wait(300)
endif
wend
while x > uo.getx("self") and y > uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(40)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(7)
uo.press(38)
wait(300)
dir(1)
uo.press(39)
wait(300)
endif
if x == uo.getx("self") && y == uo.gety("self") then
return x
end if
wend
while x < uo.getx("self") and y > uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(37)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(1)
uo.press(39)
wait(300)
dir(3)
uo.press(40)
wait(300)
endif
wend
movetostart:
while x < uo.getx("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(36)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(2)
uo.press(34)
wait(300)
dir(4)
uo.press(35)
wait(300)
endif
wend
while y < uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(33)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(4)
uo.press(35)
wait(300)
dir(6)
uo.press(36)
wait(300)
endif
wend
while x > uo.getx("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(34)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(6)
uo.press(36)
wait(300)
dir(0)
uo.press(33)
wait(300)
endif
wend
while y > uo.gety("self")
a=1
xch=uo.getx("self")
ych=uo.gety("self")
dch=uo.getdir("self")
uo.press(35)
wait(350)
if xch==uo.getx("self") and ych==uo.gety("self") and dch==uo.getdir("self") then
dir(0)
uo.press(33)
wait(300)
dir(2)
uo.press(34)
wait(300)
endif
wend
if a==1 then
a=0
goto movetostart
endif
end sub
sub chop(tile, x, y, z)
moveto(x-1, y-1)
var a = 0
UO.DeleteJournal()
UO.Print (STR(x))
UO.Print (STR(y))
while uo.injournal("There are no logs")==0 and uo.injournal("That`s too far away to chop.")==0 and a<>15 and uo.injournal("chop")==0
uo.deletejournal()
uo.exec("waittargettile '"+STR(tile)+"' '"+STR(x)+"' '"+STR(y)+"' '"+STR(z)+"'")
#wait(3000)
wait(150)
uo.usetype("0x0f43")
wait(500)
while uo.injournal("Âû ïîëîæèëè")==0 AND uo.injournal("fail to")==0 AND uo.injournal("Targeting Cancelled")==0 AND uo.injournal("chop")==0 and UO.InJournal("There are no logs")==0
wait(200)
wend
a=a+1
if uo.injournal("oak")<>0 then
wait(2000)
endif
if uo.injournal("elven")<>0 then
wait(2000)
endif
if uo.injournal("deadwood")<>0 then
wait(2000)
endif
wend
wait(500)
uo.deletejournal()
uo.print(a)
end sub