Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scope of variables and link_message event

Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
05-01-2007 08:19
If I declare a global variable for sender_num in a link_message and substitute it for example

integer sndr;

default
{
state_entry()
{
llSay(0,"Hello Avatar";);
}

touch_start(integer total_number)
{
llSay(0,"Touched";);
}

link_message(sndr, integer num,string str, key id)
{
llSay(0,"Message received";);
}
}

I get a compiler syntax error. What am I missing?
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
05-01-2007 08:56
The linkmessage event is a then receives outside values. So you must use the format as listed in the function to receive the values from the event. You can then reassign it to a global variable.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
05-01-2007 09:32
Maybe this is what you want?

CODE

integer sndr;

default
{
state_entry()
{
llSay(0,"Hello Avatar");
}

touch_start(integer total_number)
{
llSay(0,"Touched");
}

link_message(integer sender_num, integer num,string str, key id)
{
sndr = sender_num;
llSay(0,"Message received");
}
}
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
05-01-2007 11:53
I thought that was it. I need to follow the default definition for link_message then reassign within the scope.