Game Development Community

Scripting Problem

by Nelson A. K. Gonsalves · in Torque Game Engine · 09/19/2001 (12:50 am) · 2 replies

This is a repost from the public Discussion forum... cause after posting I though I could get a faster answer in this board...


Here is my problem

I got:

for (%i=1; %i <= %invname.slots; %i++)
{
%thisSlot = (%invname.Slot1);
}

I want that Slot1 to change according to the value of %i
but Im having trouble with that... tried Slot@%i and it didnt work

Ideas?
Thanks in advance

#1
09/19/2001 (2:56 am)
I'm not much of a programmer, but here goes...

Could you use an array?

for (%i=1; %i <= %invname.slots; %i++)
{
%thisSlot = (%invname.Slot[%i]);
}


Otherwise, unless the syntax / format is greatly different from Starsiege scripting, I think you could do something like this:

for (%i=1; %i <= %invname.slots; %i++)
{
eval("%thisSlot = (%invname.Slot" @ %i @ "1);");
}

Hope this helps.
#2
09/19/2001 (3:02 am)
The array worked
thanks