Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Getting more than one value from sval (XML-RPC)

Thorne Kaiser
Nice Guy
Join date: 29 Nov 2005
Posts: 132
03-09-2006 11:48
I know how to pass the string in PHP or ASP to SL using XML-RPC, but in the script in SL, how do I breal sval up so that I can use it for 2 different pieces of data?

For example if I am passing this:

Birthday Event,Monday

I want to have
string dataEvent = ???? someway to get that first value from sval
string dataWeekday = ???? someway to get that second value from sval

Then I can use it later:
llWhisper(0, "Event: " + dataEvent + " will be held on " + dataWeekday + "!!!";);

CODE
    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 +"\"");
state go; // start handling requests
} else DEBUG(["Unexpected event type", type, channel, message_id, sender, ival, sval]);
}


Any ideas or solutions for this?
Sky Honey
Coder
Join date: 16 May 2005
Posts: 105
03-09-2006 13:04
The simplest way is llCSV2List.
CODE

list parts = llCSV2List(sval);
llWhisper(0, "Event: " + llList2String(parts,0) + " will be held on " + llList2String(parts,1) + "!!!");

If the data might contain a comma, pick another separator and use llParseString2List instead.
_____________________