LSL Syntax in Opensim - restrictions?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

LSL Syntax in Opensim - restrictions?

Ai Austin
I know there are a few issues with some syntax forms of
conditionals... can someone remind me what the issues are in moving
LSL code from SL to Opensim.

e.g. this one fails with a syntax error

             if( ((c = llList2Float(time,a)) <= ticks) ||
(llGetAgentSize(d = llList2Key(users,a)) == <0.0,0.0,0.0>))

is it one of the things not yet allowed?

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: LSL Syntax in Opensim - restrictions?

Karen_Palen
I haven't run into that one yet, but I finding that the OpenSim script engine is stricter than the LSL engine in SL.

The error trace and messages are not as complete as I would like either.

Unfortunately the line count for the error message tends to be inaccurate as well. I will try to document a few examples next time I play with scripting.

I have not found that unimplemented functions are a problem since there are only a few which are still not handled at all in OpenSim. They are well documented in the wiki.

The most troublesome problem so far is variable scoping problems, where a variable (e.g. i) is reused within the defined scope. The SL script engine will allow this even though it is bad practice, the OpenSim script engine rejects it.

This gets to be a major problem if the actual intent of the scoping is not obvious and the obvious fix (i -> i1, i2, etc.) results in changing the functionality of the code!

In one case (the GPL version of Prim Skirt Builder) I have 6 or 7 redefinitions of "i" to deal with.

So far a close examination of the code has revealed the problem eventually.

Another thing to watch is the allowed functions in the config file, on a private sim (e.g. development) you need to allow everything, but on a public sim you need to restrict the available OS functions for security. This too can cause apparent syntax errors.

Karen

--- On Wed, 12/9/09, Ai Austin <[hidden email]> wrote:

> From: Ai Austin <[hidden email]>
> Subject: [Opensim-users] LSL Syntax in Opensim - restrictions?
> To: [hidden email]
> Date: Wednesday, December 9, 2009, 3:27 AM
> I know there are a few issues with
> some syntax forms of
> conditionals... can someone remind me what the issues are
> in moving
> LSL code from SL to Opensim.
>
> e.g. this one fails with a syntax error
>
>              if(
> ((c = llList2Float(time,a)) <= ticks) ||
> (llGetAgentSize(d = llList2Key(users,a)) ==
> <0.0,0.0,0.0>))
>
> is it one of the things not yet allowed?
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users
>


     
_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: LSL Syntax in Opensim - restrictions?

Torrid Luna
In reply to this post by Ai Austin
Am 09.12.2009 11:27, schrieb Ai Austin:
>              if( ((c = llList2Float(time,a)) <= ticks) ||
> (llGetAgentSize(d = llList2Key(users,a)) == <0.0,0.0,0.0>))
>  
the argument to if contains an assignment (c = llL...) which itself returns either a Boolean (in the sense of "Success") or the value of the successfully changed variable in SL-LSL and other languages. In SL-LSL it behaves like that, and is allowed (although bad style), but not in Opensim-LSL.

You can rewrite it as

c = llList2Float(time,a);
d = llList2Key(users,a);

if (c <= ticks || llGetAgentSize(d) == <0.0 ,0.0 ,0.0>){
    ....


Cheers,
Torrid

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: LSL Syntax in Opensim - restrictions?

Ai Austin
In reply to this post by Ai Austin
At 05:54 10/12/2009, rrid Luna <[hidden email]> wrote:

> >              if( ((c = llList2Float(time,a)) <= ticks) ||
> > (llGetAgentSize(d = llList2Key(users,a)) == <0.0,0.0,0.0>))
> >
>the argument to if contains an assignment (c = llL...) which itself
>returns either a Boolean (in the sense of "Success") or the value of
>the successfully changed variable in SL-LSL and other languages. In
>SL-LSL it behaves like that, and is allowed (although bad style),
>but not in Opensim-LSL.
>
>You can rewrite it as
>
>c = llList2Float(time,a);
>d = llList2Key(users,a);
>
>if (c <= ticks || llGetAgentSize(d) == <0.0 ,0.0 ,0.0>){


Thank Torrid, that does indeed fix the LSL syntax problem - in fact
in a federated window script for the open source "Archer
House".   There are some issues with UUIDS of the various window
textures to get it working properly, but that is a separate issue.

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: LSL Syntax in Opensim - restrictions?

justincc
Ai Austin wrote:

> At 05:54 10/12/2009, rrid Luna <[hidden email]> wrote:
>>>              if( ((c = llList2Float(time,a)) <= ticks) ||
>>> (llGetAgentSize(d = llList2Key(users,a)) == <0.0,0.0,0.0>))
>>>
>> the argument to if contains an assignment (c = llL...) which itself
>> returns either a Boolean (in the sense of "Success") or the value of
>> the successfully changed variable in SL-LSL and other languages. In
>> SL-LSL it behaves like that, and is allowed (although bad style),
>> but not in Opensim-LSL.
>>
>> You can rewrite it as
>>
>> c = llList2Float(time,a);
>> d = llList2Key(users,a);
>>
>> if (c <= ticks || llGetAgentSize(d) == <0.0 ,0.0 ,0.0>){
>
>
> Thank Torrid, that does indeed fix the LSL syntax problem - in fact
> in a federated window script for the open source "Archer
> House".   There are some issues with UUIDS of the various window
> textures to get it working properly, but that is a separate issue.

There are some general issues with LSL statements that have extra parentheses.
I fixed one to do with parsing if statements in

http://opensimulator.org/mantis/view.php?id=3874

but there's probably a better generalizable fix for parenthesis related issues.
  rogerwo suggested that there shouldn't really be a ParenthesisExpression node
in the LSL parser since the information is already inherently coded within the
abstract syntax tree.  Unfortunately, I haven't had any time to look at this
recently (and it's important but below the other important things on my personal
list :).

--
Justin Clark-Casey (justincc)
http://justincc.org
http://twitter.com/justincc
_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users