Author Topic: Brick setShapeName script  (Read 3430 times)

This very my frist make script for event, this my idea making Brick Message. Here my script code:

Code: [Select]
registerInputEvent(fxDtsBrick,"onBrick","tBrick Brick");
registerOutputEvent(Brick,"setShapeName","string 25 50",0);
registerOutputEvent(Brick,"setShapeNameColor","paintColor 1",0);
registerOutputEvent(Brick,"setShapeNameDistance","int 0 3000 300",0);
package Event_BrickMessage
{
function Brick::setShapeName(%Brick)
{
Parent::setShapeName(%Brick);
{
$inputTarget_Brick = (%Brick);
}
}

function Brick::setShapeNameColor(%Brick,%color,%client)
{
if(getWordCount(%color) == 1)
{
Parent::setShapeNameColor(%Brick,getColorIDTable(%color));
}
else
{
Parent::setShapeNameColor(%Brick,%color);
}
}

 I got this error :

Quote
Loading Add-On: Event_BrickMessage (CRC:-2100232448)
Add-Ons/Event_BrickMessage/server.cs Line: 10 - Syntax error.
>>> Some error context, with ## on sides of error halt:
registerOutputEvent(Brick,"setShapeName","string 25 50",0);

registerOutputEvent(Brick,"setShapeNameColor","paintColor 1",0);

registerOutputEvent(Brick,"setShapeNameDistance","int 0 3000 300",0);

package Event_BrickMessage

{

^function Brick::setShapeName(%Brick)

^{

^^Parent::setShapeName(%Brick);

^^{##
##
^^^$inputTarget_Brick = (%Brick);

^^}

^}



^function Brick::setShapeNameColor(%Brick,%color,%client)

^{

^^if(getWordCount(%color) == 1)

^^{

^^^Parent::setShapeNameColor(%Brick,getColorIDTable(%color));

^^}

^^else

^^{

^^^Parent::setShapeNameColor(%Brick,%color);
>>> Error report complete.

ADD-ON "Event_BrickMessage" CONTAINS SYNTAX ERRORS

What wrong with this script ?
« Last Edit: August 19, 2010, 06:03:10 PM by Furling »

... I'm confused what you're trying to do here.

... I'm confused what you're trying to do here.
this old blockland v0002


This brick message in my server.

That what I want make this brick message.

Your packaging the function Brick::setShapeName(%this)

It should be fxDtsBrick::setShapeName(%this)

Assuming that it is a real method, even though I've never seen it.

Edit: Also, syntax is just wacky here. Didn't take a good look until just now.

Edit2: The syntax error you're getting is right at the opening brackets just after you call the Parent function. Probably just remove the inner set of brackets in your first function and make sure to change Brick to fxDtsBrick. Also, you're not ending the package or activating it.
« Last Edit: August 19, 2010, 08:13:13 PM by lilboarder32 »

Assuming that it is a real method, even though I've never seen it.
I don't think it is.
Even if it is, it probably would be blocked from use like it is with players

Your packaging the function Brick::setShapeName(%this)

It should be fxDtsBrick::setShapeName(%this)


Edit2: The syntax error you're getting is right at the opening brackets just after you call the Parent function. Probably just remove the inner set of brackets in your first function and make sure to change Brick to fxDtsBrick. Also, you're not ending the package or activating it.

how I could missed (%this)
 and as for your edit2, part I not understand your english... I should make activating and end packing like this package Event_BrickMessage same both ?

Edit: which I put in fxDtsBrick::setShapeName(%this) where ?

Edit2: I found line 10 is }

Code: [Select]
registerInputEvent(fxDtsBrick,"onBrick","tBrick Brick");
registerOutputEvent(Brick,"setShapeName","string 25 50",0);
registerOutputEvent(Brick,"setShapeNameColor","paintColor 1",0);
registerOutputEvent(Brick,"setShapeNameDistance","int 0 3000 300",0);
package Event_BrickMessage
{
function fxDtsBrick::setShapeName(%this)
{
Parent::setShapeName(%Brick);
{
$inputTarget_Brick = (%Brick);
} <~~Here.
}

function Brick::setShapeNameColor(%Brick,%color,%client)
{
if(getWordCount(%color) == 1)
{
Parent::setShapeNameColor(%Brick,getColorIDTable(%color));
}
else
{
Parent::setShapeNameColor(%Brick,%color);
}
}
Some error context, with ## on sides of error halt:

Code: [Select]
package Event_BrickMessage

{

^function fxDtsBrick::setShapeName(%this)

^{

^^Parent::setShapeName(%Brick);

^^{##
##
^^^$inputTarget_Brick = (%Brick);

^^}

^}


I fix this edit script:
Code: [Select]
registerInputEvent(fxDtsBrick,"OnBrick","tBrickMessage BrickMessage");
registerOutputEvent(Brick,"setShapeName","string 25 50",0);
registerOutputEvent(Brick,"setShapeNameColor","paintColor 1",0);
registerOutputEvent(Brick,"setShapeNameDistance","int 0 3000 300",0);
package Event_BrickMessage

function fxDtsBrick::setShapeName(%this)
{
Parent::setShapeName(%this);
{
$inputTarget_Brick = (%this);
%this.processInputEvent("OnBrick",%this);
}
}

function Brick::setShapeNameColor(%Brick,%color,%client)
{
if(getWordCount(%color) == 1)
{
Parent::setShapeNameColor(%Brick,getColorIDTable(%color));
}
else
{
Parent::setShapeNameColor(%Brick,%color);
}
}
« Last Edit: August 19, 2010, 10:25:04 PM by Furling »

You need one last curly brace at the end

Yeah, I just checked, there is no fxDTSBrick::setShapeName method.
Meaning this won't work. Something like this would have to be implemented to the engine, which I doubt Badspot would do, since we have print bricks.

You need one last curly brace at the end
still failed, I did add it.
Edit: I removed 2 of curly brace start and end, now there new error:

Code: [Select]
Add-Ons/Event_BrickMessage/server.cs Line: 7 - Syntax error.
>>> Some error context, with ## on sides of error halt:
egisterInputEvent(fxDtsBrick,"OnBrick","tBrickMessage BrickMessage");

registerOutputEvent(Brick,"setShapeName","string 25 50",0);

registerOutputEvent(Brick,"setShapeNameColor","paintColor 1",0);

registerOutputEvent(Brick,"setShapeNameDistance","int 0 3000 300",0);

package Event_BrickMessage



^function ##f##xDtsBrick::setShapeName(%this) <~~Here, same Brick or fxDtsBrick both are not work, i have tested both.

^{

^^Parent::setShapeName(%this);

^^{

^^^$inputTarget_Brick = (%this);

^^^%this.processInputEvent("OnBrick",%this);

^^}

^}



^function Brick::setShapeNameColor(%Brick,%color,%client)

^{

^^if(getWordCount(%color) == 1)
>>> Error report complete.
« Last Edit: August 19, 2010, 10:23:05 PM by Furling »

Hint: create a static shape with a name at the brick's position.

Hint: create a static shape with a name at the brick's position.
I not understand what you try say ? do you mind post here script.

setShapeName was disabled in v11, wasn't it?


For bots.
And players

I not understand what you try say ? do you mind post here script.
There is no setShapeName method for bricks, so the way your doing this will never work.
You need to create the function, and have it create a StaticShape, set its position to where the brick is, and then setShapeName on the static shape.

You'll also need to do some other things, like create a variable with the value as the StaticShape, so you can reference it in functions like setShapeNameColor and setShapeNameDistance. You also need to parent onDeath/onRemove so that the StaticShape is deleted when the brick is deleted.

You need to create the function, and have it create a StaticShape, set its position to where the brick is, and then setShapeName on the static shape.

You'll also need to do some other things, like create a variable with the value as the StaticShape, so you can reference it in functions like setShapeNameColor and setShapeNameDistance. You also need to parent onDeath/onRemove so that the StaticShape is deleted when the brick is deleted.
Wow you blew up woosh my mind, this hard making script, I am try basic learn this my frist time script mod. least try...