Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script wth a twist

Othello Witherspoon
Registered User
Join date: 25 Apr 2006
Posts: 6
03-09-2007 18:43
Ok, so im attempting scripts and so far have done ok but i have been trynig to make a circle bed that i made vibrate and spin from a controller panel. I kinda got the spinning part down but cant figure the vibrate part. not to mention its on the bed itself and i dont know how to control it from my controller. any help would be awesome thx.

heres my scripts so far

CODE


default
{
touch_start(integer total_number)
{
llSetScriptState("rotation",TRUE); state spin;
}
}
state spin
{
touch_start(integer total_number2)
{
llSetScriptState("rotation",FALSE); state default;
}
}

--------------------------------------------------------------------------------------
default
{
state_entry()
{
llTargetOmega(<0,0,1>,0.9,PI);
}

}

Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-10-2007 03:52
To vibrate it try using minor llSetPos adjustments on a timer.

Controlling from an external object such as a controller or HUD requires that you set up a listen channel and listen event in your object with a corresponding llSay/llShout/llWhisper in the controller.
Othello Witherspoon
Registered User
Join date: 25 Apr 2006
Posts: 6
03-10-2007 09:34
From: Newgate Ludd
To vibrate it try using minor llSetPos adjustments on a timer.

Controlling from an external object such as a controller or HUD requires that you set up a listen channel and listen event in your object with a corresponding llSay/llShout/llWhisper in the controller.


how does the timer and SetPos work?
and which object should have the say and the listen?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-10-2007 14:15
From: Othello Witherspoon
how does the timer and SetPos work?
and which object should have the say and the listen?


The controller should generate the commands using llSay etc. while the receiver will listen for them. For the code you ahev so far posted I wouldn't bother with llSetScriptState

Controller
CODE

integer Channel = -32768;

integer Running = FALSE;

default
{
touch_start(integer total_number)
{
Running = ! Running; // Toggle the state
llSay(Channel,(string)Running); // Say the current State
}
}




Receiver
CODE

integer Channel = -32768;
vector pos;

default
{
state_entry()
{
llSetTimerEvent(0); // Clear Any running Timer
llListen(Channel,"","",""); // Listen for our control script
pos = llGetPos();
}

listen(integer channel, string name, key id, string message)
{
integer Running = (integer)message;
if(Running)
{
llTargetOmega(<0,0,1>,0.9,PI); // Start it rotating
llSetTimerEvent(llFrand(2)); // Start a random timer
}
else
{
llSetTimerEvent(0); // Stop the timer
llSetPos(pos); // Reset to the orginal position
llTargetOmega(<0,0,1>,0.,0); // Stop it rotating
}
}

timer()
{
float delta = llFrand(0.25);
vector temp = pos;
temp.z += delta;
llSetPos(temp); // Reset to the orginal position
}
}