Okay, i'll make this as organized as I can, since it's really hard to explain!

The Problem:

Maybe it's two problems.  Here goes.  First, I need a way to store the coordinates of a specific character.  Do I do this with a variable?  Here's the tricky part of it.  The variable name has to be 'variable' + number.  The number being if it's the first one plotted, second character plotted or third...etc...  So if i plotted a character and it was the fifth one, it's coordinates would be stored in 'variable5'

Why:

I need it so that i can make a 'path' between randomly placed text characters, and to do that i need to be able to store their coordinates.

Array:

Possibly an array?  If that's what i use, please be EXTREMELY simple when you try to explain how to do it, I get scared enough when I hear the word array...

Conclusion:

So, I geuss I need a way to create a variable midstream, that has the standard name 'variable' plus a number appended onto it.

PS:

I'm afraid an array is what I need, and in that case, please be as simple as you can, I understand NOTHING about arrays. As always, source code is always nice  (:

PPS:  If 100 pts. isn't enough, sorry, it's all i got  (actually 105, geuss i'm lying)   (:
###### Who is Participating?

Commented:
Hi there !

"First, I need a way to store the coordinates of a specific character.  Do I do this with a variable?"

Yes. I would use a RECORD-Type Variable here.

TYPE
TheCoords = RECORD
X : Integer;
Y : Integer;
Z : Integer; {Z if you need 3D-Coordinates}
END;

Var
Coords : TheCords;

ACCESS
""""""
Coords.X := 5;
Coords.Y := 6;
Coords.Z := 10;

"The variable name has to be 'variable' + number.  The number being if it's the first one plotted, second character plotted or third...etc...  So if i plotted a character and it was the fifth one, it's coordinates would be stored in 'variable5'"

This will NOT work !

You can't assign a number to a variable this way. What you did, would be a String-Operation and this is something completly different. I think the only one way is to use an ARRAY here.
(not only one but best)

First, let me tell you some words about the ARRAY :)

If you understand what an Array is, you will see it is powerfull, usefull and not that hard to get it :)

An Array is a Variable that may store more than one Value of ANY
type. (I won't go into details now). This way... your Idea was not bad with Variable + Number, you just have to write the Index-Number in [ ].

Now, let's write 5 different Numbers to an Array of Byte for example :

VAR
TheArray : Array [1..5] of Byte;
.                .         .
.                .         .
.This is the main Variable Name
.         .
.This shows how many Value in the Array are
.
.This is the DataType, that the Array shall use. You may use ANY ordinal, string or own defined
types here.

OK, now the whole thing with the numbers:

VAR
TheArray : Array [1..5] of Byte;

Begin
TheArray[1] := 25;
TheArray[2] := 50;
TheArray[3] := 90;
TheArray[4] := 30;
TheArray[5] := 18;
End;

This would write the numbers 25,50,90,30 and 18 to "TheArray"

Now you see, reading/writing data to/from an array is more or less same than a "normal" variable. Just add the [x] Where X must always be the Index-Indicator. (The number of variable in the array)

To finish that..here a lil Demo-Program :

Program Example;

Uses
Crt;

Type
Coords = Record
X,
Y,
Z : Integer;
End;

Var
CordsVar : Coords; {only used if you want to access the record
directly. In this Example, we will use
the Array to access it}

AllCords : Array [1..5] of Coords;
OtherData: Array [1..5] of Integer;

HelpVar : Byte; {just to make my life easier, less typing :)}

{note that an Array cannot store values of different types}

Begin
For HelpVar := 1 to 5 do
Begin
ClrScr;
WriteLn;
WriteLn;
WriteLn('Enter X/Y/Z-Cords of point #',HelpVar,' : ');
WriteLn('X:');
WriteLn('Y:');
WriteLn('Z:');
WriteLn;
End;

For HelpVar := 1 to 5 do
Begin
ClrScr;
WriteLn;
WriteLn('Enter some Number to Point #',HelpVar);
WriteLn;
WriteLn('',HelpVar,':.');
WriteLn;
End;

ClrScr;
WriteLn;
WriteLn('Now listing all Data...');
WriteLn;
For HelpVar := 1 to 5 do
Begin
WriteLn('Point ',HelpVar,' : X = ',AllCords[HelpVar].X,' Y = ',AllCords[HelpVar].Y,' Z = ',AllCords[HelpVar].Z);
WriteLn;
WriteLn;
End;
End.

Hoping, this helps, greets, Roger ;)
0

Author Commented:
Thanks for your help.  I think i can say i have enough understanding of an array to do what I want.

******T H A N K S******
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.