В некоторых частях скрипта используется goto и именно на нее происходит ругань. А именно. Запускаю скрипт, он летит по руне как пологается, встает на нужную точку и начинает копать. Как накопал улетает домой, сгружается, пополняет запасы и снова летит к шахте. И вот когда чар прилетает и должен идти к точке копания, то на этом месте вылазиет ошибка "Line 44: GoTo - некорректное определение цикла в скрипте?!!"
Как вылечить и почему эта ошибка возникает?
вот код (помечу 44 строчку, на которую ругается)
Code: Select all
sub start()
uo.Exec('exec Avtohealing')
uo.Exec('exec Speak')
uo.Exec('exec Drap')
UO.Set('finddistance','3')
uo.WarMode(1)
wait(1000)
uo.setarm("1")
wait(1000)
uo.deletejournal()
wait(500)
letimkopat()
endsub
sub letimkopat()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
wait(5000)
uo.disarm()
wait(500)
UO.Exec("useobject '0x79ED63A2'")
wait(1000)
UO.LClick (62,81)
wait(7000)
if uo.injournal ("Kal Ort Por") then
uo.deletejournal()
wait(1000)
uo.arm("1")
wait(500)
idemkopat()
else
letimkopat()
endif
end sub
sub idemkopat()
var q,w,e,r
q=23
e=10
w=0
r=0 #44 строчка на которую скрипт ругается.
while not uo.dead()
first:
if q==w then
w=0
goto second
else
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
uo.press(33)
wait(500)
w=w+1
goto first
endif
second:
if e==r then
r=0
uo.press(35)
wait(1000)
uo.press(35)
wait(1000)
uo.press(34)
wait(1000)
mining()
else
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
uo.press(36)
wait(500)
r=r+1
goto second
endif
wait(1000)
wend
end sub
sub domoy()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
wait(10000)
uo.disarm()
wait(500)
UO.Exec("useobject '0x79ED63A2'")
wait(1000)
UO.LClick (62,66)
uo.press(36)
wait(100)
uo.press(36)
wait(100)
uo.press(36)
wait(100)
uo.press(36)
wait(100)
uo.press(36)
wait(100)
uo.press(36)
wait(100)
uo.press(36)
wait(100)
uo.press(36)
wait(100)
wait(5000)
if uo.injournal ("a unicorn") then
uo.deletejournal()
uo.press(36)
wait(1000)
uo.press(36)
wait(1000)
uo.press(34)
wait(1000)
uo.press(34)
wait(1000)
drop()
else
domoy()
endif
end sub
sub drop()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
uo.msg("Âûãðóæàþ ðóäó")
if uo.count("0x19B9") >0 then
UO.exec("waittargetobject '^0x19B9'")
UO.Drop('^0x19B9')
wait(1000)
drop()
else
wait(1000)
recharge()
endif
end sub
sub recharge()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
uo.msg("Ñîáèðàþñü çàðÿäèòü ðóíáóê")
wait(1000)
UO.Exec("waittargetobject '~0x1F4C'")
UO.Exec("useobject '0x79ED63A2'")
wait(1000)
UO.LClick (243,22)
wait(20000)
uo.msg("Ìîþ ãðÿçíûå áèíòû")
wait(1000)
UO.Exec("waittargetobject '~0x0E7B'")
UO.Exec("useobject '^0x0E20'")
wait(1000)
bandage()
end sub
sub bandage()
while not uo.dead()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
uo.msg("Ñîáèðàþñü ïîïîëíèòü çàïàñû áèíòîâ")
wait(1000)
if uo.count('0x0E21')>100 then
uo.msg("Áèíòîâ áîëüøå 100 øòóê")
wait(1000)
eda()
else
UO.Exec("moveitem '~0x0E21' '10' '^0x0E75'")
wait(1000)
uo.msg("Áåðó 10 áèíòîâ")
wait(1000)
endif
wend
end sub
sub eda()
while not uo.dead()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
uo.msg("Ñîáèðàþñü ïîïîëíèòü çàïàñû åäû")
wait(1000)
if uo.count('0x171F')>0 then
uo.msg("Åäû áîëüøå 5")
wait(1000)
letimkopat()
else
uo.msg("Áåðó Åäó")
wait(1000)
UO.Exec("moveitem '~0x171F' '1' '^0x0E75'")
wait(1000)
endif
wend
end sub
sub speak()
while not uo.dead()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
uo.msg("Êà÷àþ ìèíèíã! Ñêàæè drîp me è ÿ âûáðîøó âñþ ðóäó!")
wait(7500)
wend
end sub
sub drap()
while not uo.dead()
if uo.injournal ("drop me") then
uo.deletejournal()
wait(1000)
drapactive()
endif
wait(1000)
wend
end sub
sub drapactive()
while uo.count("0x19B9")>0
UO.exec("waittargetobject '^0x19B9'")
UO.Drop('^0x19B9')
uo.msg("Ñáðàñûâàåì...")
wait(1000)
wend
end sub
sub Avtohealing()
var x=1
while not uo.dead()
if (UO.STR-x) > UO.Life then
uo.msg(".bandage self")
wait(1000)
endif
wait(1000)
wend
end sub
sub mining()
var i,j,n,m,r
i=0
j=0
n=15
m=4
r=0
begin:
while not uo.dead()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
if j==m then
uo.press(33)
wait(1000)
uo.press(33)
wait(1000)
uo.press(36)
wait(1000)
j=0
goto back
else
if r==1 then
goto west
else
goto east
endif
endif
wend
east:
while not uo.dead()
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
if i<n then
goto kopalka1
else
uo.press(35)
wait(1000)
uo.press(35)
wait(1000)
uo.press(36)
wait(1000)
i=0
j=j+1
r=r+1
endif
uo.exec("usetype '0x171F'")
goto begin
wend
west:
while not uo.dead()
if uo.Weight>=20000 or uo.count('0x0E21')<10 then
domoy()
endif
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
if i<n then
goto kopalka2
else
uo.press(35)
wait(1000)
uo.press(35)
wait(1000)
uo.press(34)
wait(1000)
i=0
j=j+1
r=0
endif
uo.exec("usetype '0x171F'")
goto begin
wend
back:
while not uo.dead()
if uo.Weight>=20000 or uo.count('0x0E21')<10 then
domoy()
endif
if uo.injournal ("Saving World State") then
wait(20000)
uo.deletejournal()
endif
if j<m then
wait(50)
uo.press(33)
wait(1000)
j=j+1
goto back
else
uo.press(34)
wait(1000)
j=0
uo.exec("usetype '0x171F'")
wait(50)
goto begin
endif
wend
kopalka1:
while not uo.dead()
uo.msg(".pray")
wait(100)
uo.exec("usetype 'pickaxe'")
wait(500)
UO.LClick (403,303)
wait(5000)
if uo.injournal ("There is no") then
uo.deletejournal()
uo.press(34)
wait(1000)
i=i+1
goto east
else
goto kopalka1
endif
uo.exec("usetype '0x171F'")
goto begin
wend
kopalka2:
while not uo.dead()
uo.msg(".pray")
wait(100)
uo.exec("usetype 'pickaxe'")
wait(500)
UO.LClick (403,303)
wait(5000)
if uo.injournal ("There is no") then
uo.deletejournal()
uo.press(36)
wait(1000)
i=i+1
goto west
else
goto kopalka2
endif
uo.exec("usetype '0x171F'")
goto begin
wend
end sub