Author Topic: Accessing Block Variables [Need Help - Not a Tutorial]  (Read 904 times)

I need to somehow access a certain variable for my brick. The coding goes as follows:
Code: [Select]
datablock fxDTSBrickData(GaryRPGSmallLotBrickData : brick16x16FData)
{
iconName = "Add-Ons/RP_Realestate/bitmaps/BrickIcons/16x16LotIcon";

category = "Gary RP[G]";
subcategory = "Lots";

uiName = "Small Lot";

cost = 500;
adminOnly = 0;
tax = 10;
};

I need to access the tax variable, I tried using brick.tax but that gives negative results. Does anyone know how to access a variable like that?

%brick.getDatablock().tax

I tried that but got this:
Code: [Select]
Add-Ons/RP_RealEstate/taxes.cs (17): Unable to find object: '' attempting to call function 'getDataBlock'
BackTrace: ->[RP_Crime_Game]RPTick->RPTick->[RP_Crime_Game]CheckTickID->[RP_Jobs_Game]CheckTickID->[RP_Money_Game]CheckTickID->[RP_RealEstate_Taxes]CheckTickID

I'm sure it has something do to with the function I'm using so please take a look:
Code: [Select]
Irrelevant stuff
« Last Edit: August 17, 2012, 05:18:33 AM by Gordo12699 »

your error is because %client.brick has no value.

somehow you need to get a GaryRPGSmallLotBrickData brick

So like%client.brick.GaryRPGSMallLot or something similiar? Also, how would I come about obtaining such data?

Got it, it was because %client.brick was undefined. But I came upon a new problem, it seems I need to create the function getDatablock(), so this is what I got in console:
Code: [Select]
Add-Ons/RP_RealEstate/taxes.cs (15): Unknown command getDataBlock.
  Object BrickGroup_999999(10931) SimGroup -> SimSet -> SimObject
« Last Edit: August 17, 2012, 05:17:54 AM by Gordo12699 »

Bumpity bump bump, bump bump