Jump to content

Dialog / listener problem


Rhiannon Arkin
 Share

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

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

Recommended Posts

Hi. I'm not finding what i'm doing wrong. So i have to ask here for some advice. 

I'm working on a hud that pings a http server for data, and that server, on my domain, pings back and it all seems to work. If that player does not exist, the server returns a string with a command "fnop" and I want to open a menu with some additional choices, which I then will send back to the server. 

So far so good. Not sure if these snippets are enough information. There's not much to the script, I have a few states and this happens in a state dedicated to that server interaction. 

 

http_request(key id, string method, string body)
    {
        if (method=="POST") // incoming from server
            {   list temp=llParseString2List(body,["&"],[""]);
                //server says nope 
                if (llList2String(temp,0)=="fnop"){//--> menu 
                    llListenRemove(menu_listener);
                    menu_listener=llListen(hudchan_menu,"",playerID,"");
                    llDialog(playerID,maintext,menu_list,hudchan_menu);
                    }

}}

and in the same state I have the listen:

listen( integer chan, string name, key id, string message )
    {
        if (chan==hudchan_menu){
            llOwnerSay(message);

}}

 

 

It all works up to the dialog box, the http server responds, I receive the "post" and the dialog opens. i can click on the choices and expected the listen on the same channel to hear it. but it just doesn't. It doesn't hear the dialog box. 

So i wonder if there is an issue with the dialog being inside the http_request event? 

well, maybe somebody has an idea about this. 

thanks in advance

 

R.

 

Edited by Rhiannon Arkin
Link to comment
Share on other sites

There's nothing wrong with putting llDialog in the http_request event.  I suggest removing playerID from your listen handler

19 minutes ago, Rhiannon Arkin said:

menu_listener=llListen(hudchan_menu,"",playerID,"");

because it really isn't necessary, but that's not related to your issue.  Without seeing more of your script, I can only guess.  If I were you, though, I would pepper the script with diagnostic messages to see what values some of your key variables have.  Be very suspicious of variables that are defined in one state but were not created as global variables, so they are unknown in other states. Or, worse, places where you have defined a local variable with the name that you already assigned to a global variable.

Link to comment
Share on other sites

Be sure your  key value is valid the whole llDialog session.

Pseudo example:

key ID; // Global variable

ID = llDetectedKey(0);

llListen( integer channel, string name, key ID, string msg );

llDialog( key ID, string message, list buttons, integer channel );

Link to comment
Share on other sites

5 hours ago, Rhiannon Arkin said:

 

Can not tell from that lack of information. One thing that looks odd is that the HTTP is being stored with no clean up operation. This should be trimmed before each seperator and then tested.

list temp = llParseString2List(body,["&"],[""]);
string temp0 = llStringTrim(llList2String(temp, 0), STRING_TRIM);

      if( temp0 == "fnop" )

Edited by steph Arnott
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1863 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...