Been trying to get this script working for over 2 hours.. I wonder if someone can take a peek and see what I am doing wrong.
It makes a simple call to the web and gets back a simple reply of a color. I then want it to, based on the reply, enter the state associated with that color. I added a place to have the script echo the message from the server, and I am getting back the right data, but I am not understanding how to enter a new state and keep the data from the server intact, as I am never getting any of the entering state messages or for that matter the leaving default state message either so I suspect my 'if' statements are dying silently.
I hope I made sense! Here is the script:
BEGIN LSL
______________________
key http_request_id;
string URL = "http://www.somewebpagesomewhere/pickcolor.php";
default
{
state_entry(){}
on_rez (integer something)
{
http_request_id = llHTTPRequest(URL, [], ""
;}
http_response(key request_id, integer status, list metadata, string body)
{
llSay(0,body);
if (body == "RED"

{
state RED;
}
if (body == "GREEN"

{
state GREEN;
}
if (body == "BLUE"

{
state BLUE;
}
}
state_exit()
{
llSay(0,"Leaving Default state"
;}
}
state RED
{
state_entry()
{
llSay(0,"Entering Red State"
;}state_exit()
{
llSay(0,"Leaving Red state"
;}
}
state GREEN
{
state_entry()
{
llSay(0,"Entering Green State"
;}state_exit()
{
llSay(0,"Leaving Green state"
;}
}
state BLUE
{
state_entry()
{
llSay(0,"Entering Blue State"
;}
state_exit()
{
llSay(0,"Leaving Blue state"
;}
}
END LSL
Here is the very simple PHP file that sends back the info.
BEGIN PHP
-----------------------
<?php
{
echo "BLUE";
}
?>
__________________
END PHP
Sorry to be such a noob!!TIA!!