Jump to content

Change State After HTTP Request


UbiquitousStudio
 Share

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

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

Recommended Posts

Hello, I am trying to change the state while outputting the body of a website. I can move it to the next state fine, but the output doesn't happen, is there any way around this by any chance?

Here is my code

string updateurl = "No URL";
key updatekey;
list updateparams = [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"];

string username;

default
{
    state_entry()
    {

    }

    touch_start(integer total_number)
    {
        updatekey = llHTTPRequest(updateurl, updateparams, "username=" + username);
        
    }
    
    http_response(key request_id, integer status, list metadata, string body)
    {        
        if(request_id == updatekey)
        {
            llOwnerSay("\n" + body);
        }
    } 
}

state idle
{
    state_entry()
    {
        llOwnerSay("Idle State");
    }

    touch_start(integer total_number)
    {

    }   
}

I am simply trying to get to the idle state, but still output the body of the website. Accept when I go to idle it skips the body. I can't think of a workaround so I am here asking.

 

Thanks again!

Link to comment
Share on other sites

    http_response(key request_id, integer status, list metadata, string body)    {                if(request_id == updatekey)        {            llOwnerSay("\n" + body);

STATE idle; <--- add this

} }

 

 

That should work, but you will never go to idle if you never see a response.

 

  • Like 1
Link to comment
Share on other sites

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