SL - Forum scripts

lecture de notecard par nationalitée [resolu]

Répondre
Partager Rechercher
Bonjour
Tout d'abord je remercie tout ceux qui m'on aidé pour mon script de rotation
et comme c'est pour Janvier, j'ai laissé de coté pour l'instant
De plus les events s’enchaînant, je n'ai pas eu le temps de rien faire, si ce n'est préparer mes scènes
Today, j'ai juste un ou deux petits problemes
Explication de ma demande, quelqu’un vient toucher un panneaux d'information, et cela lui lis, dans sa langue, la note card que j'ai insérée, évidement plusieurs panneaux et notecards différentes
mon probleme c'est que j'arrive a "whisper" mais pas a lire dans son im
et deux, et la je cale, j'ai essayer plein de choses, mais le script semble ne pas s’arrêter, puisque il ne vas pas jusqu'a EOF ou la j'en suis avertie (temporaire) et que je reset
Donc le script marche qu'une seule fois Oo

Code:
string  NoteCard = "2Lei_Notice_1_En";
key    Qline;
key    Agent;
list    List_Ids;

read_data (integer nlignes)
{
    integer i;
    List_Ids = [];
    for (i = 0; i < nlignes; i = i + 1)
        List_Ids += (list)llGetNotecardLine(NoteCard, i);  
}
default{
    touch_start( integer num_detected ){
        for (num_detected -= 1; num_detected > -1; num_detected -= 1 ){
            key agent = llDetectedKey( num_detected );
            string name = llGetDisplayName( agent );
            string language = llGetAgentLanguage( agent );
            Agent = llDetectedKey( 1 );
 
            if (("" == name) || ("???" == name))
                name = llDetectedName( num_detected );
 
            if (language == "es"){
                llSay( PUBLIC_CHANNEL, "¡Hola, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Es"; state read;
            }else if (language == "fr"){
                llSay( PUBLIC_CHANNEL, "Salut, " + name + " !" );
                NoteCard = "2Lei_Notice_1_Fr"; state read;
            }else if (language == "ru"){
                llSay( PUBLIC_CHANNEL, "спасение, " + name + " !" );
                NoteCard = "2Lei_Notice_1_Ru"; state read;
            }else if (language == "it"){
                llSay( PUBLIC_CHANNEL, "Ciao, " + name + " !" );
                NoteCard = "2Lei_Notice_1_It"; state read;
            }else if (language == "nl"){
                llSay( PUBLIC_CHANNEL, "dag, " + name + " !" );
                NoteCard = "2Lei_Notice_1_Nl"; state read;
            }else if (language == "ja"){
                llSay( PUBLIC_CHANNEL, "やあ、 " + name + "!" );
                NoteCard = "2Lei_Notice_1_Ja"; state read;
            }else if (language == "de"){
                llSay( PUBLIC_CHANNEL, "Hallo, " + name + "!" );
                NoteCard = "2Lei_Notice_1_De"; state read; 
            }else if (language == "en"){ //-- returned by some TPVs
                llSay( PUBLIC_CHANNEL, "Hello, " + name + "!" );
                NoteCard = "2Lei_Notice_1_En"; state read;
            }else if (language == "pt"){
                llSay( PUBLIC_CHANNEL, "Olá!, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Pt"; state read;
            }else if (language == "ko"){
                llSay( PUBLIC_CHANNEL, "안녕하세요, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Ko"; state read;
            }else if (language == "zh"){
                llSay( PUBLIC_CHANNEL, "你好啊, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Zh"; state read; 
            }else{ 
                llSay( PUBLIC_CHANNEL, "Hi there, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Us"; state read;
            }
        }
    }
}
state read{
    state_entry()
    {
        Qline  = llGetNumberOfNotecardLines(NoteCard);
    }
    dataserver(key query_id, string data) 
    {
        integer index = llListFindList(List_Ids, (list)query_id);

        if (query_id == Qline) {
            read_data ( (integer) data);
        }
          else if (data == EOF) {
                llOwnerSay ("Plus de lignes dans la note");
                llResetScript();
          }
        else if ( index  != -1 ) 
            //llWhisper( PUBLIC_CHANNEL,data);
            llInstantMessage(Agent, data);
    }    
}
Vous remarquerez que j'ai mis en commentaire mon Whisper pour basculer entre mes test et le fonctionnement actuel

Merci d'avance

Princess Venusia

ps: j'ai essayer "llInstantMessage(llDetectedKey(0),data) et pas mieux " Invalid Key passed to instant message."

Dernière modification par Princess Venusia ; 05/11/2019 à 20h00.
Re
J'ai un peu remanié mon script (merci le Wiki English, pfff ils sont fort ces Amerlok)
Du coup j'ai mon reset, mon script fonctionne, mais toujours en Whisper
mais oh moins , a Default de prune on mange du riz
le voici remanié
Code:
string  NoteCard = "2Lei_Notice_1_En";
key notecardQueryId;

integer notecardLine;
say(string inputString)
{
    llOwnerSay(inputString);
}

default{
    touch_start( integer num_detected ){
        for (num_detected -= 1; num_detected > -1; num_detected -= 1 ){
            key agent = llDetectedKey( num_detected );
            string name = llGetDisplayName( agent );
            string language = llGetAgentLanguage( agent );
 
            if (("" == name) || ("???" == name))
                name = llDetectedName( num_detected );
 
            if (language == "es"){
                llWhisper( PUBLIC_CHANNEL, "¡Hola, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Es"; state read;
            }else if (language == "fr"){
                llWhisper( PUBLIC_CHANNEL, "Salut, " + name + " !" );
                NoteCard = "2Lei_Notice_1_Fr"; state read;
            }else if (language == "ru"){
                llWhisper( PUBLIC_CHANNEL, "спасение, " + name + " !" );
                NoteCard = "2Lei_Notice_1_Ru"; state read;
            }else if (language == "it"){
                llWhisper( PUBLIC_CHANNEL, "Ciao, " + name + " !" );
                NoteCard = "2Lei_Notice_1_It"; state read;
            }else if (language == "nl"){
                llWhisper( PUBLIC_CHANNEL, "dag, " + name + " !" );
                NoteCard = "2Lei_Notice_1_Nl"; state read;
            }else if (language == "ja"){
                llWhisper( PUBLIC_CHANNEL, "やあ、 " + name + "!" );
                NoteCard = "2Lei_Notice_1_Ja"; state read;
            }else if (language == "de"){
                llWhisper( PUBLIC_CHANNEL, "Hallo, " + name + "!" );
                NoteCard = "2Lei_Notice_1_De"; state read; 
            }else if (language == "en"){ //-- returned by some TPVs
                llWhisper( PUBLIC_CHANNEL, "Hello, " + name + "!" );
                NoteCard = "2Lei_Notice_1_En"; state read;
            }else if (language == "pt"){
                llWhisper( PUBLIC_CHANNEL, "Olá!, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Pt"; state read;
            }else if (language == "ko"){
                llWhisper( PUBLIC_CHANNEL, "안녕하세요, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Ko"; state read;
            }else if (language == "zh"){
                llWhisper( PUBLIC_CHANNEL, "你好啊, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Zh"; state read; 
            }else{ 
                llWhisper( PUBLIC_CHANNEL, "Hi there, " + name + "!" );
                NoteCard = "2Lei_Notice_1_Us"; state read;
            }
        }
    }
}
state read{
    state_entry()
    {
        if (llGetInventoryKey(NoteCard) == NULL_KEY)
        {
            llOwnerSay( "Notecard '" + NoteCard + "' missing or unwritten");
            return;
        }
        notecardQueryId = llGetNotecardLine(NoteCard, notecardLine);
    }
 
    dataserver(key query_id, string data)
    {
        if (query_id == notecardQueryId)
        {
            if (data == EOF)
                llResetScript();
            else
            {
                ++notecardLine;
                //llInstantMessage(llDetectedKey( num_detected ), data);
                llWhisper( PUBLIC_CHANNEL,data);
                notecardQueryId = llGetNotecardLine(NoteCard, notecardLine);
            }
        }
    }
}
teste ça..



string NoteCard ;
key notecardQueryId;

key agent;
string name;

integer notecardLine;
integer i;

default
{
touch_start( integer num )

{
for (i = 0; i < num; i++)
{
name = llDetectedName(i);
agent = llDetectedKey(i);
string language = llGetAgentLanguage(llDetectedKey(i));

if (language == "es"){
llWhisper( PUBLIC_CHANNEL, "¡Hola, " + name + "!" );
NoteCard = "2Lei_Notice_1_Es"; state read;
}else if (language == "fr"){
llWhisper( PUBLIC_CHANNEL, "Salut, " + name + " !" );
NoteCard = "2Lei_Notice_1_Fr"; state read;
}else if (language == "ru"){
llWhisper( PUBLIC_CHANNEL, "спасение, " + name + " !" );
NoteCard = "2Lei_Notice_1_Ru"; state read;
}else if (language == "it"){
llWhisper( PUBLIC_CHANNEL, "Ciao, " + name + " !" );
NoteCard = "2Lei_Notice_1_It"; state read;
}else if (language == "nl"){
llWhisper( PUBLIC_CHANNEL, "dag, " + name + " !" );
NoteCard = "2Lei_Notice_1_Nl"; state read;
}else if (language == "ja"){
llWhisper( PUBLIC_CHANNEL, "やあ、 " + name + "!" );
NoteCard = "2Lei_Notice_1_Ja"; state read;
}else if (language == "de"){
llWhisper( PUBLIC_CHANNEL, "Hallo, " + name + "!" );
NoteCard = "2Lei_Notice_1_De"; state read;
}else if (language == "en"){ //-- returned by some TPVs
llWhisper( PUBLIC_CHANNEL, "Hello, " + name + "!" );
NoteCard = "2Lei_Notice_1_En"; state read;
}else if (language == "pt"){
llWhisper( PUBLIC_CHANNEL, "Olá!, " + name + "!" );
NoteCard = "2Lei_Notice_1_Pt"; state read;
}else if (language == "ko"){
llWhisper( PUBLIC_CHANNEL, "안녕하세요, " + name + "!" );
NoteCard = "2Lei_Notice_1_Ko"; state read;
}else if (language == "zh"){
llWhisper( PUBLIC_CHANNEL, "你好啊, " + name + "!" );
NoteCard = "2Lei_Notice_1_Zh"; state read;
}else{
llWhisper( PUBLIC_CHANNEL, "Hi there, " + name + "!" );
NoteCard = "2Lei_Notice_1_Us"; state read;
}
}
}
}

state read
{
state_entry()
{
if (llGetInventoryKey(NoteCard) == NULL_KEY)
{
llOwnerSay( "Notecard '" + NoteCard + "' missing or unwritten");
return;
}
notecardQueryId = llGetNotecardLine(NoteCard, notecardLine);
}


dataserver(key query_id, string data)
{
if (query_id == notecardQueryId)
{
if (data == EOF)
{
llSay(0, "Fin de nc : " + (string)notecardLine + " ligne(s) lue(s).");
llResetScript();
}
else
{
notecardLine++;
notecardQueryId = llGetNotecardLine(NoteCard, notecardLine);
llInstantMessage(agent, data);
//llWhisper( PUBLIC_CHANNEL,data);
}
}
}
}
Hahaha c'est genial, je n'ai pas le temps maintenant d'etudier, tout ce que j'ai fait et qui n'as pas marcher, et pourquoi
On a un exposant qui fait son vernissage, mais des que j'ai le temps je veut comprendre
Merci mille fois
grazie millé
Ps sont trop forts ces fromages blancs

Citation :
Publié par MenthalOH
teste ça..



string NoteCard ;
key notecardQueryId;

key agent;
string name;

integer notecardLine;
integer i;

default
{
touch_start( integer num )

{
for (i = 0; i < num; i++)
{
name = llDetectedName(i);
agent = llDetectedKey(i);
string language = llGetAgentLanguage(llDetectedKey(i));

if (language == "es"){
llWhisper( PUBLIC_CHANNEL, "¡Hola, " + name + "!" );
NoteCard = "2Lei_Notice_1_Es"; state read;
}else if (language == "fr"){
llWhisper( PUBLIC_CHANNEL, "Salut, " + name + " !" );
NoteCard = "2Lei_Notice_1_Fr"; state read;
}else if (language == "ru"){
llWhisper( PUBLIC_CHANNEL, "спасение, " + name + " !" );
NoteCard = "2Lei_Notice_1_Ru"; state read;
}else if (language == "it"){
llWhisper( PUBLIC_CHANNEL, "Ciao, " + name + " !" );
NoteCard = "2Lei_Notice_1_It"; state read;
}else if (language == "nl"){
llWhisper( PUBLIC_CHANNEL, "dag, " + name + " !" );
NoteCard = "2Lei_Notice_1_Nl"; state read;
}else if (language == "ja"){
llWhisper( PUBLIC_CHANNEL, "やあ、 " + name + "!" );
NoteCard = "2Lei_Notice_1_Ja"; state read;
}else if (language == "de"){
llWhisper( PUBLIC_CHANNEL, "Hallo, " + name + "!" );
NoteCard = "2Lei_Notice_1_De"; state read;
}else if (language == "en"){ //-- returned by some TPVs
llWhisper( PUBLIC_CHANNEL, "Hello, " + name + "!" );
NoteCard = "2Lei_Notice_1_En"; state read;
}else if (language == "pt"){
llWhisper( PUBLIC_CHANNEL, "Olá!, " + name + "!" );
NoteCard = "2Lei_Notice_1_Pt"; state read;
}else if (language == "ko"){
llWhisper( PUBLIC_CHANNEL, "안녕하세요, " + name + "!" );
NoteCard = "2Lei_Notice_1_Ko"; state read;
}else if (language == "zh"){
llWhisper( PUBLIC_CHANNEL, "你好啊, " + name + "!" );
NoteCard = "2Lei_Notice_1_Zh"; state read;
}else{
llWhisper( PUBLIC_CHANNEL, "Hi there, " + name + "!" );
NoteCard = "2Lei_Notice_1_Us"; state read;
}
}
}
}

state read
{
state_entry()
{
if (llGetInventoryKey(NoteCard) == NULL_KEY)
{
llOwnerSay( "Notecard '" + NoteCard + "' missing or unwritten");
return;
}
notecardQueryId = llGetNotecardLine(NoteCard, notecardLine);
}


dataserver(key query_id, string data)
{
if (query_id == notecardQueryId)
{
if (data == EOF)
{
llSay(0, "Fin de nc : " + (string)notecardLine + " ligne(s) lue(s).");
llResetScript();
}
else
{
notecardLine++;
notecardQueryId = llGetNotecardLine(NoteCard, notecardLine);
llInstantMessage(agent, data);
//llWhisper( PUBLIC_CHANNEL,data);
}
}
}
}

Dernière modification par Princess Venusia ; 05/11/2019 à 20h01.
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés