Hello I'm new to LSL Scripting and to SL. So far I'm working on a script that will set a texture of a prim when in flight and set to another texture when not in flight. So far this the code that I have and I think is not working probably because I'm using it in a infinite loop. I'm NOT sure what I'm doing wrong. :/ integer ownerInfo;
integer flightSwitch;
integer flightStaus(integer ownerStatus)
{
//Returns a 1 if Owner is flying.
if( ownerStatus & AGENT_FLYING )
{
return 1;
}
else
{
return 0;
}
}
default
{
changed( integer change )
{
if (change & CHANGED_OWNER)
{
llResetScript();
}
}
on_rez(integer start_param)
{
llResetScript();
}
state_entry()
{
key ownerKey = llGetOwner();
ownerInfo = llGetAgentInfo(ownerKey);
//Check if Owner is flying or not.
flightSwitch = flightStaus(ownerInfo);
if (flightSwitch == 1)
{ state isFlying; }
else
{ state notFlying; }
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
}
}
state isFlying
{
state_entry()
{
llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, TEXTURE_PLYWOOD, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
//Check if Owner is flying or not.
flightSwitch = flightStaus(ownerInfo);
if (flightSwitch == 1)
{ state isFlying; }
else
{ state notFlying; }
}
}
state notFlying
{
state_entry()
{
llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, TEXTURE_TRANSPARENT, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
//Check if Owner is flying or not.
flightSwitch = flightStaus(ownerInfo);
if (flightSwitch == 1)
{ state isFlying; }
else
{ state notFlying; }
}
}