Jump to content

Change State After HTTP Request


UbiquitousStudio
 Share

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

×
×
  • Create New...