Jump to content
Rhiannon Arkin

Dialog / listener problem

Recommended Posts

Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
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 );

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
Share on other sites

Thanks for all the input! 

The issue was that I still had a timer running in the script. and that was causing the script to go somewhere else instead of to the listen for the dialog. doh. 

Steph: what kind of clean up operation would you need there? 

Share this post


Link to post
Share on other sites
7 hours ago, Rhiannon Arkin said:

Steph: what kind of clean up operation would you need there? 

I left the code for you in my last post.

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.


×
×
  • Create New...