Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

link_message example

Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
03-13-2007 14:05
Hi all,

I've been looking over the example here...

I have 2 prims, the master prim does this:

CODE

llMessageLinked(LINK_SET, 0, "config 1", NULL_KEY);


the other prim, is supposed to be listening for it...
context is said to be link_message(integer sender_num, integer num, string str, key id)

the sender number is 1, as it's the root prim, the integer number is 0, the string is "config 1", and the key id is NULL_KEY, so I made a lil script which has this in it:

CODE

link_message(1, 0, "config 1", NULL_KEY)



now, this gives me a context error, what's broke? :S is it the key? I dont really know what they're for...
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-13-2007 14:15
From: Dominguez Brentano
Hi all,

I've been looking over the example here...

I have 2 prims, the master prim does this:

CODE

llMessageLinked(LINK_SET, 0, "config 1", NULL_KEY);


the other prim, is supposed to be listening for it...
context is said to be link_message(integer sender_num, integer num, string str, key id)

the sender number is 1, as it's the root prim, the integer number is 0, the string is "config 1", and the key id is NULL_KEY, so I made a lil script which has this in it:

CODE

link_message(1, 0, "config 1", NULL_KEY)



now, this gives me a context error, what's broke? :S is it the key? I dont really know what they're for...


link_message is the declaration of an event handler so its parameters are variable declarations, you cannot replace them with values.

When your first script calls llMessageLinked the link_message event handler in the second script will be called/actioned and the parameters it will receive will be

sender_num = 1
num = 0
str = "config 1"
id = NULL_KEY

HtH
Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
03-13-2007 14:20
From: Newgate Ludd
parameters are variables ...

sender_num = 1
...




so I missed the = signs out? damn! :)

thanks for your help!

so it needs to look like this:

CODE
 
link_message(integer sender_num = 1, integer num = 0, string str = "config 1", key id = NULL_KEY )


?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
No!
03-13-2007 14:27
From: Dominguez Brentano
so I missed the = signs out? damn! :)

thanks for your help!


NO, you didnt miss the equals signs out.

AS I stated originally, YOU CANNOT replace the parameters with values.
The link_message handler defines the 2 integers, a string and a key as place holders for the externally supplied data sent by the call to llMessageLinked. You have NO control over their initial value and SHOULD be expecting them to hold values for you to process.
Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
03-13-2007 14:31
From: Newgate Ludd
NO, you didnt miss the equals signs out.

AS I stated originally, YOU CANNOT replace the parameters with values.
The link_message handler defines the 2 integers, a string and a key as place holders for the externally supplied data sent by the call to llMessageLinked. You have NO control over their initial value and SHOULD be expecting them to hold values for you to process.



oooh, I see.

I have to process them after I receive them, not test the message in the link_message( ) bit.

hmmm

thanks again


edit: it's aliiiiive! got it working, with if's to test what the variables are etc, thanks for clearing that up for me :)