|
|
| 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 |
|
|
|
 |  |
|
|
| Re: llOmega Rotation Error in Script |
|
|
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
|
|
|
|
 |  |
|
|
| Re: llOmega Rotation Error in Script |
|
|
| Hello,
I tried all these variations but none of them make my prim rotate.
Bodhi |
|
|
|
 |  |
|
|
| 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
|
|
|
|
 |  |
|
|
| 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
}
}
} |
|
|
|
 |  |
|
|
| 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;
}
}
}
|
|
|
|
 |  |
|
|
| Re: llOmega Rotation Error in Script |
|
|
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 |
|
|
|
 |  |
|
|
| Re: llOmega Rotation Error in Script |
|
|
Geez, scripts that have never worked in my region in OLG are now working today! LOL
Charm :-) Charm |
|
|
|
 |  |
|
|
| 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. |
|
|
|
 |  |
|
|
| 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).
|
|
|
|