Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

listen-> xml-rpc

ugly Misfit
Registered User
Join date: 1 Jun 2006
Posts: 1
06-20-2006 21:26
i an trying to get listen data into a xml-rpc link the script i have been working on is as follows:

// XML-RPC example

key gChannel; // my llRemoteData channel
key requestid;
string waitingdata;

DEBUG(list out) { // output debug info
// llSay(0, llList2CSV(out));
}

default { // initialize XML-RPC
state_entry() {
waitingdata="temp";
llListen(0,"",NULL_KEY,"";);
llOpenRemoteDataChannel(); // create an XML-RPC channel

// this will raise remote_data event REMOTE_DATA_CHANNEL when created
}

listen(integer channel, string name, key id, string message)
{
llSay(0,"i hear something";);
// waitingdata=(string)message;
}

remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) {
if (type == REMOTE_DATA_CHANNEL) { // channel created
DEBUG(["Channel opened", "REMOTE_DATA_CHANNEL", channel, message_id, sender, ival, sval]);
gChannel = channel;
llSay(0, "Ready to receive requests on channel \"" + (string)channel +"\"";);
requestid = llHTTPRequest("http://woot.com/woot.php?channel="+ (string)channel,[HTTP_METHOD,"GET"],"";);
state go; // start handling requests
} else DEBUG(["Unexpected event type", type, channel, message_id, sender, ival, sval]);
}
}

state go { // handle requests
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
DEBUG(["Request received", "REMOTE_DATA_REQUEST", channel, message_id, sender, ival, sval]);
// handle request IMPORTANT: a reply MUST always be sent
//this prints the reply in raw
if (waitingdata == "temp";) {
llSay(0,"woot";);
llSay(0,(string)waitingdata);}
llRemoteDataReply(channel, message_id, "", 0);
//llRemoteDataReply(channel, message_id, waitingdata, 0);

} else DEBUG(["Unexpected event type:", type, channel, message_id, sender, ival,sval]);
}



state_exit() {
llCloseRemoteDataChannel(gChannel); // clean up when you no longer want to handle requests
}

http_response(key request_id, integer status, list metadata, string body)
{

}


}

it just keeps ignoring the listen event handler what can i do?

ugly misfit
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
06-21-2006 02:04
That is because the listener and handler are in state default, and you are jumping into state go as soon as the channel is open, where there is no listener.