|
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
|
01-11-2008 16:14
I know there is a freebie script out there called Back and Forth, just can't find it, however it may not actually do what I want. What I am after is a Back and forth action on linked prims, like a piston movement, I guess a modified sliding door could do it, just so it's opening and closing in a loop, any ideas what i can do, or get hold of the freebie script, I am definitely not a scripter, just a builder.
Edit: I guess I need to be able to adjust the time it moves back and forth too!
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
01-11-2008 16:55
you can get it by moding this script, since your not much of a scripter not sure you will be able to figure it out 100% but have 3 prims, 1 prim pistan 2nd prm pistan 3rd root prim under them, this script moves the objects by its posstion around the root prim, just have one pistan say a linked message to other prim to move and vise vera and you will get a pistan action, im to buy right now with a pile of other scripts but ill post a better exaple later if i get around to it again vector r_out = <#,#,#>; // Rotations relative to root prim vector r_in = <#,#,#>; // Rotations relative to root prim
vector p_out = <#,#,#>; // Postition relative to root prim vector p_in= <#,#,#>; // Postition relative to root prim
rotation LocalRot(rotation localrot) { rotation LocRot = localrot / ( (ZERO_ROTATION / llGetLocalRot()) * llGetRot()); return LocRot; }
out() { llSetPrimitiveParams([PRIM_ROTATION, LocalRot(llEuler2Rot(r_out * DEG_TO_RAD)), PRIM_POSITION, p_out]); }
in() { llSetPrimitiveParams([PRIM_ROTATION, LocalRot(llEuler2Rot(r_in * DEG_TO_RAD)), PRIM_POSITION, p_in]); }
default { on_rez(integer rez) { llResetScript(); } link_message(integer send, integer num, string msg, key id) { if ( msg == (move out command) ) { out(); } else if ( msg == (move in command)) { in(); } } }
EXP 2
// the phrase the user will use
string gMagicPhrase = "p";
// how fast the door opens
float gOpenTime = 1.0;
// global variables that aren#t exposed
integer gSteps = 3; vector gOffset = <.9,0,0>; // <to the X direction(sideways)(shown as red arrows),to the Y direction (the other sideways)(shown as green arrows), the Z direction(up)(shown as a blue arrow)>
//so its <red,green,blue> or... <sideways,sideways,up>
default
{
// setup to listen only for magic phrase
state_entry()
{
// listen on chat channel 0 for the magic phrase from anyone
llListen(0, "", "", gMagicPhrase); llSetText("",<1,1,1>,1.5);
} // handle chat messages that we#re listening for
listen(integer channel, string name, key id, string message)
{
integer i; vector localpos = llGetLocalPos(); //llWhisper(0, "localpos = " + (string)localpos); for (i = 0; i < gSteps; i++)
{
// set the object's position
llSetPos(localpos + i*gOffset); llSleep(0.1);
} // now, flip the offset vector to move us back down
gOffset *= -1;
}
}
that last script i just wrote a minute ago should move a prim back and forth when saying the letter "p" in chat untested, it compiled in lsleditor so i haven't tested it in world
|
|
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
|
01-11-2008 17:04
Thanks, no I'm not a scripter, but I'm willing to have a go with it  ok second script, yes the prim moves a set distance, but it just stays there, until I say 'p' again then it returns. however, the action isn't smooth it seems to get 2/3s then stutters then finishes. First script (33, 1  : ERROR : Syntax error if ( msg == (move out command))
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
01-11-2008 19:20
change the gSteps to 1 and it will smooth out, ill what i ment by that command thing was to put your own command into it  srry about that
|