You can't use variables in the name of an object:
CustoBrick@%a@x@%b@x@%c@Brick.openForWrite()
You can't declare variables in a functions arguments:
(!isFile(%Bricks = "add-ons/Script_CustomBricks/"@%a@"x"@%b@"x"@%c@"-Brick.blb"))
You're using variables that you haven't declared, you're using openForWrite instead of writeLine - there are so many mistakes in this code that it is fruitless trying to help.
You need to read and
reread a Torque Game Engine scripting guide/tutorial, you need to look up how to use FileObjects and what their functions and arguments are
before you use them.
new FileObject("CustoBrick"@%a@"x"@%b@"x"@%c@"Brick");
should be:
%file = new FileObject();
so that you can then use:
- %file.openForWrite();
- %file.writeLine();
- %file.close();
- %file.delete();
Instead of using:
if(!isFile(%Bricks = "add-ons/Script_CustomBricks/"@%a@"x"@%b@"x"@%c@"-Brick.blb"))
{
//fileobject code here
}
you can do the inverse - checking if the brick file
already exists, in which case sending an error to the user and returning early:
%Bricks = "Add-Ons/Script_CustomBricks/" @ %a @ "x" @ %b" @ %x @ "%c @ "-Brick.blb";
if(isFile(%Bricks))
{
error("ERROR: NewBrick() - " @ %Bricks @ " already exists!");
return;
}
//fileobject code here
And code like this:
CustoDataBrick@%a@x@%b@x@%c@Brick.openForWrite(" brickFile = ./"@%a@"x"@%b@"x"@%c@"-Brick.blb;");
will not work (and not just because it's supposed to writeLine

) as that produces the following output:
brickFile = ./1x1x1-Brick.blb;
and as you should already be aware, strings need to be encased in speech marks (").
To include speech marks without breaking the statement, you need to include a \ infront of them, e.g:
echo("\"The dog sat on the log\"");
would output:
"The dog sat on the log" in the console.
So study up, read through some code relevant to what you're trying to do and use it as a reference! If you need further help or want an example of working code, ask away.