Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Linked Messages

Sensual Thorne
Registered User
Join date: 28 Jul 2008
Posts: 6
08-01-2008 08:08
Hello, all.

I've recently acquired a partnership kit with a well-known SL company. I hesitate to use the name, but given it's sex-related, I think you can probably guess.

There is a script so that my products can be [business]-enabled. The kit said that I need to use a "Linked Messages" script in order to control the various levels of reaction.

My problem, after looking at the LSL wiki, is that I've never done more than fiddle with rotation and particle scripts. I realize I'm going from frying pan to fire, and I don't mind learning the process, but unfortunately even tutorials or forum commentary are written by those far more conversant in this than I (Which boils down to it being a foreign language.)

If any of you know where I can find either:

* A tutorial for "Linked Messages" scripting basically For Dummies,

or

* A place I can get a full perms copy (ideally, a freebie, and I can just mess with what I need to add),

or

* A kind soul who will direct me to a resource that isn't written in geek (sic).

Thanks in advance for your patience and understanding with a novice.

-Sens
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
08-01-2008 11:00
It would probably be overkill to have a full tutorial dedicated to link messaging. Try looking at this example and follow the links to find out more...
http://www.lslwiki.net/lslwiki/wakka.php?wakka=ExampleLinkMessage
_____________________
http://slurl.com/secondlife/Together
Sensual Thorne
Registered User
Join date: 28 Jul 2008
Posts: 6
08-01-2008 11:07
Unfortunately that may as well be written in another language. As stated in my original post, I am not conversant in scripts beyond fiddling with pre-written ones.

I'll try to muddle my way through.

Thank you.
Jenn Yoshikawa
Registered User
Join date: 14 Nov 2007
Posts: 91
re
08-01-2008 15:43
IM me in world I can help you on some of it. I use linked messages a lot for less open listens lol
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
08-02-2008 06:26
Since the linked message example in the Wiki isn't very clear, I've put this little tutorial together, in the hope it helps. These aren't necessarily the best ways of changing link prims' colours and so on, but they do help, I think, to demonstrate how link messages work.

Example 1:

Simple script to change colours on touch:
CODE

// Example 1
integer toggle = 1;
default
{


touch_start(integer total_number)
{
toggle *= -1;
if (toggle < 0)
{
llWhisper(0, "Turning Red");
llSetColor(<1,0,0>, ALL_SIDES);
}
else if (toggle > 0)
{
llWhisper(0, "Turning Green");
llSetColor(<0,1,1>, ALL_SIDES);
}
}
}


Now, put the following script, receiver1, into as many prims as you like and link them up
CODE

//receiver1

integer toggle = 1;
default
{


link_message(integer sender_num, integer num, string str, key id)
{
toggle *= -1;
if (toggle < 0)
{
llWhisper(0, "Turning Red");
llSetColor(<1,0,0>, ALL_SIDES);
}
else if (toggle > 0)
{
llWhisper(0, "Turning Green");
llSetColor(<0,1,1>, ALL_SIDES);
}
}
}



. ..Then put this script, sender1, into another prim.
CODE

//sender1

default
{


touch_start(integer total_number)
{
llMessageLinked(LINK_SET, 0, "Touched.", NULL_KEY);
}
}



Touch that prim first, and then link it to the set of prims containing the receiver script (for this example, we don't want it to be the root prim). Then touch the sender prim and, if things have gone according to plan, all the prims with the receiver script in should toggle between red and green.

What's happening is that touching the sender prim is sending a message (which doesn't actually say anything) to the rest of the linkset (that's what LINK_SET is for). The receiver script receives the message and, in effect, says, "oh.. I've received a message.. when that happens I change the value of toggle.".

In effect, it's made the touch communicate itself to the other prims containing the receiver script.

Example 2

Put this, example2, into a prim, and name the prim something. Touch it, and it should say something to you.
CODE

//example2

key avi;
key mykey;
default
{


touch_start(integer total_number)
{
avi = llDetectedKey(0);
mykey = llGetKey();
llSay(0, llKey2Name (avi) + " touched me, and I am " + llKey2Name(mykey));
}
}


Then put receiver2
CODE

//receiver2

default
{


link_message(integer sender_num, integer num, string avi, key sender)
{

llSay(0, avi + " touched " + llKey2Name(sender));
}
}



and sender2 into two separate prims, give the prim containing sender2 a different name from that of the one containing receiver2, and link the two up.
CODE

//sender2

key avi;
key mykey;
default
{


touch_start(integer total_number)
{
avi = llDetectedKey(0);
mykey = llGetKey();
llMessageLinked(LINK_SET, 0, llKey2Name (avi), mykey);
}
}

Again, make sure the sender isn't the root prim (there's nothing wrong with having the sender in the root prim -- often you will want to -- but for the purposes of these examples, I think having it in a child prim makes it easier to see what's happening).


In this example, the link message has not only told the receiver that someone's touched the sender but also given the receiver some data to use and process.

Hope this is of some use.
Sensual Thorne
Registered User
Join date: 28 Jul 2008
Posts: 6
08-02-2008 08:06
Thank you very much for the detailed response. I'll tinker with those examples and see if I can't build on it to get the results I'm looking for.

Also, I appreciate your use of non-scripting language in your descriptions.

It's like being new all over again with scripting. Like when I first started and someone said to "rez" an object, rather than drop or build. We get so accustomed to our own language, we all sometimes forget not everyone speaks it (yet!)