Jump to content

cant touch object anymore after adding xml response script


morgen Sinatra
 Share

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

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

Recommended Posts

hallo people,

i am really new to second life scripting. i am working on a script wich requests an html page when an object is touched. also the objekt gets visible when an script from outside second life sends a xml call to the object. everything in the script works fine, but there happen strange things sometimes. one thing is that i can not touch my object after the latest script refresh. do you know this effect. why is this happening? here is my script:

key remoteChannel;
init() {
    llOpenRemoteDataChannel(); // create an XML-RPC channel
    llOwnerSay("My key is " + (string)llGetKey());
}

default
{
        state_entry() {
            init();
        }
     
        state_exit() {
            return;
        }
     
        on_rez(integer param) {
            llResetScript();        
        }
     
        remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) {
         if (type == REMOTE_DATA_CHANNEL) { // channel created
             llSay(DEBUG_CHANNEL,"Channel opened for REMOTE_DATA_CHANNEL" + 
            (string)channel + " " + (string)message_id + " " + (string)sender + " " +                         
            (string)ival + " " + (string)sval);
             remoteChannel = channel;
             llOwnerSay("Ready to receive requests on channel \"" + (string)channel + "\"");                        
             state receiving; // start handling requests
         } else {
             llSay(DEBUG_CHANNEL,"Unexpected event type"); 
         }                       
        
        llSay(0, "Hello, Avatar!");
        llSay(0, "alpha is" + (string)llGetAlpha(ALL_SIDES));
    }

    touch_start(integer total_number)
    {
        if(llGetOwner() == llDetectedKey(0))
        {
            
           

            llSay(0, "owner is" + (string)llGetOwner());
            llSay(0, "key is" + (string)llDetectedKey(0));
            llSay(0, "alpha is" + (string)llGetAlpha(ALL_SIDES));
            if(llGetAlpha(ALL_SIDES) > 0)
            {
                 llSetAlpha(0,ALL_SIDES); 
                 llHTTPRequest("#", [], "");
                 llRemoveInventory(llGetScriptName());
            }
            else
            {
                 llSetAlpha(1,ALL_SIDES);    

            }       
        }
        else
        {
            if(llGetAlpha(ALL_SIDES) == 0)
            {
                 llSetAlpha(0,ALL_SIDES);
                 llSay(0, "Touched.");
                 llPlaySound("94ce2002-fc73-28b0-340c-c96c2f613d68", 0.5); 
              
            }     
        }  
    }
}

state receiving {
 
    state_entry() {
        llOwnerSay("Ready to receive information from outside SL");
    }  
 
    state_exit() {
        llOwnerSay("No longer receiving information from outside SL.");
        llCloseRemoteDataChannel(remoteChannel);
    }
 
    on_rez(integer param) {
        llResetScript();
    }
 
    remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) {
        if (type == REMOTE_DATA_REQUEST) { // handle requests sent to us
             llSay(DEBUG_CHANNEL,"Request received for REMOTE_DATA_REQUEST " + (string)channel + " " +
                (string)message_id + " " + (string)sender + " " + (string)ival + " " + (string)sval);
            llRemoteDataReply(channel,NULL_KEY,"I got it",2008);
            llSetAlpha(1,ALL_SIDES);    
        }
    }
}

 i also get an strange error which looks like this:

Channel opened for REMOTE_DATA_CHANNELa1e00ed6-94b1-116d-d213-17f692da6108 00000000-0000-0000-0000-000000000000  0

 

i dont know what this means. would be great if someone can help me.

thanks!

best

morgen

Link to comment
Share on other sites

I haven't looked in detail, but I suspect you may be encountering a known bug in touch_start() events.  Try changing that to a touch_end() handler and see if it helps.

The message you mention as an error seems to be expected output of the remote_data() event handler -- it's llSay()ing that to DEBUG_CHANNEL, so it will appear as an error.

EDIT: Oh, wait.  There's nothing in that receiving state that would return to the default state, except a reset on rez.  Not sure what this is trying to do, but it's not going to respond to any touches from within a state that has no touch-related handler.

Link to comment
Share on other sites

There is no touch event in the receiving state. If the script switches from default state to receiving state the touch_start event in default state will not be used anymore. If there is no touch event SL reject touches.

You also have the line

llRemoveInventory(llGetScriptName());

If this line gets executed the script will delete itself. If that happens a touch is not possible anymore.

For debug output try to use llOwnerSay and not a say to the debug channel.

Because XML-RPC is error prone HTTP-in may be an alternative
http://wiki.secondlife.com/wiki/LSL_HTTP_server

  • Like 1
Link to comment
Share on other sites

  • 10 years later...
You are about to reply to a thread that has been inactive for 921 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...