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

Ask for help

Moderators: Murderator+, Murderator

Post Reply
Toretto
Posts: 12
Joined: 2004-11-26 16:43:57
Location: Королёв М.О.

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

Post 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 
666Man666
Junior Expert
Posts: 474
Joined: 2004-11-13 00:43:55
Location: Киберзадроцк
Contact:

Post by 666Man666 »

Зачем ты написал MRuna[NRuna] ешё и в ковычках??? попробуй просто без ковычек один раз написать RecallRune(MRuna)
AlexeyVorotnikov
Junior Expert
Posts: 138
Joined: 2004-09-18 15:12:06

Post by AlexeyVorotnikov »

Индексы массивов начинаются с 0. Т.е. если ты объявил массив как

Code: Select all

DIM MRuna[5]
то использовать можно элементы от MRuna[0] до MRuna[4]
Askaneli
Sphere expert
Posts: 1143
Joined: 2004-10-01 08:27:38
Location: Уфа

Post by Askaneli »

Во блин !!!
Увеличь размерность массива просто !!!
У меня почему-то работает и так !!!
тем более что у тебя рунок 5 а проверяешь ты на 6
Поставь проверку на 5 уж тада
Сделал дело - флуди смело !!!
Askaneli
Sphere expert
Posts: 1143
Joined: 2004-10-01 08:27:38
Location: Уфа

Post by Askaneli »

AlexeyVorotnikov wrote:Индексы массивов начинаются с 0. Т.е. если ты объявил массив как

Code: Select all

DIM MRuna[5]
то использовать можно элементы от MRuna[0] до MRuna[4]
Использовать можно с 0 до 5 !!! То есть 6 элементов массива !!!
Сделал дело - флуди смело !!!
Askaneli
Sphere expert
Posts: 1143
Joined: 2004-10-01 08:27:38
Location: Уфа

Post by Askaneli »

666Man666 wrote:Зачем ты написал MRuna[NRuna] ешё и в ковычках??? попробуй просто без ковычек один раз написать RecallRune(MRuna)
Это обращение к элементу массива, так и должно быть !!!
Сделал дело - флуди смело !!!
666Man666
Junior Expert
Posts: 474
Joined: 2004-11-13 00:43:55
Location: Киберзадроцк
Contact:

Post by 666Man666 »

Асканели харош флудить...
Askaneli
Sphere expert
Posts: 1143
Joined: 2004-10-01 08:27:38
Location: Уфа

Post by Askaneli »

666Man666 wrote:Асканели харош флудить...
Блин , приятно коментировать свою модификацию скрипта !!!
Сделал дело - флуди смело !!!
AGRS
Expert!
Posts: 1007
Joined: 2004-04-04 21:40:09
Contact:

Post by AGRS »

666Man666 wrote:Асканели харош флудить...
А у него постов меньше чем у тебя. :roll: :mrgreen:
Toretto
Posts: 12
Joined: 2004-11-26 16:43:57
Location: Королёв М.О.

Post by Toretto »

AlexeyVorotnikov wrote:Индексы массивов начинаются с 0. Т.е. если ты объявил массив как

Code: Select all

DIM MRuna[5]
то использовать можно элементы от MRuna[0] до MRuna[4]
Сделал так, заработало! :)
Askaneli
Sphere expert
Posts: 1143
Joined: 2004-10-01 08:27:38
Location: Уфа

Post by Askaneli »

AGRS wrote:
666Man666 wrote:Асканели харош флудить...
А у него постов меньше чем у тебя. :roll: :mrgreen:
Да !!! Обидно даже !!!
Сделал дело - флуди смело !!!
Arsys
Posts: 30
Joined: 2004-11-21 21:45:20

Post by Arsys »

[ quote=".AlexeyVorotnikov"]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?
AlexeyVorotnikov
Junior Expert
Posts: 138
Joined: 2004-09-18 15:12:06

Post by AlexeyVorotnikov »

Arsys wrote:[ quote=".AlexeyVorotnikov"]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.
JIoRD
Posts: 8
Joined: 2004-11-30 22:52:17
Contact:

Post by JIoRD »

слущайтк а это на какую шахту ?? просто чуть со стула не упал когда такой скрипт увидел ))
Post Reply