Jump to content

Help with script please.


Emerald Ansome
 Share

You are about to reply to a thread that has been inactive for 3558 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am trying to script a gyroscope/orbitron type ride that smoothly changes rotation.  I thought out the script for a long time and decided to log into SL to test it.

vector rot;
float rotx = rot.x;
float roty = rot.y;
float rotz = rot.z;
float multi;
rotation defRot = ZERO_ROTATION;

default
{

state_entry()
{
rotx = 0.0;
roty = 0.0;
rotz = 0.0;
multi = 0.0;
llSetRot(defRot);
llTargetOmega(rot,multi,0.0);
llSitTarget(<0.0, 0.0, 0.0>, ZERO_ROTATION);
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
key av = llAvatarSitOnTarget();
if (av)
{
state occupied;
}
}
}
}

state occupied
{
state_entry()
{
llTargetOmega(rot,multi,1.0);
llSetTimerEvent(0.25)

timer()
{
float randflx = -0.5 + llFrand(1.0);
float randfly = -0.5 + llFrand(1.0);
float randflz = -0.5 + llFrand(1.0);
multi = 1.0;
randflx + rotx;
randfly + roty;
randflz + rotz;
if (rotx > 2.0) rotx = 2.0;
if (rotx < -2.0) rotx = -2.0;
if (roty > 2.0) roty = 2.0;
if (roty < -2.0) roty = -2.0;
if (rotz > 2.0) rotz = 2.0;
if (rotz < -2.0) rotz = -2.0;
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
if (av = NULL_KEY)
{
state default;
}
}
}
}

I am always getting a "syntax error" at (1,16).  I don't understand why.  I spelt everything right.  I did not forget to add semicolons.  Why am I still getting this error?  Please help.  Thank you.

Link to comment
Share on other sites

I'm not sure which line is line 16, but you'll get a syntax error in your calls to llTargetOmega.  You are feeding it a vector with no defined value.  First of all, you have defined

float rotx = rot.x;
float roty = rot.y;
float rotz = rot.z;

as globals, but you're not allowed to calculate values there.  You could feed each of those variables an initial constant value, like 0.0, but not rot.x, rot.y, and rot.z.  Then, even if you did define those in state_entry, you still don't have a value for your vector rot defined.  You would need to write

rot.x = rotx;

rot.y = roty;

rot.z = rotz;

Then llTargetOmega would know what rot is.

One other observation:  Your llSitTarget call is a command to remove the sit target.  If you actually want to seat the user at the center of your object, you'll have to actually set the target a little bit off, like

llSitTarget(<0.0,0.0,0.05>,ZERO_ROTATION);

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3558 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...