Author Topic: How to get the properties of a brick?  (Read 872 times)

I'm talking about the NTname of a brick. Looking through trace and other things, I found that the name itself is an object referencing that brick, once assigned to a brick.
okay i could have sworn i did that and it didn't give me an answer. this was the first thing i tried too oops.

i was trying to get it to preserve properties of bricks when removing one and placing another. i also need to know how to get the item/emitter/light data as well.
« Last Edit: February 13, 2016, 11:52:37 PM by Conan »

%brick.getName()?
NT names have a "_" in front of them, for reference.

Code: [Select]
%name = %brick.getName();
%name = getSubStr(%name, 1, strLen(%name)-1);

It seems like that's not what you're looking for, though. What are you trying to do?
« Last Edit: February 13, 2016, 11:26:21 PM by Amade »

%brick.getName()?
NT names have a "_" in front of them, for reference.
okay i could have sworn i did that and it didn't give me an answer. this was the first thing i tried too oops.

i was trying to get it to preserve properties of bricks when removing one and placing another. i also need to know how to get the item/emitter/light data as well.

okay i could have sworn i did that and it didn't give me an answer. this was the first thing i tried too oops.

i was trying to get it to preserve properties of bricks when removing one and placing another. i also need to know how to get the item/emitter/light data as well.
You're going to want a few other things, too... To save you a bit of trouble, here's an excerpt from the Swiss Army Gun's move tool:
Code: [Select]
%brick = new FxDtsBrick()
{
position          = %col.position;
oriPosition       = %col.position;
rotation          = %col.rotation;
oriRotation       = %col.rotation;
dataBlock         = %col.dataBlock;
oriDataBlock      = %col.dataBlock;
angleId           = %col.angleId;
oriAngleId        = %col.angleId;
colorId           = %col.colorId;
oriColorId        = %col.colorId;
printId           = %col.printId;
oriPrintId        = %col.printId;
emitterDiection   = %col.emitterDirection;
oriIsRaycasting   = %col.isRaycasting();
oriIsColliding    = %col.isColliding();
oriIsRendering    = %col.isRendering();
itemDirection     = %col.itemDirection;
itemPosition      = %col.itemPosition;
itemResawnTime    = %col.itemRespawnTime;
colorFxId         = %col.colorFxID;
shapeFxId         = %col.shapeFxID;
vehicleDatablock  = %col.vehicleDatablock;
client            = %client;
delAfterPlant     = true;
transferProperties= true;
};
%obj.tempBrick = %brick;
if(isObject(%col.emitter))
{
%brick.emitterData = %col.emitter.emitter;
}
if(isObject(%col.light))
{
%brick.lightData = %col.light.getDatablock();
}
if(isObject(%col.item))
{
%brick.itemData = %col.item.getDatablock();
}
if(isObject(%col.audioEmitter))
{
%brick.musicData = %col.audioEmitter.profile;
}
//Events
%brick.numEvents = %col.numEvents;
for(%i = 0; %i < %col.numEvents; %i++)
{
%brick.eventDelay[%i] = %col.eventDelay[%i];
%brick.eventEnabled[%i] = %col.eventEnabled[%i];
%brick.eventInput[%i] = %col.eventInput[%i];
%brick.eventInputIdx[%i] = %col.eventInputIdx[%i];
%brick.eventOutput[%i] = %col.eventOutput[%i];
%brick.eventOutputAppendClient[%i] = %col.eventOutputAppendClient[%i];
%brick.eventOutputIdx[%i] = %col.eventOutputIdx[%i];
for(%j = 1; %col.getOutputParameter(%i, %j) !$= ""; %j++)
{
%brick.setOutputParameter(%i, %j, %col.getOutputParameter(%i, %j));
}
%brick.eventTarget[%i] = %col.eventTarget[%i];
%brick.eventTargetIdx[%i] = %col.eventTargetIdx[%i];
}
To my knowledge this covers every property bricks have in the default game.

okay wow that's very helpful, thanks.

keywords: brick properties, brick item property, event properties, emitter property, brick wrench menu properties, brick emitter light properties

Edit: Amade, i see some spelling errors. Probably should fix them
Edit2: Should have clarified why. ori[word] looked like a typo to me at first.
« Last Edit: February 14, 2016, 03:40:41 AM by Conan »

Edit: Amade, i see some spelling errors. Probably should fix them
Oh dear.

damn amade where tf have you been

edit on topic: doing %obj.dump(); will get properties of an object, it's really godamn helpful
« Last Edit: February 14, 2016, 12:33:21 PM by Swollow »


edit on topic: doing %obj.dump(); will get properties of an object, it's really godamn helpful
yes but this is the paramters it outputs:

//Member Fields:
//  angleID = "0"
//  client = "14998"
//  colorFxID = "0"
//  colorID = "0"
//  dataBlock = "brick2x2Data"
//  isBasePlate = "1"
//  isPlanted = "1"
//  position = "-4 -5 0.3"
//  printID = "0"
//  rotation = "1 0 0 0"
//  scale = "1 1 1"
//  shapeFxID = "0"
//  stackBL_ID = "4928"
//Tagged Fields:
//Methods:
//  addEvent() -
etc


as you can see its clearly missing a lot compared to amade's post

A lot of those things in Amade's post are specifically for swiss army knife/gun.
A lot of the other things will show up as tagged fields but only when they're actually set.
Wrench a brick, change/set everything possible, and put like, 3 events on it, at least one of them with an output event that has 4 fields, and one that has a datablock.
And then find the rest with the functions that .dump(); gives as well, such as the set/get colliding/raycasting/rendering functions.

If it doesn't show up, it doesn't have it. Also note at Amade's post that it has the current property and the origProperty, or, the original property so some are duplicated.