harayoki
2007年05月10日 23:18
Open(){
llSay(0,"Channel Opening...");
bRunning = TRUE;
string autoResponse = "TRUE";
llMessageLinked(LINK_THIS,0,"harayoki.xmlRpcControl TRUE "+autoResponse,NULL_KEY);
}
Close(){
llSay(0,"Channel Closing...");
bRunning = FALSE;
llMessageLinked(LINK_THIS,0,"harayoki.xmlRpcControl FALSE",NULL_KEY);
}
This function does not appear to actually do anything; remote_data events will still fire if a request is received even after llCloseRemoteDataChannel is called, and it doesn't throw any sort of error even if you pass it a string that's clearly not a key. The only way to actually close an XML-RPC channel appears to be to cause the script to be recompiled.
OnXmlRpcReceive(integer num,string str,key id){
string mes = "";
str = llList2String(MyString2List(str," ",2),1);
mes += "iData:"+(string)num +"\n";
mes += "sData:"+(string)str +"\n";
mes += "messageID:"+(string)id +"\n";
Trace("OnXmlRpcReceive\n"+mes);
if(bBusy){
//SendResponce("Now I'm busy.",0,id);
}else{
//SendResponce("Ok your request is received.",1,id);
SayNews(str,num);
}
}
SendResponce(string mes,integer num,key id){
llMessageLinked(LINK_THIS,num,"harayoki.xmlRpcResponse "+mes,id);
}
OnXmlRpcOpen(key id){
Trace("OnXmlRpcOpen");
Trace("channel:"+(string)id);
channel = id;
SayStatus();
}
OnXmlRpcClose(){
Trace("OnXmlRpcClose");
channel = NULL_KEY;
SayStatus();
}
OnSingleClick(key id,integer count){
SayStatus();
}
OnDoubleClick(key id){
if(id!=owner) return;
if(bRunning){
Close();
}else{
Open();
}
}
SayStatus(){
llSetLinkAlpha(LINK_SET,1.0,ALL_SIDES);
if(channel == NULL_KEY){
llSay(0,"RemoteDataChannel Not Ready");
return;
}
llSay(0,"RemoteDataChannel Ready");
llOwnerSay("channel : "+(string)channel);
}