@@ -71,13 +71,14 @@ integer Cur2default; //default action to revert back to default pose when last
7171
7272string NC_READER_CONTENT_SEPARATOR = " %&§" ;
7373
74+ // PluginCommands=[string name, integer num, integer sendToProps]
7475list PluginCommands = [
75- " PLUGINCOMMAND" , PLUGIN_COMMAND_REGISTER ,
76- " DEFAULTCARD" , DEFAULT_CARD ,
77- " OPTION" , OPTIONS ,
78- " UDPBOOL" , UDPBOOL ,
79- " UDPLIST" , UDPLIST ,
80- " MACRO" , MACRO
76+ " PLUGINCOMMAND" , PLUGIN_COMMAND_REGISTER , 0 ,
77+ " DEFAULTCARD" , DEFAULT_CARD , 0 ,
78+ " OPTION" , OPTIONS , 0 ,
79+ " UDPBOOL" , UDPBOOL , 0 ,
80+ " UDPLIST" , UDPLIST , 0 ,
81+ " MACRO" , MACRO , 0
8182];
8283
8384
@@ -104,7 +105,7 @@ list SeatedAvs(){
104105 return avs ;
105106}
106107
107- assignSlots (){
108+ assignSlots (string cardName ){
108109 list avqueue = SeatedAvs ();
109110 /* clean up the Slots list with regard to AV key's in the list by
110111 removing extra AV keys from the Slots list, they are no longer seated.
@@ -184,7 +185,7 @@ assignSlots(){
184185 }
185186 }
186187 LastStrideCount = SlotMax ;
187- llMessageLinked (LINK_SET , SEAT_UPDATE , llDumpList2String (Slots , " ^" ), NULL_KEY );
188+ llMessageLinked (LINK_SET , SEAT_UPDATE , llDumpList2String (Slots , " ^" ), cardName );
188189}
189190
190191SwapTwoSlots (integer currentseatnum , integer newseatnum ) {
@@ -193,8 +194,9 @@ SwapTwoSlots(integer currentseatnum, integer newseatnum) {
193194 integer OldSlot ;
194195 integer NewSlot ;
195196 for (; slotNum < SlotMax ; ++ slotNum ) {
196- integer z = llSubStringIndex (llList2String (Slots , slotNum * 8 + 7 ), " §" );
197- string strideSeat = llGetSubString (llList2String (Slots , slotNum * 8 + 7 ), z + 1 ,- 1 );
197+ list tempSeat = llParseStringKeepNulls (llList2String (Slots , slotNum * STRIDE + 7 ), [" §" ], []);
198+ string strideSeat = llList2String (tempSeat , 1 );
199+ tempSeat = [];
198200 if (strideSeat == " seat" + (string )(currentseatnum )) {
199201 OldSlot = slotNum ;
200202 }
@@ -238,13 +240,13 @@ ProcessLine(string sLine, key av, string ncName, string path, integer page) {
238240 if (action == " ANIM" ) {
239241 if (SlotMax < LastStrideCount ) {
240242 Slots = llListReplaceList (Slots , [llList2String (params , 1 ), (vector )llList2String (params , 2 ),
241- llEuler2Rot ((vector )llList2String (params , 3 ) * DEG_TO_RAD ), llList2String (params , 4 ), llList2Key (Slots , (SlotMax )* STRIDE + 4 ),
242- " " , " " , llGetSubString (llList2String (params , 5 ), 0 , 12 ) + " §" + " seat" + (string )(SlotMax + 1 )], (SlotMax )* STRIDE , (SlotMax )* STRIDE + 7 );
243+ llEuler2Rot ((vector )llList2String (params , 3 ) * DEG_TO_RAD ), llList2String (params , 4 ), llList2Key (Slots , (SlotMax )* STRIDE + 4 ), " " , " " ,
244+ llGetSubString (llList2String (params , 5 ), 0 , 12 ) + " §" + " seat" + (string )(SlotMax + 1 ) + " § " + action + " § " + ncName ], (SlotMax )* STRIDE , (SlotMax )* STRIDE + 7 );
243245 }
244246 else {
245247 Slots += [llList2String (params , 1 ), (vector )llList2String (params , 2 ),
246248 llEuler2Rot ((vector )llList2String (params , 3 ) * DEG_TO_RAD ), llList2String (params , 4 ), " " , " " , " " ,
247- llGetSubString (llList2String (params , 5 ), 0 , 12 ) + " §" + " seat" + (string )(SlotMax + 1 )];
249+ llGetSubString (llList2String (params , 5 ), 0 , 12 ) + " §" + " seat" + (string )(SlotMax + 1 ) + " § " + action + " § " + ncName ];
248250 }
249251 SlotMax ++ ;
250252 }
@@ -268,6 +270,7 @@ ProcessLine(string sLine, key av, string ncName, string path, integer page) {
268270 if (action == " SCHMOE" || (action == " SCHMO" && llList2Key (Slots , slotNumber * STRIDE + 4 ) == av )) {
269271 integer index = 2 ;
270272 integer length = llGetListLength (params );
273+ string seatName = llList2String (llParseStringKeepNulls (llList2String (params , 7 ), [" §" ], []), 0 );
271274 for (; index < length ; index ++ ) {
272275 if (index == 2 ) {
273276 Slots = llListReplaceList (Slots , [llList2String (params , index )],
@@ -289,48 +292,61 @@ ProcessLine(string sLine, key av, string ncName, string path, integer page) {
289292 slotNumber * STRIDE + 3 , slotNumber * STRIDE + 3 );
290293 }
291294 else if (index == 6 ) {
292- Slots = llListReplaceList (Slots , [llList2String (params , index ) + " §seat" + (string )(slotNumber + 1 )],
293- slotNumber * STRIDE + 7 , slotNumber * STRIDE + 7 );
295+ seatName = llList2String (params , index );
294296 }
295297 }
298+ Slots = llListReplaceList (Slots ,
299+ [
300+ llDumpList2String ([seatName , " seat" + (string )(slotNumber + 1 ), action , ncName ], " §" )
301+ ],
302+ slotNumber * STRIDE + 7 , slotNumber * STRIDE + 7 );
296303 }
297304 }
298305 SlotMax = LastStrideCount ;
299306 }
300307 else if (action == " PROP" ) {
301308 string obj = llList2String (params , 1 );
302309 if (llGetInventoryType (obj ) == INVENTORY_OBJECT ) {
310+ // the old die command for explicit props. should be removed soon.
303311 list strParm2 = llParseString2List (llList2String (params , 2 ), [" =" ], []);
304312 if (llList2String (strParm2 , 1 ) == " die" ) {
305313 llRegionSay (ChatChannel ,llList2String (strParm2 ,0 )+ " =die" );
306314 }
307315 else {
308- ExplicitFlag = 0 ;
309- if (llList2String (params , 4 ) == " explicit" ) {
310- ExplicitFlag = 1 ;
316+ // the rezzing
317+ string propGroupString = llList2String (params , 4 );
318+ integer propGroup = (integer )propGroupString ;
319+ if (propGroupString == " explicit" ) {
320+ propGroup = 1 ;
311321 }
312322 // This flag will keep the prop from chatting out it's moves. Some props should move but not spam owner.
323+ integer quietMode ;
313324 if (llList2String (params , 5 ) == " quiet" ) {
314- ExplicitFlag += 2 ;
325+ quietMode = TRUE ;
315326 }
327+ // calculate pos and rot of the prop
316328 vector vDelta = (vector )llList2String (params , 2 );
317329 vector pos = llGetPos () + (vDelta * llGetRot ());
318330 rotation rot = llEuler2Rot ((vector )llList2String (params , 3 ) * DEG_TO_RAD ) * llGetRot ();
319- integer sendToPropChannel = (ChatChannel << 8 );
320- sendToPropChannel = sendToPropChannel | ExplicitFlag ;
331+
332+ // build the rez paremeter. Upper 3 Bytes for the chatchannel, lower Byte for data
333+ integer rezParam = (ChatChannel << 8 );
334+ rezParam = rezParam | (quietMode << 1 ) | ((propGroup & 0x2F ) << 2 );
321335 if (llVecMag (vDelta ) > 9.9 ) {
322336 // too far to rez it direct. need to do a prop move
323- llRezAtRoot (obj , llGetPos (), ZERO_VECTOR , rot , sendToPropChannel );
337+ llRezAtRoot (obj , llGetPos (), ZERO_VECTOR , rot , rezParam );
324338 llSleep (1.0 );
325339 llRegionSay (ChatChannel , llDumpList2String ([" MOVEPROP" , obj , (string )pos ], " |" ));
326340 }
327341 else {
328- llRezAtRoot (obj , llGetPos () + ((vector )llList2String (params , 2 ) * llGetRot ()),
329- ZERO_VECTOR , rot , sendToPropChannel );
342+ llRezAtRoot (obj , pos , ZERO_VECTOR , rot , rezParam );
330343 }
331344 }
332345 }
333346 }
347+ else if (action == " PROPDIE" ) {
348+ llRegionSay (ChatChannel , llList2Json (JSON_ARRAY , [llList2Json (JSON_ARRAY , params )]));
349+ }
334350 else if (action == " PAUSE" ) {
335351 llSleep ((float )llList2String (params , 1 ));
336352 }
@@ -382,7 +398,12 @@ ProcessLine(string sLine, key av, string ncName, string path, integer page) {
382398 integer index = llListFindList (PluginCommands , [action ]);
383399 if (~ index ) {
384400 integer num = llList2Integer (PluginCommands , index + 1 );
385- llMessageLinked (LINK_SET , num , llDumpList2String (llDeleteSubList (params , 0 , 0 ), " |" ), " " );
401+ string str = llDumpList2String (llDeleteSubList (params , 0 , 0 ), " |" );
402+ llMessageLinked (LINK_SET , num , str , " " );
403+ if (llList2Integer (PluginCommands , index + 2 )) {
404+ // this should also be send to props
405+ llRegionSay (ChatChannel , llList2Json (JSON_ARRAY , [llList2Json (JSON_ARRAY , [" LINKMSG" , num , str , " " ])]));
406+ }
386407 }
387408 else {
388409 llMessageLinked (LINK_SET , UNKNOWN_COMMAND , sLine , av );
@@ -441,6 +462,10 @@ default{
441462 str = " " ;
442463 // allData: [ncName, paramSet1, "", contentLine1, contentLine2, ...]
443464 string ncName = llList2String (allData , 0 );
465+ if (ncName == DefaultCardName && num == DOPOSE_READER ) {
466+ // props (propGroup 0) die when the default card is read
467+ llRegionSay (ChatChannel , " die" );
468+ }
444469 list paramSet1List = llParseStringKeepNulls (llList2String (allData , 1 ), [" |" ], []);
445470 string path = llList2String (paramSet1List , 0 );
446471 integer page = (integer )llList2String (paramSet1List , 1 );
@@ -458,7 +483,7 @@ default{
458483 // reset the slots
459484 LastStrideCount = SlotMax ;
460485 SlotMax = 0 ;
461- // handle the Adjuster
486+ // props (propGroup 0) die if there is an ANIM line inside the NC
462487 llRegionSay (ChatChannel , " die" );
463488 slotResetFinished = TRUE ;
464489 run_assignSlots = TRUE ;
@@ -482,7 +507,7 @@ default{
482507 }
483508 }
484509 if (run_assignSlots ) {
485- assignSlots ();
510+ assignSlots (ncName );
486511 if (llGetInventoryType (ncName ) == INVENTORY_NOTECARD ){ // sanity
487512 LastAssignSlotsCardName = ncName ;
488513 LastAssignSlotsCardId = llGetInventoryKey (LastAssignSlotsCardName );
@@ -534,9 +559,11 @@ default{
534559 // new seat# occupant will then occupy the old seat# of menu user.
535560 // usage: LINKMSG|210|3 Will swap menu user to seat3 and seat3 occupant moves to existing menu user's seat#
536561 // this is intended as an internal call for ChangeSeat button but can be used by any plugin, LINKMSG, or SAT/NOTSATMSG
537- integer slotIndex = llListFindList (Slots , [id ]);
538- integer z = llSubStringIndex (llList2String (Slots , slotIndex + 3 ), " §" );
539- string strideSeat = llGetSubString (llList2String (Slots , slotIndex + 3 ), z + 1 ,- 1 );
562+ integer slotIndex = llListFindList (Slots , [id ])/ STRIDE ;
563+ list tempSeat = llParseStringKeepNulls (llList2String (Slots , slotIndex * STRIDE + 7 ), [" §" ], []);
564+ string strideSeat = llList2String (tempSeat , 1 );
565+ tempSeat = [];
566+
540567 integer oldseat = (integer )llGetSubString (strideSeat , 4 ,- 1 );
541568 if (oldseat <= 0 ) {
542569 llWhisper (0 , " avatar is not assigned a slot: " + (string )id );
@@ -575,9 +602,10 @@ default{
575602 list parts = llParseString2List (str , [" |" ], []);
576603 string action = llList2String (parts , 0 );
577604 integer index = llListFindList (PluginCommands , [action ]);
578- if (! ~index ) {
579- PluginCommands += [ action , ( integer ) llList2String ( parts , 1 )] ;
605+ if (~ index ) {
606+ PluginCommands = llDeleteSubList ( PluginCommands , index , index + 2 ) ;
580607 }
608+ PluginCommands += [action , (integer )llList2String (parts , 1 ), (integer )llList2String (parts , 2 )];
581609 }
582610 else if (num == DIALOG_TIMEOUT ) {
583611 if (Cur2default && (llGetObjectPrimCount (llGetKey ()) == llGetNumberOfPrims ()) && (DefaultCardName != " " )) {
@@ -676,7 +704,7 @@ default{
676704 }
677705 if (change & CHANGED_LINK ) {
678706 llMessageLinked (LINK_SET , SEND_CHATCHANNEL , (string )ChatChannel , NULL_KEY ); // let our scripts know the chat channel for props and adjusters
679- assignSlots ();
707+ assignSlots (LastAssignSlotsCardName );
680708 if (Cur2default && (llGetObjectPrimCount (llGetKey ()) == llGetNumberOfPrims ()) && (DefaultCardName != " " )) {
681709 llMessageLinked (LINK_SET , DOPOSE , DefaultCardName , NULL_KEY );
682710 }
0 commit comments