SRL Archive - Help and Support

daaam runtime error!!


Naike

2008-08-23 12:20:01

Procedure PickUp;
var
Iteems : array of TGroundItem;
a, b : integer;
begin
FindGroundItems(Iteems, [806, 807, 808, 809, 810, 403], 3);
b := GetArrayLength(Iteems);
For a:= 0 to High(b)do
begin
Mouse(Iteems[a].MS.x, Iteems[a].MS.y, 2, 2, False); <--- Line 147
If Not ChooseOption('art')Then
ChooseOption('idible');
end;
end;

[Runtime Error] : Out Of Range in line 147 in script C:\Program\SCAR 3.15\Scripts\Anti-Crab0,39.scar

Its a pain :D

Method

2008-08-23 12:24:37

From: N1ke!
Procedure PickUp;
var
Iteems : array of TGroundItem;
a, b : integer;
begin
FindGroundItems(Iteems, [806, 807, 808, 809, 810, 403], 3);
b := GetArrayLength(Iteems);
For a:= 0 to High(b)do
begin
Mouse(Iteems[a].MS.x, Iteems[a].MS.y, 2, 2, False);
If Not ChooseOption('art')Then
ChooseOption('idible');
end;
end;

[Runtime Error] : Out Of Range in line 147 in script C:\Program\SCAR 3.15\Scripts\Anti-Crab0,39.scar

Its a pain :D


What's line 147? Also, why do you assign the array length to b then use High? Just do High(Iteems) and go from there.

Naike

2008-08-23 12:33:27

Line 147 is marked out now…

Look for <— line 147 :)

Nava2

2008-08-23 12:34:24

Can you post the TGroundItem type?

Naike

2008-08-23 12:37:37

Are you to lazy to go to Reflections, Items.scar ? or you didnt know it was there?

Type
TGroundItem = Record
MS, Tile: TPoint;
ID, StackSize: Integer;
End;

Method

2008-08-23 12:42:03

Do you still receive the error if you run it with my changes?

Naike

2008-08-23 12:51:31

Works now, Thank you method :)

JuKKa

2008-08-23 12:59:52

u cant use chooseoption like that, you would have to right click again, because chooseoption moves the mouse away so the chooseoption box dissapears…

Metagen

2008-08-29 16:22:14

why are you using High(b), b is an integer, just use b - 1 or b or whatever you need