SRL Archive - Help and Support

Need some help from YOU


Cazax

2008-04-05 14:45:04

Line 27: [Error] (12668:22): Semicolon (';') expected in script 

with this line:
SubPointsP[SubP - 1].X := x;

with this script:
program DDTMHelper;
{.include srl/srl.scar}
type
SubpointsP = array of Record
X : Integer;
Y : Integer;
Color : Integer;
end;
MainpointsP = array of Record
X : Integer;
Y : Integer;
Color : Integer;
end;
var
SubP,x,y,cx,cy : Integer;
SubPointsP : Array of SubpointsP;
MainPointsP : Array of MainpointsP;

function DDTMSetup: boolean;

begin
if IsKeyDown('s') then
begin
setlength(SubPointsP, + 1);
Inc(SubP);
GetMousePos(x, y);
SubPointsP[SubP - 1].X := x;// HERE!

n3ss3s

2008-04-05 14:59:38



setlength(SubPointsP, + 1);


The length of the array SubPointsP is now +1, not Length(SubPointsP) + 1, so when the SubP increases it goes out of range ;)

Cazax

2008-04-05 15:41:56

From: n3ss3s


setlength(SubPointsP, + 1);


The length of the array SubPointsP is now +1, not Length(SubPointsP) + 1, so when the SubP increases it goes out of range ;)


So what should i put? i have tried a lot of things, still not working…

drizzt

2008-04-05 16:23:32

setlength(SubPointsP,Length(SubPointsP) + 1);
should work

Cazax

2008-04-05 16:24:21

From: drizzt
setlength(SubPointsP,Length(SubPointsP) + 1);
should work


I have tried it, still not working…waiting for help…

EDIT: Why is it 'Semicolon expected' error ? it should be an out of range…

mixster

2008-04-06 13:00:09

You've made it a 2 dimensional array :
the type is declared as an array of record - SubpointsP = array of Record.
you define your var as an array of the type - "SubPointsP : Array of SubpointsP;".
Try removing one of the array's (I recommend the type as it looks like eww) and it should work :)