|
Moss Talamasca
Serpent & Thistle
Join date: 20 Aug 2005
Posts: 367
|
04-18-2006 16:43
How would you swap out the llSensorRepeat and replace it with a collision detector? I see alot of visitor counters but they all rely on the Linden sensor sweep. Since i want to see who teleports in through my landing points i know right where they'll be. Ive seen something like this in the private sims, i think. Also been thinking that a touch-activated dialogue menu would save lag versus the more common voice commands. Does this make sense? Any ideas? All help is greatly apprciated. // Global variables list visitor_list; float range = 30.0; // in meters key owner; float rate = 1.0; // in seconds // Functions integer isNameOnList( string name ) { integer len = llGetListLength( visitor_list ); integer i; for( i = 0; i < len; i++ ) { if( llList2String(visitor_list, i) == name ) { return TRUE; } } return FALSE; } // States default { on_rez(integer start_param) { owner = llGetOwner(); } state_entry() { llSay(0, "Visitor List Maker started..."); llSay(0, "The owner can say 'help' for instructions."); llSensorRepeat( "", "", AGENT, range, TWO_PI, rate ); llListen(0, "", owner, ""); } sensor( integer number_detected ) { integer i; for( i = 0; i < number_detected; i++ ) { if( llDetectedKey( i ) != llGetOwner() ) { string detected_name = llDetectedName( i ); if( isNameOnList( detected_name ) == FALSE ) { visitor_list += detected_name; } } } } listen( integer channel, string name, key id, string message ) { if( id != llGetOwner() ) { return; } if( message == "help" ) { llSay( 0, "This object records the names of everyone who" ); llSay( 0, "comes within "+ (string)range + " meters." ); llSay( 0, "Commands the owner can say:" ); llSay( 0, "'help' - Shows these instructions." ); llSay( 0, "'say list' - Says the names of all visitors on the list."); llSay( 0, "'reset list' - Removes all the names from the list." ); } else if( message == "say list" ) { llWhisper( 0, "Visitor List:" ); integer len = llGetListLength( visitor_list ); integer i; for( i = 0; i < len; i++ ) { llSay( 0, llList2String(visitor_list, i) ); } llSay( 0, "Total = " + (string)len ); } else if( message == "reset list" ) { visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list)); llSay( 0, "Done resetting."); } } }
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
04-18-2006 16:59
Post the script 
|
|
Moss Talamasca
Serpent & Thistle
Join date: 20 Aug 2005
Posts: 367
|
posted
04-18-2006 17:07
edited my previous post - thanks for looking
|
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
04-18-2006 17:36
Will llVolumeDetect catch people teleporting into the prim?
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
04-18-2006 17:53
Good question. You could make it a hollowed out prim though, and put it around the teleport point, and then anyone moving through it would be detected, I think. So I'd go with a large hollowed invisible sphere. Don't hollow it too far, or the collision might not register *shrug* Not something I've played with a lot. Here's a quick attempt. Might not compile, probably has a few bugs  // Global variables list visitor_list; integer handle;
// Functions integer isNameOnList( string name ) { integer len = llGetListLength( visitor_list ); integer i; for( i = 0; i < len; i++ ) { if( llList2String(visitor_list, i) == name ) { return TRUE; } } return FALSE; }
// States default { state_entry() { llWhisper(0, "Visitor List Maker started..."); llWhisper(0, "The owner can touch the object for commands."); llVolumeDetect(TRUE); } collision_start( integer number_detected ) { integer i; for( i = 0; i < number_detected; i++ ) { if( llDetectedType( i ) & AGENT ) { if( llDetectedKey( i ) != llGetOwner() ) { string detected_name = llDetectedName( i ); if( isNameOnList( detected_name ) == FALSE ) { visitor_list += detected_name; } } } } }
touch_start( integer number_detected ) { if( llDetectedKey( 0 ) != llGetOwner() ) { return; }
llSetTimerEvent( 30 ); integer channel = llFloor( 10000 + llFrand(10000) ); handle = llListen( channel, "", llGetOwner(), "" ); llDialog( llGetOwner(), "Please select from the following:", [ "help", "say", "reset" ], channel ); }
timer() { llWhisper( 0, "Idle too long." ); llSetTimerEvent( 0 ); llListenRemove( handle ); }
listen( integer channel, string name, key id, string message ) { llSetTimerEvent( 0 ); llListenRemove( handle );
if( id != llGetOwner() ) { return; } if( message == "help" ) { llWhisper( 0, "This object records the names of everyone who" ); llWhisper( 0, "comes within "+ (string)range + " meters." ); llWhisper( 0, "Commands the owner can say:" ); llWhisper( 0, "'help' - Shows these instructions." ); llWhisper( 0, "'say' - Says the names of all visitors on the list."); llWhisper( 0, "'reset' - Removes all the names from the list." ); } else if( message == "say" ) { llWhisper( 0, "Visitor List:" ); integer len = llGetListLength( visitor_list ); integer i; for( i = 0; i < len; i++ ) { llWhisper( 0, llList2String(visitor_list, i) ); } llWhisper( 0, "Total = " + (string)len ); } else if( message == "reset" ) { visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list)); llWhisper( 0, "Done resetting."); } } }
It'll still turn on a listener, but it'll turn it off again after the dialog button's been clicked, and it won't be on channel 0.
|
|
Moss Talamasca
Serpent & Thistle
Join date: 20 Aug 2005
Posts: 367
|
04-18-2006 18:29
I'll play with it, thanks. The syntax is the hardest part of doing scripts, so it helps a lot to get a head start like this. Thanks.
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
04-18-2006 19:11
Ah, I found one bug while loking through it a second time.
Where it tells you all the help stuff, change:
llWhisper( 0, "This object records the names of everyone who" ); llWhisper( 0, "comes within "+ (string)range + " meters." );
To:
llWhisper( 0, "This object records the names of everyone who" ); llWhisper( 0, "walks/flies through it." );
Or something like that. The variable 'range' is gone, since there's no sensor any more, so that won't compile.
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
04-19-2006 01:39
If a hollowed sphere won't work (although I think it will) you could make a 100% transparent linked box (5 prims since you don't need a floor in a cube, probably 3 with some clever building as the non-base faces of a tetrahedron).
|