Jump to content

Syncing RLV Listen events


poppy796
 Share

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

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

Recommended Posts

Hi all, I started this topic because I'm stuck.
I've been trying to make a comprehensive RLV trap. That means in one single script I've written (RLV) procedures that I can call in a main procedure called SequenceOfEvents()

Most (simple) RLV procedures like force sit, TPAllow and such work perfectly because they directly act on the RLV Relay. Others require some polling, which means the initial procedure itself requests status info from the relay via a listen channel and first then act upon it (after listen). And that's where it goes wrong. Somehow I can't seem to control when a listen occurs, when my code acts upon that event and feeds back to the main procedure. I realise the story is a bit complex so let me try to explain with a piece of code:

// RLV procedures (examples)
RLVSend(string command){llRegionSay(RLVC,"cmd,"+(string)target+","+command);}
SitLock(string i){if(i=="y")RLVSend("@unsit=n"); else RLVSend("@unsit=y");}
TPAllow(string i){RLVSend("@tplm="+i+"|@tploc="+i+"|@tplocal:10="+i+"|@tplure="+i);}

// above procedures work perfectly, even in sequence....but:

DetachHUDs(){exthandle=llListen(Extchannel+1,"",tobject,""); RLVSend("@getattach="+(string)(Extchannel+1));}
CurrentOutfit(){exthandle=llListen(Extchannel,"",tobject, "");RLVSend("@getinvworn:"+Clothes_Folder+"/="+(string)Extchannel);}
Undress(string i){if (i=="All") i=""; RLVSend("@detachall:"+Clothes_Folder+"/"+outfit+"/"+i+"=force"); if (i=="Upper"|| i=="") RLVSend ("@attachall:"+On+"/Upper"=force");}
 

//above procedures don't work in sequence and I don't understand why...

SequenceOfEvents(string trgt)
{CurrentOutfit(); DetachHUDs; Undress("Upper");} //now this doesn't work because CurrentOutfit() gives me the outfit name way after Undress() ??

listen (integer chn, string user, key id, string msg)
    {
        if (chn==Extchannel)
        {
            llListenRemove(exthandle);integer i; integer teller=0; integer pointer;
            list temp0=llParseString2List(msg,[",","|"],[]);
            for (i=0; i<llGetListLength(temp0); i+=2) if (llList2Integer(temp0,i)>teller) {teller=llList2Integer(temp0,i); pointer =i;}
            outfit = llList2String(temp0,(pointer-1));
        }
        if (chn==(Extchannel+1))
        {
            llListenRemove(exthandle);integer teller;
            for (teller=31; teller<39; teller++) //31 tot 39 is hud attachment posities
            {if((integer)llGetSubString(msg,teller, teller)) RLVSend("@detach:"+llList2String(atc,(teller-31))+"=force");}
        }

Does anyone has any ideas what I'm doing wrong and how I can resolve it? I appreciate any help.

Link to comment
Share on other sites

a way to do this safely by example:

// global
integer hnd;


state_entry(...)
{
   hnd = llListen(1, ...);
   llSay(1, ...);
}

listen(integer channel, ...)
{
    if (channel == 1)
    {
         ... do something with 1 ...
         
         // setup listen 2
         llListenRemove(hnd);
         hnd = llListen(2, ...);
         llSay(2, ...);
     }     
     else if (channel == 2)
     {
         ... do something with 2 ...
         

     }
}              
  

 

  • Like 1
Link to comment
Share on other sites

23 hours ago, Mollymews said:

a way to do this safely by example:


// global
integer hnd;


state_entry(...)
{
   hnd = llListen(1, ...);
   llSay(1, ...);
}

listen(integer channel, ...)
{
    if (channel == 1)
    {
         ... do something with 1 ...
         
         // setup listen 2
         llListenRemove(hnd);
         hnd = llListen(2, ...);
         llSay(2, ...);
     }     
     else if (channel == 2)
     {
         ... do something with 2 ...
         

     }
}              
  

 

Thank you Molly! You lead me to a workable solution. Once I detect a RLV relay I switch state, determine outfit and huds and then switch back to default. It works brilliantly!

  • Like 1
Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...