morgen Sinatra
-
Posts
2 -
Joined
-
Last visited
Content Type
Forums
Blogs
Knowledge Base
Posts posted by morgen Sinatra
-
-
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
cant touch object anymore after adding xml response script
in LSL Scripting
Posted
hey,
thank you both. now everything works fine. i moved the touch event to the receiving state.