Home   Help Search Login Register  

Author Topic: Class - Custom Object  (Read 1031 times)

0 Members and 1 Guest are viewing this topic.

Offline AlexZ

  • Members
  • *
Class - Custom Object
« on: 21 Apr 2009, 18:59:24 »
Hi,

I need to create a list/array that will contain squares/quads (4 vectors). Is there a structure/class already for quads? or is there a way that I can create one?

To clarify my question: I am trying to create a list of a bunch of squares.. for example, if I have 10 squares on a table top, I would like to store them all in a list so that I can iterate through them. Each square has 4 positions which I would need to reference. Is there a square or quad object that will allow me to store 4 positions (each having x,y,z) so that I could then add this square/quad object to a list which I can later iterate through.

In the end, my goal is to track what ground the player has covered, so I am creating a grid, each tile or square in this grid will be tracked to see if the player has walked on it.

I'm not referring to an actual square in 3d, but in a scripting/programming context, such as a variable type.

Thank you
« Last Edit: 22 Apr 2009, 18:42:05 by AlexZ »

Walter_E_Kurtz

  • Guest
Re: Class - Custom Object
« Reply #1 on: 23 Apr 2009, 01:29:17 »
The number of people who truly comprehend this can probably be counted on the fingers of one hand. I don't include myself in that select group.

Since this relates to VBS2, you may get more assistance in the ArmA sections, having more scripting functions than old Operation Flashpoint (OFP).

Question: do you really need to define all four corners of the square? Just specifying the top left corner and knowing the side length ought to suffice, as long as you don't mind the squares being orientated North-South and East-West.


OFP can handle multidimensional arrays, but I don't know to how many levels they can be nested.

Code: (multidimensional.sqs) [Select]
MDA = [[0,0],[1,0],[0,1],[1,1]]

exit
Thus MDA contains four elements, accessed as follows:
Code: [Select]
TopLeft = MDA select 0

TopLeftX = TopLeft select 0
TopLeftY = TopLeft select 1
Output: 0, 0

or, for example,
Code: [Select]
TopRight = MDA select 1
hint format ["Top Right   X %1   Y %2", TopRight select 0, TopRight select 1]
Output: 1, 0