SRL Archive - OSR Help

Why is this an out of range?


Cigue

2010-01-28 17:50:29

for i := 0 to 1 do
begin
BarrierSearchBoxes[i].x1 := MSX1 + ((MSX2-MSX1) /5) * (i div 5));//Identifier expected @ just after div
BarrierSearchBoxes[i].x2 := MSX1 + ((MSX2-MSX1) /5) * ((i div 5) + 1));
BarrierSearchBoxes[i].y1 := MSY1 + ((MSY2-MSY1) /5) * (i mod 5));
BarrierSearchBoxes[i].y2 := MSY1 + ((MSY2-MSY1) /5) * ((i mod 5) + 1));
end;

Frement

2010-01-28 17:52:17

1 extra ) in every line.

Wanted

2010-01-28 17:52:26

SetLength(BarrierSearchBoxes, 2);

Cigue

2010-01-28 17:53:58

From: IceFire908
Nothing wrong with that.

SetLength(BarrierSearchBoxes, 2);


What is THAT

Wanted

2010-01-28 17:55:04

From: Frement
1 extra ) in every line.


From: Cigue
What is THAT


You need to set an array length silly boi :bart:

Cigue

2010-01-28 17:58:21

sorry, I'd forgotten all about arrays >.<

Runescapian321

2010-01-28 17:58:41

From: Cigue
What is THAT


It sets the length of the array so that array[0] and array[1] (which you try accessing in that loop, creating the out of range error) are initialized. In addition, you're missing an opening parentheses "(" on each line:

for i := 0 to 1 do
begin
BarrierSearchBoxes[i].x1 := MSX1 + (((MSX2-MSX1) /5) * (i div 5));//Identifier expected @ just after div
BarrierSearchBoxes[i].x2 := MSX1 + (((MSX2-MSX1) /5) * ((i div 5) + 1));
BarrierSearchBoxes[i].y1 := MSY1 + (((MSY2-MSY1) /5) * (i mod 5));
BarrierSearchBoxes[i].y2 := MSY1 + (((MSY2-MSY1) /5) * ((i mod 5) + 1));
end;

Cigue

2010-01-28 18:02:06

Allright, but I still get identifier expected :S how does div works?

Wanted

2010-01-28 18:03:56

From: Cigue
Allright, but I still get identifier expected :S how does div works?


div divides and leaves off decimal points, your identifier error was from not having an equal amount of open and close parentheses.

Cigue

2010-01-28 18:04:49

okay thanks :)

One last… PixelShiftMulti lags so badly that it freezes the screen, so when it looks for animations it returns nothing because screen is frozen (lol.)

what do I do :(

Wanted

2010-01-28 18:06:32

From: Cigue
okay thanks :)

One last… PixelShiftMulti lags so badly that it freezes the screen, so when it looks for animations it returns nothing because screen is frozen (lol.)

what do I do :(


Don't use it then?

Bionicle

2010-01-28 18:07:16

From: Cigue
okay thanks :)

One last… PixelShiftMulti lags so badly that it freezes the screen, so when it looks for animations it returns nothing because screen is frozen (lol.)

what do I do :(


Unfortunatly, i don't think there is anything you can do. I had this same problem when i used Animating (which uses PixelShift, which should be less laggy then PixelShiftMulti) to detect whether my character was moving or not. It lagged, just the slightest bit, and it came back false even when it was true.

Camaro'

2010-01-28 18:07:52

From: Tad
It sets the length of the array so that array[0] and array[1] (which you try accessing in that loop, creating the out of range error) are initialized. In addition, you're missing an opening parentheses "(" on each line:

for i := 0 to 1 do
begin
BarrierSearchBoxes[i].x1 := MSX1 + (((MSX2-MSX1) /5) * (i div 5));//Identifier expected @ just after div
BarrierSearchBoxes[i].x2 := MSX1 + (((MSX2-MSX1) /5) * ((i div 5) + 1));
BarrierSearchBoxes[i].y1 := MSY1 + (((MSY2-MSY1) /5) * (i mod 5));
BarrierSearchBoxes[i].y2 := MSY1 + (((MSY2-MSY1) /5) * ((i mod 5) + 1));
end;


This fixes the error for me….?

Cigue

2010-01-28 18:10:20

Oh well, it's all sorted out (althought pixelshiftmulti won't work). thank you guys :) you rock !