Blockland Forums > Modification Help
Get Chosen Array Value
(1/1)
tyler0:
Here is my function:
--- Code: ---
//Quality Bricks
$qualityBrickDB[336,6000];

if($qualityBrickDB = %brick.getDatablock()) {
echo($qualityBrickDB.selected);
}


--- End code ---

How could i grab the chosen value in the array
Destiny/Zack0Wack0:
Could you elaborate?
Red_Guy:
TorqueScript doesnt use traditional arrays, they are all just variable names

$Array[1] = "Line1";
$Array2 = "Line2";

echo($Array1);
echo($Array[2]);

prints:
Line1
Line2


so in your case, you will use something like:
if ($qualityBrickDB[%a] = %brick.getDatablock() )
  {
   echo($qualityBrickDB[%a] );
  }
tyler0:
So this "%a" variable could represent 336 and 6000? Then it would echo out the correct on?
Red_Guy:

--- Quote from: tyler0 on June 08, 2011, 09:25:50 PM ---So this "%a" variable could represent 336 and 6000? Then it would echo out the correct on?

--- End quote ---
no, a variable only gets 1 value.

why are you trying to use a 2d array?
Navigation
Message Index

Go to full version