So, I've created a nifty little dynamic brick placing function, yet for some odd reason all of my echos are returning nil except for "%type" which returns an ID, 1032 to be precise. Anyway, when I place the brick it recognizes it as the datablock but all of the other fields do not compute.
Note: LeftPrint is a function I made. Also, the brick is TreeBrickData, not brickTreedata.
$StrName["TreeBrickData"] = "TreeBrickData";
$StrMat["TreeBrickData"] = "Root";
$StrCost["TreeBrickData"] = 1;
$StrConfirm["TreeBrickData"] = "You planted a tree!";
package Lolplant
{
function fxDtsBrick::onPlant(%brick)
{
%client = getBrickGroupFromObject(%brick).client;
%brickdatablock = %brick.getDataBlock();
%type = %brick.getDataBlock();
if(%brickdatablock $= nameToID($StrName[%type]) && %client.quantity[$StrMat[%type]] >= $StrCost[%type])
{
echo(%type);
echo($StrConfirm[%type]);
echo($StrCost[%type]);
echo($StrMat[%type]);
%client.Leftprint("\c1" @ $StrConfirm[%type] @ "");
%client.quantity[$StrMat[%type]] -= $StrCost[%type];
%client.quantity["Weight"] -= $StrCost[%type];
parent::onPlant(%brick);
return;
}
}
};
activatepackage(Lolplant);