How do i detect the Sub catergory of a brick?

Author Topic: How do i detect the Sub catergory of a brick?  (Read 2162 times)

In future cases, do this:
Actually, it is best to dump a brick's datablock if you're seaching for UI names, categories, or sub categories, but not recommended to dump every time.

Actually, it is best to dump a brick's datablock if you're seaching for UI names, categories, or sub categories, but not recommended to dump every time.
well, it'd be a bit silly to dump everything inside of a function that you're going to use a lot
what would be the point of that?
but if you're looking for something, I see nothing wrong with using it

Problem

Code: [Select]
function serverCmdLight(%client, %brick)
{
%player = %client.player;

%brick.disappear(19);
commandToClient(%client, 'InfoSend', %client.backPack);
echo(%client.backPack);

    if(!isObject(%object = getWord(containerRaycast(%player.getEyePoint(), vectorAdd(%player.getEyePoint(), vectorScale(%player.getEyeVector(), 7)), $TypeMasks::FxBrickObjectType),0)))
        return;

    if(%object.getDatablock() == ScrapElectronicsBrickData.getID())
{
%client.backPack["ScrapElectronics"]++;
%client.backPack["Weight"] += 2;
}

    if(%object.getDatablock() == brickSingleBottleCapData.getID())
{
%client.backPack["Caps"]++;
}
if(%object.getDatablock() == brickStackBottleCapData.getID())
{
%Amount = (getRandom(10,20));
%client.backPack["Caps"] += %Amount;
}

if(%object.getDatablock() == brickTireData.getID())
{
%client.backPack["Rubber"]++;
%client.backPack["ScrapMetal"]++;
}

if(%object.getDatablock() == brickNukaBottleData.getID())
{
%client.backPack["Glass"]++;
}

if(%object.getDatablock() == brickScrapMetalTeapotData.getID())
{
%client.backPack["ScrapMetal"]++;
}

if(%object.getDatablock() == brickBentTincanData.getID())
{
%client.backPack["ScrapMetal"]++;
}

if(%object.getDatablock() == brickTincanData.getID())
{
%client.backPack["ScrapMetal"]++;
}

if(%object.getDatablock() == brickHamRadioData.getID())
{
%client.backPack["Glass"]++;
%client.backPack["LightBulbt "]++;
}

Code: [Select]
Add-Ons/System_FalloutRPG/Common.cs (28): Unable to find object: '' attempting to call function 'disappear'
BackTrace: ->serverCmdLight

Brick never exists using the light function.

also, use nameToID instead of ScrapElectronicsBrickData.get ID() - nameToID(datablockname)
Also make sure %brick exists, if not, return it.

function serverCmdLight(%client, %brick)
{
   %brick.disappear(19);
the default light keybind only acts like /light, without arguments
the first argument (%client in this case, could name it whatever the duck you want, ie %ducknugget) will always be the client sending the command, and any other arguments (%brick in this case) will be null
if you want to send arguments on the /light command, use it like "/light duck", and then %client will be the client sending the command, and %brick will be the string "duck"
but either way, it won't be a brick

i'm not quite sure how you expect the function to give you a brick when it's called, since you aren't even trying to specify any specific brick (ie, what the player is looking at, first brick in a brickgroup, or a new brick that you create, or a named brick)