Difference between revisions of "User:Luisa Bourgoin/current projects/turtle mover"
(Created page with 'this component recieves chat commands on configured channel, which need to adress it's configured identity. both are taken from object description line as comma separated list bu...') |
m |
||
Line 1: | Line 1: | ||
this component recieves chat commands on configured channel, which need to adress it's configured identity. both are taken from object description line as comma separated list but channel could be hidden by defining variable inside script itself. | this component recieves chat commands on configured channel, which need to adress it's configured identity. both are taken from object description line as comma separated list but channel could be hidden by defining variable inside script itself. | ||
(for aditional security one can ultimately key the script onto a distinct controller prim) | (for aditional security one can ultimately key the script onto a distinct controller prim) | ||
(default security does allow owner chatting, or objects owned by owner) | (default security does allow owner chatting, or objects owned by owner) | ||
'''some name, 300''' would make an enscripted object listen on channel 300 for instructions like | '''''some name, 300''''' would make an enscripted object listen on channel 300 for instructions like | ||
;some name, | ;some name, ''warp'', <171,63,24> | ||
: moves the Object at <171,63,24> immediately | : moves the Object at <171,63,24> immediately | ||
;some name, | ;some name, ''rotate'', <180,0,90> | ||
: rotates Object onto x=180 y=0 z=90 | : rotates Object onto x=180 y=0 z=90 | ||
;some name, | ;some name, ''+x'', 10 | ||
: moves Object 10 meters into Object's '''local''' X axis | : moves Object 10 meters into Object's '''local''' X axis | ||
: case matters here | |||
;some name, | ;some name, ''+X'', 10 | ||
: moves Object 10 meters into X axis, seen from world coordinates | : moves Object 10 meters into X axis, seen from world coordinates | ||
;some name, | ;some name, ''*Z'', 90 | ||
: rotates Object 90° arround world Z | : rotates Object 90° arround world Z | ||
;some name, | ;some name, ''*z'', 90 | ||
: rotates Object 90° arround Object's '''local''' Z axis | : rotates Object 90° arround Object's '''local''' Z axis | ||
: case matters here | |||
...as you can see lowercase axes are seen as Object's local reference frame. | ...as you can see lowercase axes are seen as Object's local reference frame. | ||
all moves use llSetPos() so work on any size of linksets. | all moves use llSetPos() so work on any size of linksets. | ||
<lsl>// turtle mover by Luisa Bourgoin 4/2010 | |||
// !!NOT OPEN SOURCE NOR PUBLIC DOMAIN!! | |||
// ...but you are allowed to use for free. handle with care. for home and office use | |||
// | |||
float speed = 0.750; //adjustable. keep in mind it's llSetPos() based | |||
key locked_on_key = NULL_KEY; //keying is ultimately safe, hiding listen channels ... hardly safe | |||
integer listen_channel = FALSE; //if FALSE, taken from object descriptions | |||
integer owner_objects_only = TRUE; //usually cross avatar id installations disabled | |||
// | |||
// (no serviceable parts below this line) | |||
string rVp;integer gxM=0;integer AMB=0;key DUJ;integer f8i; | |||
integer wrp=0;list qon=[];vector MQb;vector MyR;float BLS;float bPM;KxB(vector YVg) | |||
{vector Gwp;if(YVg.z<(llGround(YVg-llGetPos())+0.01))YVg.z=llGround(YVg-llGetPos( | |||
))+0.01;if(YVg.z>4096)YVg.z=4096;Gwp=llGetPos();llSetPrimitiveParams([6,<1.84e+19, | |||
1.84e+19,1.84e+19>,6,YVg]);if(llGetPos()==Gwp){integer ksG=(integer)(llVecDist(YVg, | |||
llGetPos())/10.0)+1;if(ksG>400)ksG=400;list toB=[6,YVg];integer IHN=1; | |||
while((IHN=IHN<<1)<ksG)toB=(toB=[])+toB+toB;llSetPrimitiveParams((toB=[]) | |||
+toB+llList2List(toB,(IHN-ksG)<<1,IHN));if(llVecDist(llGetPos(),YVg)>.001) | |||
while(--ksG)llSetPos(YVg);}}vKt(string sFH){list uVj=llCSV2List(sFH);if(llList2String( | |||
uVj,0)!=rVp)return;if(wrp){qon=(qon=[])+qon+sFH;return;}string oRr=llStringTrim( | |||
llList2String(uVj,1),0x3);string fqM=llList2String(uVj,2);rotation Hlo=llGetRot();vector QoP=<0, | |||
0,0>;if(llGetSubString(oRr,1,1)=="X")QoP=<1,0,0>;else if(llGetSubString(oRr,1,1)=="Y")QoP=<0,1,0>;else if(llGetSubString(oRr,1,1)=="Z")QoP=<0,0,1>;else if(llGetSubString(oRr,1,1)=="x")QoP=<1,0,0>*Hlo;else if(llGetSubString(oRr,1,1)=="y")QoP=<0,1,0>*Hlo;else if(llGetSubString(oRr,1,1)=="z")QoP=<0,0,1>*Hlo;if(llGetSubString(oRr,0,0)=="*"){llSetRot(Hlo*llAxisAngle2Rot(QoP,(float)fqM*DEG_TO_RAD));}else if(llGetSubString( | |||
oRr,0,0)=="+"){MQb=llGetPos();MyR=MQb+(QoP*(float)fqM);bPM=llVecDist(MQb,MyR)/speed;BLS=0; | |||
wrp=1;llSetTimerEvent(0.2);}else if(llGetSubString(oRr,0,0)=="-"){MQb=llGetPos();MyR=MQb+(QoP*(-1*(float)fqM));bPM=llVecDist(MQb,MyR)/speed; | |||
BLS=0;wrp=1;llSetTimerEvent(0.2);}else if(oRr=="rotate"){llSetRot(llEuler2Rot((vector)fqM*DEG_TO_RAD));}else if(oRr=="warp"){KxB((vector)fqM);}}default{state_entry(){if(rVp==""){list uVj=llCSV2List(llGetObjectDesc());rVp=llList2String(uVj,0);if(rVp=="")llOwnerSay("ERROR place identity and channel inside object description string");if(listen_channel==0)gxM=llList2Integer(uVj,1);else gxM=listen_channel;wrp=0; | |||
}DUJ=llGetOwner();f8i=owner_objects_only;if(rVp!="")AMB=llListen(gxM,"",locked_on_key,"");}listen(integer Clq,string OsW,key id,string sFH){if(f8i&&(!(id==DUJ||llList2Key( | |||
llGetObjectDetails(id,[6]),0)==DUJ)))return;vKt(sFH);}link_message(integer pUj,integer PIS, | |||
string SXV,key id){if(PIS==gxM)vKt(SXV);}timer(){if(wrp==1){BLS=BLS+(1.0/bPM) | |||
;if(BLS>=1.0){wrp=0;BLS=1.0;}llSetPos(MQb+((MyR-MQb)*BLS));}if(wrp==0&&llGetListLength( | |||
qon)>0){string sFH=llList2String(qon,0);if(llGetListLength(qon)>1)qon=(qon=[]) | |||
+llList2List(qon,1,-1);else qon=[];vKt(sFH);}if(wrp==0&&llGetListLength(qon)<=0) | |||
llSetTimerEvent(0.0);}}</lsl> |
Latest revision as of 18:13, 29 April 2010
this component recieves chat commands on configured channel, which need to adress it's configured identity. both are taken from object description line as comma separated list but channel could be hidden by defining variable inside script itself.
(for aditional security one can ultimately key the script onto a distinct controller prim)
(default security does allow owner chatting, or objects owned by owner)
some name, 300 would make an enscripted object listen on channel 300 for instructions like
- some name, warp, <171,63,24>
- moves the Object at <171,63,24> immediately
- some name, rotate, <180,0,90>
- rotates Object onto x=180 y=0 z=90
- some name, +x, 10
- moves Object 10 meters into Object's local X axis
- case matters here
- some name, +X, 10
- moves Object 10 meters into X axis, seen from world coordinates
- some name, *Z, 90
- rotates Object 90° arround world Z
- some name, *z, 90
- rotates Object 90° arround Object's local Z axis
- case matters here
...as you can see lowercase axes are seen as Object's local reference frame.
all moves use llSetPos() so work on any size of linksets.
<lsl>// turtle mover by Luisa Bourgoin 4/2010 // !!NOT OPEN SOURCE NOR PUBLIC DOMAIN!! // ...but you are allowed to use for free. handle with care. for home and office use //
float speed = 0.750; //adjustable. keep in mind it's llSetPos() based
key locked_on_key = NULL_KEY; //keying is ultimately safe, hiding listen channels ... hardly safe integer listen_channel = FALSE; //if FALSE, taken from object descriptions integer owner_objects_only = TRUE; //usually cross avatar id installations disabled
// // (no serviceable parts below this line) string rVp;integer gxM=0;integer AMB=0;key DUJ;integer f8i; integer wrp=0;list qon=[];vector MQb;vector MyR;float BLS;float bPM;KxB(vector YVg) {vector Gwp;if(YVg.z<(llGround(YVg-llGetPos())+0.01))YVg.z=llGround(YVg-llGetPos( ))+0.01;if(YVg.z>4096)YVg.z=4096;Gwp=llGetPos();llSetPrimitiveParams([6,<1.84e+19, 1.84e+19,1.84e+19>,6,YVg]);if(llGetPos()==Gwp){integer ksG=(integer)(llVecDist(YVg, llGetPos())/10.0)+1;if(ksG>400)ksG=400;list toB=[6,YVg];integer IHN=1; while((IHN=IHN<<1)<ksG)toB=(toB=[])+toB+toB;llSetPrimitiveParams((toB=[]) +toB+llList2List(toB,(IHN-ksG)<<1,IHN));if(llVecDist(llGetPos(),YVg)>.001) while(--ksG)llSetPos(YVg);}}vKt(string sFH){list uVj=llCSV2List(sFH);if(llList2String( uVj,0)!=rVp)return;if(wrp){qon=(qon=[])+qon+sFH;return;}string oRr=llStringTrim( llList2String(uVj,1),0x3);string fqM=llList2String(uVj,2);rotation Hlo=llGetRot();vector QoP=<0, 0,0>;if(llGetSubString(oRr,1,1)=="X")QoP=<1,0,0>;else if(llGetSubString(oRr,1,1)=="Y")QoP=<0,1,0>;else if(llGetSubString(oRr,1,1)=="Z")QoP=<0,0,1>;else if(llGetSubString(oRr,1,1)=="x")QoP=<1,0,0>*Hlo;else if(llGetSubString(oRr,1,1)=="y")QoP=<0,1,0>*Hlo;else if(llGetSubString(oRr,1,1)=="z")QoP=<0,0,1>*Hlo;if(llGetSubString(oRr,0,0)=="*"){llSetRot(Hlo*llAxisAngle2Rot(QoP,(float)fqM*DEG_TO_RAD));}else if(llGetSubString( oRr,0,0)=="+"){MQb=llGetPos();MyR=MQb+(QoP*(float)fqM);bPM=llVecDist(MQb,MyR)/speed;BLS=0; wrp=1;llSetTimerEvent(0.2);}else if(llGetSubString(oRr,0,0)=="-"){MQb=llGetPos();MyR=MQb+(QoP*(-1*(float)fqM));bPM=llVecDist(MQb,MyR)/speed; BLS=0;wrp=1;llSetTimerEvent(0.2);}else if(oRr=="rotate"){llSetRot(llEuler2Rot((vector)fqM*DEG_TO_RAD));}else if(oRr=="warp"){KxB((vector)fqM);}}default{state_entry(){if(rVp==""){list uVj=llCSV2List(llGetObjectDesc());rVp=llList2String(uVj,0);if(rVp=="")llOwnerSay("ERROR place identity and channel inside object description string");if(listen_channel==0)gxM=llList2Integer(uVj,1);else gxM=listen_channel;wrp=0; }DUJ=llGetOwner();f8i=owner_objects_only;if(rVp!="")AMB=llListen(gxM,"",locked_on_key,"");}listen(integer Clq,string OsW,key id,string sFH){if(f8i&&(!(id==DUJ||llList2Key( llGetObjectDetails(id,[6]),0)==DUJ)))return;vKt(sFH);}link_message(integer pUj,integer PIS, string SXV,key id){if(PIS==gxM)vKt(SXV);}timer(){if(wrp==1){BLS=BLS+(1.0/bPM)
- if(BLS>=1.0){wrp=0;BLS=1.0;}llSetPos(MQb+((MyR-MQb)*BLS));}if(wrp==0&&llGetListLength(
qon)>0){string sFH=llList2String(qon,0);if(llGetListLength(qon)>1)qon=(qon=[]) +llList2List(qon,1,-1);else qon=[];vKt(sFH);}if(wrp==0&&llGetListLength(qon)<=0) llSetTimerEvent(0.0);}}</lsl>