[sldev] Initial viewer/object communication code

Dale Glass dale at daleglass.net
Sat Jun 23 18:48:24 PDT 2007


I've been working on a general solution to the problem. See the wiki 
for a detailed explanation:

https://wiki.secondlife.com/wiki/LSL_To_Client_Communication

I've been working on the code and have just finished the first draft.

There are two parts to this, the viewer side, and the LSL script side. 
The script side is explained in the wiki. The viewer side works like 
this:

#include "llviewercommunication.h"
const LLString EXT_NAME = "DaleGlass.Echo";
const U32      EXT_VERSION = 1;

// This gets called when the script sends something to our name
void echo(LLString& data, LLViewerCircuit& circuit, void* userdata)
{
	llinfos << "I got: " << data << llendl;
	circuit.sendReply(data);
}

Plugin::Plugin()
{
	// Register callback
	gViewerCommunication->registerExtension( 
		LLViewerExtension(EXT_NAME, EXT_VERSION, echo, NULL,
		"Dale Glass", "Echo extension") );
}

LSL code (connection establishment not shown):
llOwnerSay("$VwrComm$0$DaleGlass.Echo$This will be echoed at me");

The code is in SVN here:
http://svn.daleglass.net/sl/branches/viewercomm/

The patch is here:
http://daleglass.net/viewercomm.patch

Here is the LSL script that tests the above patch:
http://daleglass.net/viewercomm_test.lsl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.secondlife.com/pipermail/sldev/attachments/20070624/83e5d8e6/attachment.pgp


More information about the SLDev mailing list