Jump to content
Sign in to follow this  
ChaosRaine

Using Lists

Recommended Posts

I have a script listening to a chat channel. When it hears a word it checks the list for the word. If it's not already on the list, it adds it. I'm having trouble checking the list for the word. Here's what I am doing.

Quote


        integer MC = 0;
        integer Done = llGetListLength(Liked);
        for (; MC<Done; ++MC)
        { 
        if (llList2String(Liked, MC) != (string)Match)
{
    
            llListenRemove(listener);
    
        Matches += Match;
        Matches += ",";
        
        
            ++mm; 
            
    llSetText((string)xx + " Likes \n" + (string)mm + " Matches", ZERO_VECTOR, 1);
        listener = llListen(MatchChannel,"",NULL_KEY,"");
        
}
else
{
    
     
    
    
        }
        }

 

Share this post


Link to post
Share on other sites

something like...

list liked = ["one", "Two", "three"];
default
{
    state_entry()
    { llListen(10, "","", "");
    }   
    listen( integer channel, string name, key id, string message )
    {
        if(message)          
        {     
            if (!~llListFindList(liked,[message])) 
            { llOwnerSay("adding *" + message + "* to list...");
              liked += message;              
            } 
            else
            { llOwnerSay("already on list...");
            }   
        }
     }
}

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...