Author Topic: Variables, mounts, and more...  (Read 490 times)

First of all, how would one  about using a string as a variable name?  For example, would I use the following to create a variable named whatever varname is equal too:
Code: [Select]
%varname = "myvariablename";
$(varname) =  "stuff";
Hard to explain, but I think you get my gist.

Second, I was trying to find out how to detect a user entering a certain kind of vehicle, for instance, a flyingWheeledVehicle.
Would it be:
Code: [Select]
package(thing)
{
     flyingWheeledVehicleData::onMount()
     {
         //do stuff
     }
}
activatePackage(thing);

Thanks in advance!

You could do something like
Code: [Select]
%variable = "1";
$Variable[1] = "Stuff";

echo($Variable[%variable]);
It would echo "Stuff" because $Variable[%Variable] is equal to $Variable[1]

You could do something like
Code: [Select]
%variable = "1";
$Variable[1] = "Stuff";

echo($Variable[%variable]);
It would echo "Stuff" because $Variable[%Variable] is equal to $Variable[1]
You could also access it from $Variable1 but it is a little less dynamic like that.