Cstrike
10-01-2010, 03:06 AM
I had a hard time naming this title, so let me just give the example of where I'm stuck.
I've been able to do this is in other coding programs, but don't know if it's possible in Simba:
Is it possible to have simba create a string, and then use the strings name as a variable:
EXAMPLE
var myString : String;
myInt : Integer;
//... down the road...
myString := 'myInt';
myInt := 5;
//... further down the road...
writeln (myString);
The output will read: myInt,
But I want the program to read the string as a variable name, or construct the name of the variable to make simba think that this is happening
writeln (myString);
** Now simba somehow reads the string inside as a variable name, which fools simba into thinking this:
writeln ((myInt));
**So simba thinks that it's doing
writeln (myInt);
**Then simba returns: 5
How this applies to me is, I'm making a bunch of TPoints for a tile walker for reflection [well, it's actually already made ;)], and I've set it up like this:
FALADOREASTBANK_X
FALADOREASTBANK_Y
VARROCKWESTBANK_X...etc, etc
So, if the user inputs something like
WalkTo ('VarrockWestBank');
I was wondering if there was a way I could modify the string to append on an "_X" and "_Y", and then use those as defining variables to grab the constant numbers? This would save me time from having to make a huge "case of..." list.
Or is this a bit farther than what is needed for Simba ;)?
I've been able to do this is in other coding programs, but don't know if it's possible in Simba:
Is it possible to have simba create a string, and then use the strings name as a variable:
EXAMPLE
var myString : String;
myInt : Integer;
//... down the road...
myString := 'myInt';
myInt := 5;
//... further down the road...
writeln (myString);
The output will read: myInt,
But I want the program to read the string as a variable name, or construct the name of the variable to make simba think that this is happening
writeln (myString);
** Now simba somehow reads the string inside as a variable name, which fools simba into thinking this:
writeln ((myInt));
**So simba thinks that it's doing
writeln (myInt);
**Then simba returns: 5
How this applies to me is, I'm making a bunch of TPoints for a tile walker for reflection [well, it's actually already made ;)], and I've set it up like this:
FALADOREASTBANK_X
FALADOREASTBANK_Y
VARROCKWESTBANK_X...etc, etc
So, if the user inputs something like
WalkTo ('VarrockWestBank');
I was wondering if there was a way I could modify the string to append on an "_X" and "_Y", and then use those as defining variables to grab the constant numbers? This would save me time from having to make a huge "case of..." list.
Or is this a bit farther than what is needed for Simba ;)?