Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with error please

Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
04-25-2009 07:32
When I run a debug on a script in LSLEditor or try running it in OSSL (the open sim version of LSL) I get the following error message

* CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

When I look up that error message i find the explanation:

This error is produced by a number of sources.
1. If you call an object that requires parentheses () after the command, you'll get this error. Ex. database.Open() not database.Open
2. Using an assignment operator as opposes to an equality operator

The line it blames is:

for(x;x<num;x++)

I'm just not seeing the problem, anyone spot it? For clarity, it's part of a sensor, so
in context:

CODE

sensor(integer num)
{
if(num > 11)num = 11;
text = "";
many = 1;
pos = llGetPos();
integer x=0;
for(x;x<num;x++)
{
extra = [];
sub = llDetectedKey(x);
if(sub != owner)
{
info = llGetAgentInfo(sub);
//blah more code blah
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
04-25-2009 09:26
How about: for(x=0;x < num;x++)

...does that fix the problem?
_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-25-2009 21:43
that's probably it.

you really should get in the habit of spacing you code (esp. math) if only to prevent SL's idiot compiler from reading (1-1) as (1 -1) instead of (1 - 1), plus it makes it easier to read later
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
04-26-2009 07:08
Yes that was it alright , thank you very much fellows :)