Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDetectedName to detect SPECIFIC objects?

Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
06-18-2009 15:20
And are the forums suddenly broken...?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-18-2009 16:13
well here take notes on this one... it's the 12 sided polyhedral version... it's amazing what 4 little changes can do (realistically 2).... and it's still pretty fast in MONO

CODE

/*//-- dodecahedron rotations --//*/
list gLstDir = [< 0.000000, 0.000000, 1.000000, 0.000000 >,
<-0.000000, 0.262846, 0.808951, 0.525842 >,
< 0.000000, 0.850583, 0.000000, 0.525841 >,
< 0.000000, 0.262846, -0.808951, 0.525842 >,
< 0.000000, -0.688110, -0.499994, 0.525843 >,
< 0.000000, -0.688135, 0.499960, 0.525842 >,
< 0.000000, -0.162495, 0.500105, 0.850582 >,
<-0.000000, 0.425401, 0.309104, 0.850581 >,
< 0.000000, 0.425415, -0.309083, 0.850582 >,
< 0.000000, -0.162495, -0.500105, 0.850582 >,
< 0.000000, -0.525841, 0.000000, 0.850583 >,
< 0.000000, 0.000000, 0.000000, 1.000000 >];
/*//-- 12 Elements in gLstDir, negative indices are easier. --//*/
integer gIdxCnt = -12;
list gLstRpt;

uSensorLoop(){
if (gIdxCnt){
/*//-- Set rotation before we call the sensor --//*/
llSetRot( llList2Rot( gLstDir, gIdxCnt++ ) );
/*//-- 65.50326deg arc / 2 and convert to radians --//*/
llSensor( "", "", PASSIVE, 95, 0.571624 );
}
else{
/*//-- we called all our Sensors, now report the findings --//*/
llOwnerSay( (string)((gLstRpt != []) / 2) + " Objects detected:\n" );
/*//-- (gLstRpt != []) == llGetListLength( gLstRpt ) --//*/

gIdxCnt = ([] != gLstRpt);
/*//-- ([] != gLstRpt) == -llGetListLength( gLstRpt ) --//*/
while (gIdxCnt){
llOwnerSay( "Name: " + llList2String( gLstRpt, gIdxCnt++ ) + "\n @ " + llList2String( gLstRpt, gIdxCnt++ ) );
}
/*//-- we're done, clear our variables --//*/
gIdxCnt = -12;
gLstRpt = [];
}
}

default{
state_entry(){
llOwnerSay( "Touch Me to Start" );
}

touch_start( integer vInt ){
uSensorLoop();
}

sensor( integer vIntTotal ){
list vLstTmp;
/*//-- loop backwards to reduce variables --//*/
while (vIntTotal--){
/*//-- don't use (--vIntTotal), we want to subtract AFTER checking --//*/
vLstTmp = [llDetectedPos( vIntTotal ), llDetectedName( vIntTotal )];
/*//-- is it NOT in our list already --//*/
if (!~llListFindList( gLstRpt, vLstTmp )){
/*//-- (!~llListFindList()) == (llListFindList() = -1) --//*/
gLstRpt += vLstTmp;
}
}
uSensorLoop();
}

no_sensor(){
uSensorLoop();
}
}


the arc is a tad over-sized because I couldn't get more exact rotations with minor errors in the distances between face centers (floating point degradation) so I just used the 3 widest intervals to get my average for the corner. for anyone that cares, the center angle between faces is 180 - dihedral_angle(2Atan((1 + sqrt( 5 )) / 2)) where (sqrt( 5 ) + 1) / 2 is the golden mean

PS @ Cappy:
it's the content fora, LL comes here less often than Resident Answers even... and there's about 1 (retired) resmod that ever occasionally bothers policing here unless things REALLY go to hell.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
06-20-2009 22:10
From: Cappy Frantisek
Ibtl

~In Moderator Mode~
I don't see a reason for this to be locked. Cursing LL is not sufficient to warrant a lock (I do it all the time <.<;)
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
1 2