SRL Archive - OSR Help

Creating a list of TPoints in x1, y1, x2, y2


Cstrike

2010-08-24 16:46:58

Is there a wizzy plugin for this? I went through all the functions and Naum's tutorial but couldn't find one. I checked math.scar, but didn't find anything useful.

I want to create a box of TPA's, I made this code

function CreateBoxTPA (x1, y1, x2, y2 : Integer) : TPointArray;
var TPA : TPointArray;
i, j, n : Integer;
begin
n := 0;
for i:=0 to ((y2-y1)) do
begin
for j:=0 to ((x2-x1)) do
begin
Inc (n);
SetArrayLength (TPA, n);
TPA[(n-1)] := Point((i+y1),(j+x1));
writeln (inttostr(high(TPA)) + ' = Point ('+inttostr(TPA[n-1].x)+','+inttostr(TPA[n-1].y)+')');
end;
end;
result := TPA;
end;

But whenever I use the TPA, it ends up taking the mouse off the screen (I'm trying only with SRL and no smart, and I'm dragging it over the RS screen properly and then hitting play right after…. also I'm using simba).
The result when I try and find TPA.x and TPA.y is off the RS main screen completely.

Am I doing anything wrong? Is there an easier way to generate a box of TPA's between x1, y1, x2, y2? Thanks

EvilChicken!

2010-08-24 16:52:41

TPAFromBox. :)

Wizzup?

2010-08-24 17:08:57

And if you're curious as to how it works, just have a look at the Simba source

Cstrike

2010-08-24 17:09:10

From: EvilChicken!
TPAFromBox. :)


Awesome thank you very much :)

Also, do [you or anyone] know an easy way to define the box?
 var MyTBox : TBox;
begin
MyTBox.x1 := 597;
MyTBox.y1 := 45;
MyTBox.x2 := 600;
MyTBox.y2 := 48;
//MyTBox := (597, 45, 600, 48); // This doesnt work...
end.

Is there a quick way to enter coordinates into the MyTBox? Or will I have to make a function to do that (or is there an existing one already I'm missing)? Thanks

EvilChicken!

2010-08-24 17:12:13

IntToBox. :)


(Sorry for simplicity, trying to maintain original layout..)