Page 1 of 1

Помогите плиз найти ошибку.

Posted: 2005-01-14 04:56:57
by Toretto
Вот скрипт на майнинг (Переделанный Шахтёр 2.3 с рунбуков на руны)
Проблемма в том, что когда чар доходит до последней рунки
if NRuna>6 then
NRuna=1
вылетает ошибка "Unhandled error in parser" (вроде так)

Помогите плиз найти ошибку, если не сложно.

Вот скрипт:

Code: Select all

Var DRuna='0x406FF2E9' ; АЙДИ рунки домой 
Var NRuna=1
Var UnloadCont='0x402FFA68' ; АЙДИ сундука для руды

sub maning()
var mx, my, mz, i, j, jor, ser, noto
DIM MRuna[5] ; Массив из АЙДИ рунок в шахты
MRuna[1]='0x40B3734E'
MRuna[2]='0x40B3734A'
MRuna[3]='0x40B378B5'
MRuna[4]='0x40B378B3'
MRuna[5]='0x40B3734D'

uo.print('!!SELECT PICKAXE!! ')
uo.exec('addobject Shovel')
while uo.targeting()
wait(100)
wend

na4alo:
mx = UO.GetX("self")
my = UO.GetY("self")
mz = UO.GetZ("self")
UO.DeleteJournal()
for i = mx-4 to mx+4
for j = my -4 to my+4
while not UO.Hidden()
UO.Warmode("0")
uo.print("Hiding...")
UO.UseSkill("Hiding")
wait(4000)
wend
UO.Print("Mining in: "+str(mx-i)+" "+str(my-j))
infologs()
while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock")
##while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock") and not UO.InJournal("Iron Ore")
UO.DeleteJournal()
if uo.waiting() then
uo.canceltarget()
endif
UO.Waittargettile("1341", str(i), str(j), str(mz))
UO.Useobject("Shovel")
while not UO.InJournal("You put") and not UO.InJournal("heavy") and not UO.InJournal("location") and not UO.InJournal("no ore") and not UO.InJournal("but fail") and not UO.InJournal("far away") and not UO.InJournal("in rock")
wait (500)
if uo.injournal("heavy") then
##Pause()
endif
if uo.dead() then
##Pause()
endif
for jor = 0 to 9   
ser = uo.journalserial(jor)
noto = uo.getnotoriety(ser)

if noto <> 1 and noto <> 0 and not uo.injournal("elemental") then
if uo.waiting() then
uo.canceltarget()
endif
goto end
endif


next   
wend
if uo.weight > 550 then  ; Максимальный вес при котором домой с рудой
goto end
endif
wend
UO.DeleteJournal()
next
next
end:
if uo.waiting() then
uo.canceltarget()
endif
RecallRune(DRuna)
wait(5000)
while not UO.Hidden()
UO.Warmode("0")
uo.print("Hiding...")
UO.UseSkill("Hiding")
wait(4000)
wend
loot()


UO.SetReceivingContainer(UnloadCont)
Wait(100)
UO.Grab('0',MRuna[NRuna])
Wait(1000)
NRuna=NRuna+1
if NRuna>6 then
NRuna=1
endif
UO.UnSetReceivingContainer()
uo.useobject(UnloadCont)
Wait(100)
UO.Grab('0',MRuna[NRuna])
GetRegy()
wait(1000)
reccal:
uo.deletejournal()
if uo.waiting() then
uo.canceltarget()
endif
RecallRune(MRuna[NRuna])
wait(5000)
goto na4alo
end sub

sub GetRegy()
if uo.count('0x0F7B')<10 then
uo.FindType('0x0F7B',-1,UnloadCont) ;Blood Moss
wait(100)
uo.Grab('10','finditem')
wait(500)
end if
if uo.count('0x0F86')<10 then
uo.FindType('0x0F86',-1,UnloadCont) ;Mandrake Roots
wait(100)
uo.Grab('10','finditem')
wait(500)
end if
if uo.count('0x0F8D')<5 then
uo.FindType('0x0F8D',-1,UnloadCont) ;Spider's Silk
wait(100)
uo.Grab('5','finditem')
wait(500)
end if
if uo.count('0x0F7A')<5 then
uo.FindType('0x0F7A',-1,UnloadCont) ;Black Pearls
wait(100)
uo.Grab('5','finditem')
wait(500)
end if
end sub

