I been trying to combine 2 scripts one I found on the wiki the other is a visitor list maker.
I want to give a note card out but just once to each person in thier own language.
I'm lost can some smart guy show me how to set up the for loops so this works?
this seems to give the first person it finds a bunch of notes lol.
list visitor_list;
float range = 45.0; // in meters
float rate = 5.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;
}
default
{
state_entry()
{
llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
llListen(0, llGetOwner(), "", ""
;}
on_rez(integer pop)
{
llResetScript();
}
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" )
{
llSay( 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."
;}
}
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 )
{
integer j;
for(j=0;j<number_detected;j++) {
string name=llDetectedName(j);
string lang=llGetAgentLanguage(llDetectedKey(i));
if(lang==""
lang="en"; // Default to English.if(lang=="en"
{llSay(0,"Hi there, "+name+"!"
;llGiveInventory(llDetectedKey(i),"Warning in English"
;}else if(lang=="es"
{llSay(0,"¡Hola, "+name+"!"
;llGiveInventory(llDetectedKey(i),"Warning in Spanish"
;}else if(lang=="fr"
{llSay(0,"Salut, "+name+" !"
;llGiveInventory(llDetectedKey(i),"Warning in French"
;}else if(lang=="ja"
{llSay(0,"やあ、 "+name+"!"
;llGiveInventory(llDetectedKey(i),"Warning in Japanese"
;}else if(lang=="de"
{llSay(0,"Hallo, "+name+"!"
;llGiveInventory(llDetectedKey(i),"Warning in German"
;}else if(lang=="pt"
{llSay(0,"Olá!, "+name+"!"
;llGiveInventory(llDetectedKey(i),"Warning in Portuguese"
;}else if(lang=="ko"
{llSay(0,"안녕하세요, "+name+"!"
;llGiveInventory(llDetectedKey(i),"Warning in Korean"
;}else if(lang=="zh"
{llSay(0,"你好啊, "+name+"!"
;llGiveInventory(llDetectedKey(i),"Warning in Chinese"
;}
}
visitor_list += detected_name;
}
//}
}
}
}