SRL Archive - Help and Support

TShape array in a form?


Pure1993

2009-01-16 18:50:02

Hey guys,
Well, I'm growing abit tired of learning C++, so I am returning to my little scar script. ^^
Anyway, the problem I am encountering is, that I can't figure out how to get an array out of a TShape so that it can be used in forms… Technically a TShape shouldn't be too different from a record (sorry if I'm completely mistaking), but when I try either, it doesn't work:


{....}
TFigure: TShape;

Figure : array of TFigure;


Figure : array of TShape;

Both are return errors… the most common one is : invalid recod type, or something like that. Sorry if I'm asking the impossible again… ^^
Thanks a lot :spot:
Pure1993

almost

2009-01-16 19:05:29

Heh you're over thinking it a little.
I use this in my multiplayer form.
var
Shapes: array of TShape;

Then just do like this-
Shapes[i].Parent:= YourForm;
//everything else

Pure1993

2009-01-16 19:39:52

I swear, when I tried that 2 days ago, it didn't work… I PROMISE! *Getting paranoid* xD
But, why does it work now? Hmmmm… probably I messed something up… anyway, THANKS A LOT! it works now ^^
Rep++

Pure1993

2009-01-16 19:42:44

I'm such an idiot… I know why it didn't work… the "array of TShape' part was correct, but I used "Player" as the var, even though it is already pre-defined… oops… ^^

almost

2009-01-16 20:45:20

Yup no problem.
I make dumb mistakes like that all the time :p

Bobarkinator

2009-01-17 02:07:04

The reason the first one you listed doesn't work is because you can't do an array of a variable. You have to actually define it as a record.