Tuesday, December 02, 2008
USERLOGIN PASSWORD Remember?
You are here » Learning Center ยป Forums

Openlife Forums

 Openlife Grid Forums
Minimize
 
  Openlife Forums  Scripting  LSL Help  llOmega Rotation Error in Script
Previous Previous
 
Next Next
New Post 5/13/2008 7:46 PM
User is offline Charmaine Andersson
47 posts
Openlife Newbie


llOmega Rotation Error in Script 

Hi, I spotted the rotating object on Renegade and noticed that it uses llOmega, so I did some research and found a web site that suggested pasting the following script into a cube:

integer spinning = FALSE;

default

{

touch_start(integer total_number)

{

if(!spinning)

{

spinning = TRUE;

llTargetOmega(<0.0, 1.0, 0.0>, TWO_PI, 0.1);

}

else

{

llTargetOmega(<0.0, 1.0, 0.0>, 0.0, 0.1);

spinning = FALSE;

}

}

}

 

//And I get the following error message in OLG:

 

Test llOmega Rotation Cube: Error compiling script:

Line number 13, Error Number: CS0023, 'Operator '!' cannot be applied to operand of type 'int''

Can anyone tell me what I need to change?  I know this is saying something about the <=> type operands not being able to be applied to an integer,
but being a rather scripting noob, I'm not sure what to do.  This is for a couple of spinning objects in my standalones :-)
Thanks a lot.
Charm

 

Charm
 
New Post 5/13/2008 11:14 PM
User is offline Elsja Vacano
58 posts
Openlife Apprentice




Re: llOmega Rotation Error in Script 
Modified By Elsja Vacano  on 5/13/2008 11:20:41 PM)

 

Charm
Just change the line like show

if(!spinning) ==>>> if((spinning-0)==0)

I remember if(spinning==0) may work too. But not in all situations as var1==var2

 

 
New Post 5/14/2008 9:46 PM
User is offline Bodhi Moo
49 posts
www.Bodhi-Sajeev.de
Openlife Newbie


Re: llOmega Rotation Error in Script 
Hello, I tried all these variations but none of them make my prim rotate. Bodhi
 
New Post 5/14/2008 11:24 PM
User is offline Elsja Vacano
58 posts
Openlife Apprentice




Re: llOmega Rotation Error in Script 

I am sorry Bodhi,

 

What I explain is only design to allow the compilation.

 

If the function does not work, I can't nothing.

 

But there is some reason why that does not work:

I remember llTargetOmega works only on physical object?

So does not forgot to select the set this mode on the object first.

 

Just to make sure that the function is really called, make before and after the llTargetOmega debug line like this

llOwnerSay("Before llTarget"); and llOwnerSay("After Target");

Case of the rotation function in not called. (that may be a good reason).

I discover few day ago that a touch event is not managed if the scritp is in a linked object.

 

Regards

 

 
New Post 5/15/2008 6:41 AM
User is offline Pablo Pharmanaut
56 posts
Openlife Apprentice




Re: llOmega Rotation Error in Script 

This script should work:

 

 

integer Switch = FALSE;

 

default

{

    state_entry()

    {

        llTargetOmega(<0,0,1>,0,1.0); // stop spinning

    }

    touch_start(integer total_number)

    {

        if(Switch == FALSE)

        {

            Switch = TRUE;

            llSay(0, "On");

            llTargetOmega(<0,0,1>,PI,1.0); //start spinning

        }

        else

        {

            Switch = FALSE;

            llSay(0, "Off");

            llTargetOmega(<0,0,1>,0,1.0); // stop spinning

        }

    }

}

 
New Post 5/15/2008 6:46 AM
User is offline Bodhi Moo
49 posts
www.Bodhi-Sajeev.de
Openlife Newbie


Re: llOmega Rotation Error in Script 

Tanks everybody  this works great too

 


integer spinning = FALSE;

default

{

touch_start(integer total_number)

{

if((spinning-0)==0)

{

spinning = TRUE;
llOwnerSay("Before llTarget");
llTargetOmega(<0.0, 1.0, 0.0>, TWO_PI, 0.1);
 llOwnerSay("After Target");
}

else

{

llTargetOmega(<0.0, 1.0, 0.0>, 0.0, 0.1);

spinning = FALSE;

}

}

}

 

 

 
New Post 5/15/2008 6:57 AM
User is offline Charmaine Andersson
47 posts
Openlife Newbie


Re: llOmega Rotation Error in Script 
Modified By Charmaine Andersson  on 5/15/2008 7:11:09 AM)

Thanks so much, Elsja and all!  Elsja, your script stopped the error code, but until today, my cube still wouldn't rotate either LOL--tested it in OLG and in two versions of the Rex standalone.  Today, I go inworld to OLG and my cube now rotates! LOL.  I see that Sakai recently did an update to code/restored the newest release of the OLG Library--maybe that made a difference?  

Pablo and Bodhi, I'll also test your scripts as well :-)

Thanks again.

Charm :-D


Charm
 
New Post 5/15/2008 7:06 AM
User is offline Charmaine Andersson
47 posts
Openlife Newbie


Re: llOmega Rotation Error in Script 

Geez, scripts that have never worked in my region in OLG are now working today! LOL

Charm :-)


Charm
 
New Post 5/18/2008 11:49 PM
Online now... Pyotr Wolf
66 posts
xyrophile.com
Openlife Apprentice


Re: llOmega Rotation Error in Script 

does opensim not support booleans?  because that flag was being created as an int, not a bool, explaining why the not operator caused an error.

 
New Post 5/19/2008 12:15 AM
User is offline Elsja Vacano
58 posts
Openlife Apprentice




Re: llOmega Rotation Error in Script 

 Pyotr Wolf wrote

does opensim not support booleans?  because that flag was being created as an int, not a bool, explaining why the not operator caused an error.

It is a pure theorical approach so I can have wrong.

 

Opensim support boolean as the message tells, but LSL does not.

For the few I found, it seems that the LSL code we type is not compilated.

It firstly converted in another language (I guess in C# like the ll* functions are coded).

Because the LSL script does not allow boolean it is not possible for us the explicitely cast an integer in boolean as the internal language expect.

That is why, we must convert boolean expression in math operation.

 

The current LSL parser, (the part of the compilation process that converts grammar rules in byte code) is at this time newbie and not waterproof.

So until, it will full operational, we must act with workaround (keeping in mind, that those ones must still valid when the parse will be improved and corrected).

 

 
Previous Previous
 
Next Next
  Openlife Forums  Scripting  LSL Help  llOmega Rotation Error in Script
Privacy Statement | Terms Of UseAll Rights Reserved 2007,2008 3DX - Openlifegrid.com