Ok , stuck good and well this time. I'd like to use the motion code, but rather than a touch start on the prim(s) i want moving, have it actuated by a touch on a linked prim. That will start two other prims moving.
Here's what i tried for the script in the "switch prim";
integer object_num = 2;
string toggle_message = "TOGGLE"; // Close message to send to other prims
default
{
state_entry()
{
} // end of state_entry state
touch_start(integer nullvar)
{
llMessageLinked(LINK_ALL_OTHERS, object_num, toggle_message, NULL_KEY);
} // end of touch_start state
}
And here is what i tried for the script to go in the prims i want to move;
integer object_num = 2;
string toggle_message = "TOGGLE"; // message to send to other prims
float distance = .25; //distance to go up/down
integer active; //is it active or not?
vector up = <0,0,1>; //up unit vector
vector down = <0,0,-1>; //down unit vector
default
{
state_entry()
{
active = FALSE; //not active
llSetTimerEvent (0); //make sure the timer is off
} // end of state_entry state
link_message(integer sender_num, integer num, string str, key id)
{
if ( num == object_num )
{
if ( str == toggle_message )
{
if(active) //if it's active..
llSetTimerEvent (0); //turn off the timer
else //not active
{llResetTime(); //make sure the time is setup properly, so zero it
llSetTimerEvent (1); //turn on the timer for 1 second intervals
}
active = ~active; //toggle active state
}
}
} // end of link_message state
timer ()//your bread and butter, so to speak
{
llSetPos(llGetPos()+up*distance); //gets the position, moves it up distance
llSetPos(llGetPos()+down*distance); //gets the position, moves it down distance
}
}
Help would be most appreciated
