Simple LSL script not working

136 views
Skip to first unread message

Welter Silva

unread,
Jul 11, 2008, 10:32:14 AM7/11/08
to real...@googlegroups.com
Hi,

I'm newbie on LSL and RealXtend and I'm right now studying LSL by following LSL tutorial (http://wiki.secondlife.com/wiki/LSL_Tutorial)  web page. I'm trying to execute the 2nd simple script example (the one that changes object color -- see it bellow). I was able to edit and save the script on my inventory, but when I rezzed the script into a simple prim (a cube),  I got the following error in my chat area:

[12:52]  Primitive: Error compiling script:

Line number 4, Error Number: CS1519, 'Invalid token 'default' in class, struct, or interface member declaration'

Line number 19, Error Number: CS1002, '; expected'

I've checked the LSL status page (http://opensimulator.org/wiki/LSL_Status/Functions) and confirmed that the 2 used functions (llSay and llSetColor) are fully supported by Rex/OpenSim. I'm using version 0.3 for both server and client sides, by the way.
I also tested this same script on SecondLife and it worked fine.
Any idea what may be wrong?

thanks,
Welter

================ Script ===============
//lsl
default //default state is mandatory
{
    state_entry() // runs each time the state is entered
    {
        llSay(0, "turning on!"); //object speaks!
        llSetColor(<1.0, 1.0, 1.0>, ALL_SIDES); // sets all sides to most bright
        // note the semicolons at the end of each instruction (do not put them at the end of if statements)
    }
 
    touch_start(integer total_number) // another event with only one function  inside
    {
        state off; // sets the script to a new "state" and starts running "state off"
    }
} // this curly bracket ends the body of the default state.
 
state off // a second state besides "default"
{
    state_entry() // this is run as soon as the state is entered
    {
        llSay(0, "turning off!");
        llSetColor(<0.0, 0.0, 0.0>, ALL_SIDES); // sets all sides as dark as possible
    }
 
    touch_start(integer total_number)
    {
        state default;
    }
}

Lc

unread,
Jul 11, 2008, 10:47:32 AM7/11/08
to real...@googlegroups.com
i will have a look at that.
Did you use the zip file or the svn ?

Welter Silva

unread,
Jul 11, 2008, 12:39:05 PM7/11/08
to real...@googlegroups.com
thanks!
I used the zip files (realxtendviewer_0.3_setup.exe and realxtendserver_0.3.zip)

2008/7/11 Lc <lcc...@gmail.com>:

Lc

unread,
Jul 11, 2008, 1:21:17 PM7/11/08
to real...@googlegroups.com
beware, opensim is a bit ahead in term of LSL but it should work i think.

i will have a look.

Peter_Quirk

unread,
Jul 13, 2008, 4:57:54 PM7/13/08
to realXtend
The OpenSim parser is truly awful. I find that I have to modify the
scripts on the LSL wiki line by line until I can get something
working. The line numbers in the compilation error listing are often
bogus.

While I don't know yet what is wrong with yours, this tiny script
illustrates the kind of problem I run up against constantly:

Original script from http://wiki.secondlife.com/wiki/LlAvatarOnSitTarget
...
default
{
state_entry()
{
// set sit target, otherwise this will not work
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
}

changed(integer change) {
if (change & CHANGED_LINK) {
key av = llAvatarOnSitTarget();
if (av) {//evaluated as true if not NULL_KEY or invalid
llSay(0, "Hello " + llKey2Name(av) + ", thank you for
sitting down");
}
}
}
}

Errors:
Primitive: Error compiling script:

Line number 12, Error Number: CS0029, 'Cannot implicitly convert type
'int' to 'bool''

Line number 14, Error Number: CS0029, 'Cannot implicitly convert type
'string' to 'bool''

Revised script:
default
{
state_entry()
{
// set sit target, otherwise this will not work
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
}

changed(integer change)
{
integer x = change & CHANGED_LINK;
if (x>0)
{
key av = llAvatarOnSitTarget();
string mess = "Hello "+ llKey2Name(av) + ", thank you for
sitting down";
integer avlen = llStringLength(av);
if (avlen > 0)
{
llSay(0, mess);
}
}
}
}

It's very frustrating fixing these scripts. The OpenSim group has been
slow to implement the Ll functions, but the basic parser is full of
problems with type casting and expression evaluation.


On Jul 11, 12:39 pm, "Welter Silva" <welte...@gmail.com> wrote:
> thanks!
> I used the zip files (realxtendviewer_0.3_setup.exe and
> realxtendserver_0.3.zip)
>
> 2008/7/11 Lc <lcc1...@gmail.com>:
>
>
>
> > i will have a look at that.
> > Did you use the zip file or the svn ?
>
> >> }- Hide quoted text -
>
> - Show quoted text -

Lc

unread,
Jul 13, 2008, 5:16:46 PM7/13/08
to real...@googlegroups.com
did you tried the new parser ?

i didn't play with it, i'm stuck with some linux /macOs compilation problem ith ReX

lc

terry

unread,
Jul 14, 2008, 6:30:10 AM7/14/08
to realXtend
It appears current OpenSim LSL parser is doing regex parsing on LSL
code to transflate it into bits and pieces of C# which are glued
together and compiled as running scripts. justin's blog indicates work
is just starting on a proper LSL parser.
Reply all
Reply to author
Forward
0 new messages