Blockland Forums > Modification Help
Setting A Variable To Multiple Things
jes00:
Is it possible to set a variable to multiple things? like setting $Awesome::Variable to "jes00", "Crown", and "JoJo"?
Chrono:
No. I don't understand how that would work and how it could be useful.
You can however make it a list of all 3 of those things and then when checking it, go through the list and compare each thing in the list to something.
Superb:
$variable = "jes infiniteloop chrono";
for(%i=0;%i<getWordCount($variable);%i++)
{
%word = getWord($variable,%i);
echo(%word);
}
$varCount = -1;
$variable[$varCount++] = "jes";
$variable[$varCount++] = "infiniteloop";
$variable[$varCount++] = "chrono";
for(%i=0;%i<$varCount;%i++)
{
echo($variable[%i]);
}
jes00:
--- Quote from: Superb on December 15, 2011, 07:00:35 PM ---$variable = "jes infiniteloop chrono";
for(%i=0;%i<getWordCount($variable);%i++)
{
%word = getWord($variable,%i);
echo(%word);
}
$varCount = -1;
$variable[$varCount++] = "jes";
$variable[$varCount++] = "infiniteloop";
$variable[$varCount++] = "chrono";
for(%i=0;%i<$varCount;%i++)
{
echo($variable[%i]);
}
--- End quote ---
So which would I use to check the variable?
Ipquarx:
Use arrays.
There's a good documentation on arrays in Iban Explains It All.
https://docs.google.com/document/d/1g0GnqBCnuGdELMM5XdgbWkPR-I3ovOjHBKqJBOAHtLE/edit?hl=en