I've recently endeavored to learn how scripting systems work so I can eventually implement them in my games. I currently have a simple system working in a test project (Spacee Shooter) I made. It basically works using opcodes. A number assigned to each possible command and a place to add simple parameters, for example instruction #1 sets the ships X coordinate and uses parameter #1 (There are 2 parameter fields) as the coordinate. For the more complex system I had in mind I would like to be able to index the variables from a record and be able to make changes to this from the script. See below

TShip = Record
X: Integer;
Y: Integer;
VelX: Integer;
VelY: Integer;
Health: Integer;
end;

and then by using the command:
ChangeShipVar( 3 , 10 );
I could change the VelY value of a TShip record. I would of course have to specify which TShip but it would cut down a lot of work. I don't want to have to specify that X is index 0 and Y is index 1 and so on. I want it to know this and I'm sure there is a way of getting the index of a variable from within a record but I don't know how.

God damn, why do I always give the long drawn out explanation when a simple one would have done.