WhiteShadow
2006-11-23 02:08:26
Did you know you can make your own type of variable? Well you can learn now.
Common types that are already made are : Extended, Integer, Char, String, LongInt(Integer), etc…
Using the "Type" Statement you can make your own variable type. :D Very easy. I'm going to make a new variable called "iOre".
The first type you can use is records, records hold 2 + different variable types in one.
This is a Rs example, this can be used for holding a rock's color, tolerance, and uptext.
We declared a new variable that holds 3 things. Now we use this new variable we made!
Put together.
Understand that this is part of how the player array works! Except after they use this variable with an array.
Break down.
If you don't understand something still please ask!
Common types that are already made are : Extended, Integer, Char, String, LongInt(Integer), etc…
Using the "Type" Statement you can make your own variable type. :D Very easy. I'm going to make a new variable called "iOre".
The first type you can use is records, records hold 2 + different variable types in one.
This is a Rs example, this can be used for holding a rock's color, tolerance, and uptext.
type //type statement.
iOre = record //record.
Color : Integer; //2 + variables.
Tol : Integer;
UpTxt : String;
end;We declared a new variable that holds 3 things. Now we use this new variable we made!
var
Rock : iOre;
procedure LoadValues;
begin
Rock.Color := 8684676; //Yes you do Variable.(dot) [and what the record was holding]
Rock.Tol := 5;
Rock.UpTxt := 'Tin';
end;Put together.
program Example;
type //type statement.
iOre = record //record.
Color : Integer; //2 + variables.
Tol : Integer;
UpTxt : String;
end;
var
Rock : iOre;
procedure LoadValues;
begin
Rock.Color := 8684676;
Rock.Tol := 5;
Rock.UpTxt := 'Tin';
end;
begin
LoadValues;
end.Understand that this is part of how the player array works! Except after they use this variable with an array.
Break down.
program HoldPlayers;
type
User = record //record
Integer1 : Integer; //hold's user's number
Blah : Integer; //other random number value
Yes : Boolean; //some true false thing
//^just some random variables..
end;
var
Players : array[0..2] of User; //array of the user! They set the array with HowManyPlayers though.
begin
Players[0].Integer := 2; //Looks familiar?
Players[1].Blah := 3;
Players[2].Yes := True;
end.If you don't understand something still please ask!