Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

For the love of god, why wont this compile? ;)

Travis Lambert
White dog, red collar
Join date: 3 Jun 2004
Posts: 2,819
01-17-2007 11:02
Hey there - my eyes are glazing over, and for the life of me I can't figure out why this wont compile.

The line below is what the compiler is squaking on - I'm sure I'm just making a stupid mistake. If anyone can offer some advice, it'd be much appreciated...

I'm trying to take the integer nBase, add one to it, multiply the result by 5, and subtract 1 from that result.

I have a feeling I'm making an artithmetic error of some sort. Here is the line that the compiler is throwing errors on (The second '5'):

CODE
else {destination = llList2List(llCSV2List(llDeleteSubString(str,0,10)),(nBase * 5), (((nBase +1 )* 5)-1));}


And below is the full script for context:


CODE

list destination;
integer nBase;
key nQueryID;
integer asleep = FALSE;
string onetwelve; //onetwelve is when llInstantMessage was enabled for group-owned objects

string command;
string commandtext;
string action;
list empty;
integer scriptnumber;

string DEBUG = "FALSE";


DebugSay(string message)
{
if (DEBUG == "TRUE")
{
llSay(DEBUG_CHANNEL, message);
}
}

MessageEveryone(string text)
{
if (onetwelve == "TRUE")
{
integer x=0;
integer y=llGetListLength(destination);
for(x;x<y;x++)
{
if (llGetAgentInfo((key)llList2Key(destination,x)) != 0)
{
llInstantMessage((key) llList2Key(destination,x),text);
}
}
}
else
{
integer x=0;
integer y=llGetListLength(destination);
for(x;x<y;x++)
{
if (llGetAgentInfo((key)llList2Key(destination,x)) != 0)
{
llDialog((key) llList2Key(destination,x),text, empty, -999);
}
}

}
}

default
{
state_entry()
{
nBase = (integer) llDeleteSubString(llGetScriptName(),0,21);
}

link_message(integer sender_num, integer num, string str, key id)
{
command = llGetSubString(str,0,14);
commandtext = llGetSubString(str,15,-1);
if (command == "MessageEveryone" && asleep != TRUE)
{
MessageEveryone(commandtext);
}
if (llGetSubString(str,0,10) == "REMOTEKEYS|")
{
DebugSay("My Line Number: " + (string) nBase);
DebugSay("Key List Length: " + (string) llGetListLength(llCSV2List(llDeleteSubString(str,0,10))));
if ( llGetListLength(llCSV2List(llDeleteSubString(str,0,10))) < (nBase * 5)) {asleep = TRUE;} //added multiple of 5 ; assume first list is 0*5
else {destination = llList2List(llCSV2List(llDeleteSubString(str,0,10)),(nBase * 5), (((nBase +1 )* 5)-1));} //need to break out only my 5 pieces of the big list
}
if (llGetSubString(str,0,13) == "DEVICECOMMAND|")
{
string devicecommand = llDeleteSubString(str,0,13);
if (devicecommand == "START") {asleep = FALSE;}
if (devicecommand == "STOP") {asleep = TRUE;}
if (devicecommand == "RESET") {llResetScript();}
}
if (llGetSubString(str,0,12) == "REMOTECONFIG|")
{
list configparms = llParseStringKeepNulls(str, ["|"], [""]);
DEBUG = llList2String(configparms, 12);
onetwelve = llList2String(configparms,14);
}

}

}


Any advice would be much appreciated!

Thanks in advance! :)
_____________________
------------------
The Shelter

The Shelter is a non-profit recreation center for new residents, and supporters of new residents. Our goal is to provide a positive & supportive social environment for those looking for one in our overwhelming world.
2k Suisei
Registered User
Join date: 9 Nov 2006
Posts: 2,150
01-17-2007 11:08
Arrgh! It's hurting my head trying to track all those open and close brackets :(

I'll wait till SL comes back up before trying to figure it out. It's probably a missing bracket or one too many.

Edited:

Nope. Just counted and all brackets are accounted for. :)
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
01-17-2007 11:19
well usally when something wont compile the curser gives you a clue as to one of the problems by stopping right at or after the problem. I usally miss a ; or mispell something or forget to do something else silly and fix it by watching where the curser stops. Try that maybe you just need an extra bracket.
_____________________
Elanthius Flagstaff
Registered User
Join date: 30 Apr 2006
Posts: 1,534
01-17-2007 11:22
Definitely a challenge reading your spaghetti code! Fun! Try splitting everything out into multiple steps. Readability as at least as important as efficiency in most cases.

Meanwhile I /think/ your problem is here

destination = llList2List(llCSV2List(llDeleteSubString(str,0,10) ),(nBase * 5), (((nBase +1 )* 5)-1));

Your parens go, Open, Open, Close, Close... bunch more weird stuff.

*edit: crap misread, I'll get back to this.

Elan
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
01-17-2007 11:22
Your problem is that the LSL parser doesn't like to deal with "+1" and "-1" as addition and subtraction operators. Put a space on both sides of the + and - signs.
Edison Swain
Registered User
Join date: 7 Dec 2006
Posts: 51
01-17-2007 11:30
From: Lex Neva
Your problem is that the LSL parser doesn't like to deal with "+1" and "-1" as addition and subtraction operators. Put a space on both sides of the + and - signs.


I also think this is your problem.

I recently banged my head against the wall for 15 minutes knowing that my script syntax was correct. But is wouldn't compile. Then I changed a:

variable-1

to:

variable - 1

and the kingdom rejoiced! :)
Lota Lyon
Registered User
Join date: 5 Oct 2006
Posts: 245
Agree you need space
01-17-2007 11:37
As Lex said I too believe you need to add the spaces he suggests.
Travis Lambert
White dog, red collar
Join date: 3 Jun 2004
Posts: 2,819
01-17-2007 11:59
From: Lex Neva
Your problem is that the LSL parser doesn't like to deal with "+1" and "-1" as addition and subtraction operators. Put a space on both sides of the + and - signs.


Holy hell...

I added the spaces per the suggestions, and it all compiled with no errors. Woohoo! :)

I'll have to remember this compiler quirk for future reference.

Thanks for the quick replies, everyone! You saved me hours of beating my head against the keyboard, and many rolls of gauze to stop the bleeding ;)
_____________________
------------------
The Shelter

The Shelter is a non-profit recreation center for new residents, and supporters of new residents. Our goal is to provide a positive & supportive social environment for those looking for one in our overwhelming world.