Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Transfering large amounts of data between scripts via chat

Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-12-2004 07:01
Say you wanted to transfer a huge amount of data between two scripts. Lets say 4k worth...

Instead of using a function like this that breaks it up into little chunks pass it all at once through the object name. i have used this to pass little under 8k.

Don't use:
CODE

sendchat(string msg)
{
integer a;
integer b=llStringLength(msg);
for(a;a<b;a+=255)
llSay(chan,llGetSubString(msg,a,a+254);
}


use this:
CODE

sendchat(string msg)
{
string a=llGetObjectName();
llSetObjectName(msg);
llSay(chan,a);
llSleep(10);
llSetObjectName(a);
}


so in your script just swap the listen message and name it listens. And you can move any amount you want...

CODE

state default
{
state_entry()
{
llListen(chan,"","",object_name_to_listen_to);
}
listen(integer c, string msg, key object_id, string object_name)
{
// your code...
}


EDIT: added a bit of extra code, and changed the topic title to better represent the topic.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
05-12-2004 09:00
Another option, is to use email, you can send 4096 characters[?] between objects - plus the subject.

-Adam
Xylor Baysklef
Scripting Addict
Join date: 4 May 2003
Posts: 109
05-12-2004 17:38
*nod* I used to use this technique as an extra 'channel' for passing data, however there are two problems to this. First, if you are sending data across a sim line, the name is truncated to 63 characters. Second, this functionality will probably be going away soon, since this is actually using what the Lindens consider a 'bug'. (I asked them about this a week or so ago, and it was hinted that this will be 'fixed' soon).

It was a great technique for getting around the 255 character limit, but I wouldn't start using it, since you'd have to go back and change your protocol once it is 'fixed'. =/

Xylor
Ming Chen
Here since 0.4.1!
Join date: 3 Sep 2003
Posts: 524
05-26-2004 14:35
just wait for XML_RPC...just wait...
_____________________