Author Topic: How to get a brick datablock name from its ui name?  (Read 602 times)

How would i be able to get a bricks datablock name if i only know its UI name?
im trying to get it through a script.

This will return the DB's ID:

Code: [Select]
function DBNameToID(%name)
{
%cnt = datablockGroup.getCount();
for(%i=0; %i < %cnt; %i++)
{
%db = datablockGroup.getObject(%i);
if(%db.uiName $= %name)
{
%datablock = %db;
break;
}
}

return %datablock;
}

If you need the datablock name for display purposes, replace return %datablock; with return %datablock.getName();

Oh god no, just use this:
Code: [Select]
%datablock = $uiNameTable[%brickUIName];
if(isObject(%datablock))
{
//do stuff
}