Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
archiv:opensim:downloads:scripts:visitor_list_recorder [2024/01/09 22:25] – Externe Bearbeitung 127.0.0.1 | archiv:opensim:downloads:scripts:visitor_list_recorder [Unbekanntes Datum] (aktuell) – Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ===== Visitor List Recorder ===== | ||
+ | |||
+ | < | ||
+ | // Global variables | ||
+ | list visitor_list; | ||
+ | float range = 10.0; // in meters | ||
+ | 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, | ||
+ | { | ||
+ | return TRUE; | ||
+ | } | ||
+ | } | ||
+ | return FALSE; | ||
+ | } | ||
+ | |||
+ | // States | ||
+ | default | ||
+ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | llSay(0, " | ||
+ | llSay(0, "The owner can say ' | ||
+ | llSensorRepeat( "", | ||
+ | llListen(0, "", | ||
+ | } | ||
+ | |||
+ | |||
+ | sensor( integer number_detected ) | ||
+ | { | ||
+ | integer i; | ||
+ | for( i = 0; i < number_detected; | ||
+ | { | ||
+ | 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 == " | ||
+ | { | ||
+ | llSay( 0, "This object records the names of everyone who" ); | ||
+ | llSay( 0, "comes within "+ (string)range + " meters." | ||
+ | llSay( 0, " | ||
+ | llSay( 0, "' | ||
+ | llSay( 0, "' | ||
+ | llSay( 0, "' | ||
+ | } | ||
+ | else | ||
+ | if( message == "say list" ) | ||
+ | { | ||
+ | llSay( 0, " | ||
+ | integer len = llGetListLength( visitor_list ); | ||
+ | integer i; | ||
+ | for( i = 0; i < len; i++ ) | ||
+ | { | ||
+ | llSay( 0, llList2String(visitor_list, | ||
+ | } | ||
+ | llSay( 0, "Total = " + (string)len ); | ||
+ | } | ||
+ | else | ||
+ | if( message == "reset list" ) | ||
+ | { | ||
+ | visitor_list = llDeleteSubList(visitor_list, | ||
+ | llSay( 0, "Done resetting." | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||