Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Why does one compile and the other does not?

Vilkacis Mason
Registered User
Join date: 30 Aug 2005
Posts: 49
04-03-2006 01:45
I am creating functions to make my life easier with a prim hand attachment.

I made a specific function that checks the integer newThumb. If it is the same as the current Thumb's state (stated in gthumb, a global variable) it returns nothing. If it is NOT the same, it goes through to see what it is and makes the appropriate changes, using other functions.

The thumb function works fine, it compiles with no errors:

CODE

parseThumb(integer newThumb)
{
if (newThumb == gThumb)
{
// Thumb is the same, do nothing.
}
else if (newThumb == 1)
{
cThumbOff(gThumb);
cThumbTuck("on");
gPrevThumb = gThumb;
gThumb = 1;
}
else if (newThumb == 2)
{
cThumbOff(gThumb);
cThumbDown("on");
gPrevThumb = gThumb;
gThumb = 2;
}
else if (newThumb == 3)
{
cThumbOff(gThumb);
cThumbRelaxed("on");
gPrevThumb = gThumb;
gThumb = 3;
}
else if (newThumb == 4)
{
cThumbOff(gThumb);
cThumbUp("on");
gPrevThumb = gThumb;
gThumb = 4;
}
}


But the function for the Index Finger does NOT work, which was basically cut and pasted directly from the Thumb function. It makes no sense. I get a syntax error (I will comment the location)

CODE

parseIndex(integer newIndex)
{
if (newIndex == gIndex);
{
// Index is the same, do nothing.
}
else if (newIndex == 1) // Syntax Error here, for no reason I can determine.
{
cIndexOff(gIndex);
cFistIndexFinger("on");
gPrevIndex = gIndex;
gIndex = 1;
}
else if (newIndex == 2)
{
cIndexOff(gIndex);
cRelaxedIndexFinger("on");
gPrevIndex = gIndex;
gIndex = 2;
}
else if (newIndex == 3)
{
cIndexOff(gIndex);
cSpreadIndexFinger("on");
gPrevIndex = gIndex;
gIndex = 3;
}
else if (newIndex == 4)
{
cIndexOff(gIndex);
cFlatIndexFinger("on");
gPrevIndex = gIndex;
gIndex = 4;
}
}


Can someone help me with this? I have stared at it for an hour and I can find no difference between these two functions.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
04-03-2006 01:49
You've got a semicolon after the first "if" condition.
Vilkacis Mason
Registered User
Join date: 30 Aug 2005
Posts: 49
04-03-2006 01:56
From: Ordinal Malaprop
You've got a semicolon after the first "if" condition.


Thank you, I did not see that there. I assumed a fresh set of eyes would help.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
04-03-2006 13:47
No problem, everybody does that sometimes....