SRL Archive - OSR Help

T2DIntegerArray assignment & TPA


riwu

2012-08-11 10:45:26

I know that you can assign values of an T2DIntegerArray using:
T2D[0]:=[1,2,3];
T2D[1]:=[5,6,1,4];
But is there a shorter way of doing it? Like how u can assign TPA values by
TPA:=[Point(1,2),Point(1,3)] (instead of TPA[0]:=Point(1,2) and so on).

I've tried things like
T2D:=[ [1,2], [3,4] ];
which doesn't compile :(


Also regarding TPAs, what is the point of setting Length? (i commented it out and found that it still works like exactly the same) Also is there any difference b/w SetLength and SetArrayLength?


And lastly..regarding this extremely long Wizzy Plugin tutorial, what's the difference b/w those '69' pictures? (the inv cowhides) if it 'modifies our array to only contain 1 point in a 26x20 box', why is it that the whole inv is being debugged?

Any help will be appreciated :) Thanks in advance.

Brandon

2012-08-11 11:12:12

I think the best you can do is:


var
Foo: T2DIntegerArray;
Meh: TIntegerArray;

begin
Foo := [Meh, Meh, Meh];
end;


var
Foo: T2DIntegerArray;
Meh: TIntegerArray;

begin
Foo := [Meh := [1, 2, 3], Meh := [4, 5, 9]];
writeln(Foo);
end;


EDIT: Hmm MasterBB Got it..

So, instead to get around it, either use example 1 which assigns a list of static arrays at compile time or use the subscript operator with the assignment operator within the 2D array for dynamic arrays.

masterBB

2012-08-11 11:24:58

var
Foo: T2DIntegerArray;

begin
Foo := [TIntegerArray([1, 2, 3]), TIntegerArray([4, 5, 6])];
writeln(Foo);
end.

J J

2012-08-11 11:26:22

RAaSTPAEx converts a TPA to boxes with certain distances between eachother.