sub loot()    ; перекладка руды в сундук
if uo.waiting() then
uo.canceltarget()
endif
VAR a,Exit
DIM Ore[20]
Ore[0]=0x19B9 ; 4 and more ore
Ore[1]=0x19B7 ; 1 ore
Ore[2]=0x19BA ; 2 ore
Ore[3]=0x19B8 ; 3 ore
Ore[4]=0x0F11 ; saphires
Ore[5]=0x0F16 ; amethysts
Ore[6]=0x0F18 ; tourmalines
Ore[7]=0x0F15 ; citrines
Ore[8]=0x0F10 ; emeralds
Ore[9]=0x0F0F ; star sapphires
Ore[10]=0x0F26 ; diamonds
Ore[11]=0x1F4C ; recall scrolls
Ore[12]=0x0EED ; gold
Ore[13]=0x0F20 ; tourmaline
UO.SetReceivingContainer(UnloadCont)
wait(500)
For a=0 to 13
Exit=0
repeat
UO.FindType(Ore[a])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
wait(1500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
end sub

sub RecallRune(rn) ; Рекол по рункам
var mx, my
reccal:
uo.deletejournal()
if uo.waiting() then
uo.canceltarget()
endif
mx = UO.GetX("self")
my = UO.GetY("self")
UO.DeleteJournal()
UO.Cast('Recall',rn)
wait(4000)
if not UO.GetX("self") <> mx and not UO.GetY("self") <> my then
goto reccal
endif
end sub

sub pwav() ; звук при выкапывании ЭЛЕМЕНТАЛА 
uo.playwav("C:\WINDOWS\Media\ding.wav")
endsub

sub pwavw(); звук при появлении ПК
uo.playwav("C:\WINDOWS\Media\ding.wav")
endsub

sub infologs()
UO.Print('You have '+Str(UO.Count('0x19B7')+UO.Count('0x19B8')+UO.Count('0x19B9')+UO.Count('0x19BA'))+' ore in backpack')
UO.Print('It's '+Str(UO.Count('0x19B7','0x0000')+UO.Count('0x19B8','0x0000')+UO.Count('0x19B9','0x0000')+UO.Count('0x19BA','0x0000'))+' айрон и ' +str(UO.Count('0x19B7')+UO.Count('0x19B8')+UO.Count('0x19B9')+UO.Count('0x19BA')-(UO.Count('0x19B7','0x0000')+UO.Count('0x19B8','0x0000')+UO.Count('0x19B9','0x0000')+UO.Count('0x19BA','0x0000')))+' colored ore')
end sub

Posted: 2005-01-14 06:57:38
by 666Man666
Зачем ты написал MRuna[NRuna] ешё и в ковычках??? попробуй просто без ковычек один раз написать RecallRune(MRuna)

Posted: 2005-01-14 10:46:07
by AlexeyVorotnikov
Индексы массивов начинаются с 0. Т.е. если ты объявил массив как

Code: Select all

DIM MRuna[5]

то использовать можно элементы от MRuna[0] до MRuna[4]

Posted: 2005-01-14 10:50:54
by Askaneli
Во блин !!!
Увеличь размерность массива просто !!!
У меня почему-то работает и так !!!
тем более что у тебя рунок 5 а проверяешь ты на 6
Поставь проверку на 5 уж тада

Posted: 2005-01-14 10:54:01
by Askaneli
AlexeyVorotnikov wrote:Индексы массивов начинаются с 0. Т.е. если ты объявил массив как

Code: Select all

DIM MRuna[5]

то использовать можно элементы от MRuna[0] до MRuna[4]

Использовать можно с 0 до 5 !!! То есть 6 элементов массива !!!

Posted: 2005-01-14 11:01:27
by Askaneli
666Man666 wrote:Зачем ты написал MRuna[NRuna] ешё и в ковычках??? попробуй просто без ковычек один раз написать RecallRune(MRuna)

Это обращение к элементу массива, так и должно быть !!!

Posted: 2005-01-14 11:10:22
by 666Man666
Асканели харош флудить...

Posted: 2005-01-14 11:56:50
by Askaneli
666Man666 wrote:Асканели харош флудить...

Блин , приятно коментировать свою модификацию скрипта !!!

Posted: 2005-01-14 12:05:28
by AGRS
666Man666 wrote:Асканели харош флудить...


А у него постов меньше чем у тебя. :roll: :mrgreen:

Posted: 2005-01-14 14:04:49
by Toretto
AlexeyVorotnikov wrote:Индексы массивов начинаются с 0. Т.е. если ты объявил массив как

Code: Select all

DIM MRuna[5]

то использовать можно элементы от MRuna[0] до MRuna[4]


Сделал так, заработало! :)

Posted: 2005-01-14 14:40:38
by Askaneli
AGRS wrote:
666Man666 wrote:Асканели харош флудить...


А у него постов меньше чем у тебя. :roll: :mrgreen:

Да !!! Обидно даже !!!

Posted: 2005-02-06 19:42:41
by Arsys
[ quote=&quot;.AlexeyVorotnikov&quot;]Indeksy massifs they
begin with 0. I.e. if you declared massif as [ code].DIM
MRuna[5][/.code ] that to use it is possible elements from MRuna[0 ]
to MRuna[4][/.quote ]

I don't understand this, i always have thought, that i.e. DIM[5], can be used elements from 1 to 5, and not from 0 to 4, can anyone confirm that?

Posted: 2005-02-06 21:45:01
by AlexeyVorotnikov
Arsys wrote:[ quote=&quot;.AlexeyVorotnikov&quot;]Indeksy massifs they
begin with 0. I.e. if you declared massif as [ code].DIM
MRuna[5][/.code ] that to use it is possible elements from MRuna[0 ]
to MRuna[4][/.quote ]

I don't understand this, i always have thought, that i.e. DIM[5], can be used elements from 1 to 5, and not from 0 to 4, can anyone confirm that?

In such languages as C and Java array indexes start from 0 and finish at array length - 1. Besause I write programs in Java on the hole, I tought that in Injection script its behave in the same way. But actually in Injection script if You declare array as DIM arr[5], You can use indexes from 0 to 5.

PS: sorry for my bad English.

Posted: 2005-02-11 15:45:47
by JIoRD
слущайтк а это на какую шахту ?? просто чуть со стула не упал когда такой скрипт увидел ))