My mod gets a syntax error.

Author Topic: My mod gets a syntax error.  (Read 1593 times)

Code: [Select]
datablock ShapeBaseImageData(carrotImage)
{
   // Basic Item properties
   shapeFile = "./carrot.dts";
   scale = "2 0.5 0.77";
   emap = true;

   mountPoint = 0;
   offset = "0.06 0.14 0.08";
   eyeOffset = "0.7 1.2 -0.15";

   item = carrotItem;


   melee = false;
   doRetraction = false;
   armReady = true;
}##
That looks fine to me. Can someone tell me what I did wrong?

Hehe. HUEHE. HUEHUEHHAHEHEHHE. carrot.

Ontopic: Try removing the two ##s at the end and replacing them with a semicolon.
« Last Edit: January 07, 2014, 08:50:14 PM by Damien4545 »

I think you need to add a semi collen at the end. Just like Packages!

datablock ShapeBaseImageData(carrotImage)
{
    shapeFile = "./carrot.dts";
    scale = "2 0.5 0.77";

    offset = "0.06 0.14 0.08";
    eyeOffset = "0.7 1.2 -0.15";

    item = carrotItem;
    armReady = 1;
};

datablock ShapeBaseImageData(carrotImage)
{
    shapeFile = "./carrot.dts";
    scale = "2 0.5 0.77";

    offset = "0.06 0.14 0.08";
    eyeOffset = "0.7 1.2 -0.15";

    item = carrotItem;
    armReady = 1;
};

Oh I forgot a semi colon.
I didn't know that was needed... Usually code begins with { and ends with }. "Now with more random semi colons!";

Oh I forgot a semi colon.
I didn't know that was needed... Usually code begins with { and ends with }. "Now with more random semi colons!";

It does feel random, but basically what you're doing is creating an object à la new Class(); - which requires a semicolon. However, TorqueScript allows you to define tagged fields (or maybe member fields? Whatever) by adding a pair of curly braces.

However you're still ultimately just calling new Class();, so you still need a semicolon at the end. How this explains packages, I don't know.


And yes, this means you can do things like BotGroup.add(new AIPlayer() { datablock = PlayerNoJet; position = BotGroup.spawnPos; });.

It does feel random, but basically what you're doing is creating an object à la new Class(); - which requires a semicolon. However, TorqueScript allows you to define tagged fields (or maybe member fields? Whatever) by adding a pair of curly braces.

However you're still ultimately just calling new Class();, so you still need a semicolon at the end. How this explains packages, I don't know.


And yes, this means you can do things like BotGroup.add(new AIPlayer() { datablock = PlayerNoJet; position = BotGroup.spawnPos; });.
I've worked with code before, but you didn't have to add a semicolon after you close your code.

I've worked with code before, but you didn't have to add a semicolon after you close your code.
You don't add a semicolon when you close your code. You add one when you close a package and sometimes when you create something new.

You don't add a semicolon when you close your code. You add one when you close a package and sometimes when you create something new.

"Sometimes"?

"Sometimes"?
BotGroup.add(new AIPlayer() { datablock = PlayerNoJet; position = BotGroup.spawnPos; });.
No semicolon at the ending }.

No semicolon at the ending }.


...by that logic all function calls have to end with a semicolon. Good luck with your call to foo(bar(););, man.

No semicolon at the ending }.

Doesn't matter if it's at the }? There's a ; at the end of that statement. new x() is a statement, not a block. It's a syntax element in the same sense that a function call or constant value is. You need a ; after lone statements (that are on their own, and not for example in the condition of an if block).

Technically, object creation never needs a semicolon after it, in the same sense that function calls, variable lookups, value comprehensions, comparisons, etc. don't need a semicolon after them.