Jump to content

How do I trigger my viewer to chat avatar keys in the region?


You are about to reply to a thread that has been inactive for 3447 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm writing a sim-wide scanner script that uses the information chatted on channel -777777777 and I've got most everything worked out; but, I don't know how to initiate the viewer chatting the information.  It works fine if an avatar enters or leaves the region - that triggers it.  But, how do I trigger it manually when I turn on the scanner?  Thanks.

The script follows: (pardon the trouble-shooting llOwnerSay messages - I'm still learning.)

list avatars;

default
{
    state_entry()
    {
        llListen(-777777777,"","","");
        llSetTimerEvent(2.0);
        llSetText("",<1.0,1.0,1.0>,1.0);
    }
    timer()
    {
       llSetText("",<1.0,1.0,1.0>,1.0);
       string hov_text="";
       integer num_recs=llGetListLength(avatars);
       list avi_names=[];
       integer i;
       for (i=0;i<num_recs;i++)
       {
            string cur_name=llKey2Name(llList2Key(avatars, i));
            key curr_avi=llList2Key(avatars, i);
            list avi_pos=llGetObjectDetails(curr_avi, ([OBJECT_POS]));
            vector avi_vec=(vector)(llList2String(avi_pos, 0));
            integer distance =(integer)llVecDist(llGetPos(), avi_vec);
            if (cur_name!="")
            {
                avi_names+=cur_name;
                hov_text+=llList2String(avi_names, i)+ "[" + (string)distance + "M]\n";
                llSetText(hov_text,<1.0,1.0,1.0>,1.0);
            }
        }          
    }

    listen(integer channel, string name, key id, string message)
    {
        if (channel==-777777777)
        {
           
            llOwnerSay("This is what I'm receiving..." + message);
            list tmplist=llCSV2List(message);
            llOwnerSay("My tmplist looks like this " + (string)tmplist);          
            key curr_avi= llList2Key(tmplist, 2);
            llOwnerSay("curr_avi's name is " + llKey2Name(curr_avi));
            if (llListFindList(avatars,[curr_avi])==-1 && llList2Integer(tmplist, 1) > 0)
            {
                avatars+=[curr_avi];
                if (~llListFindList(avatars, [curr_avi]))
                {
                    llOwnerSay("We just added " + llKey2Name(curr_avi) + " to our avatars list.");
                    llOwnerSay(llKey2Name(curr_avi) + " is located at " + (string)llGetObjectDetails(curr_avi, [OBJECT_POS]));
                    list avi_pos=llGetObjectDetails(curr_avi, ([OBJECT_POS]));
                    vector avi_vec=(vector)(llList2String(avi_pos, 0));
                    integer distance =(integer)llVecDist(llGetPos(), avi_vec);
                    llOwnerSay("which is " + (string)distance + "M away.");
                }
            }
            else if (~llListFindList(avatars, [curr_avi]) && llList2Integer(tmplist, 1) == 0)
            {
                integer index = llListFindList(avatars, [curr_avi]);
                llOwnerSay(llKey2Name(curr_avi) + " was found in our avatars list at index "+ (string)index);
                avatars=llDeleteSubList(avatars, index, index);
                if (~llListFindList(avatars, [curr_avi]))
                {
                    llOwnerSay(llKey2Name(curr_avi) + " is still in the list.");
                }
                if (!~llListFindList(avatars, [curr_avi]))
                {
                    llOwnerSay("We just deleted " + llKey2Name(curr_avi) + " from our avatars list");
                }
            }    
            //llOwnerSay("avatars = "+(string)avatars);
        }
    }
}

 

Link to post
Share on other sites

Just have your scanner send a "switch on" message on channel -77777777 and then listen for that specific message in this script.  If the script hears it, turn on the display with llSetTimerEvent(2.0).  If it hears a "switch off" message, use llSetTimerEvent(0.0).

Link to post
Share on other sites

Hi Rolig,

 

I tried chatting "switch on" on channel -777777777; but, it didn't do anything.  I use emDash, too, and whenever I trigger emDash's built in HUD scanner it triggers the viewer and my scanner receives the info, but I'm not seeing any "switch on" or "switch off" messages on that channel.  I'm just capturing whatever is heard on -777777777 and using llOwnerSay to let me know what is being received by the listen event in the script.  Any other suggestions?  Thanks.

Link to post
Share on other sites

Um... Did you modify your script to listen for the "switch on" message?  As in ....

if ( message == "switch on")

{

    llSetTimerEvent(2.0);

}

.... and taking the llSetTimerEvent2.0) out of the state_entry event?  Just saying "switch on" won't do anything unless the script knows what it means.

Link to post
Share on other sites

I'm not trying to figure out how to trigger my scanner script.  I'm trying to figure out how to get my Phoenix or other TPV to chat the avatar keys in the region.  They do this automatically whenever avatars enter or leave the region.  But, if the scanner is turned on, and no avatars come or go, it just sits there - because, it's receiving no data.  But, as soon as an avatar comes or goes, or as soon as I turn on emDash's built in HUD scanner, the TPV chats the keys.  That's what I'm trying to trigger.  Sorry for the confusion.  And, thanks for your help.  It is much appreciated.

Link to post
Share on other sites

I contacted Cheshyr Pontchartrain who created emDash and he was good enough to share this information.  You must play a sound to trigger the TPV to chat the keys in the region.

llTriggerSound("76c78607-93f9-f55a-5238-e19b1a181389", 1.0);

That did the trick!  Thanks, and hopefully others can benefit from this little tidbit.

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3447 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...