Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

link_message and lists

Danielz Shackle
Registered User
Join date: 30 Apr 2006
Posts: 100
05-12-2006 00:36
with some of your help i learned how to have my prims send messages with link message. to get more then 3 values, we made a list, and had it undo the list on the receiving prim
It works perfect with single state script in secondary prims(i have object say values to verify they were received) but when i try to seperate the recieving script into seperate states it does not retain the value after the inital state

heres an example of receiving script where it works (my list currently has 11 values, this prim needs to know value 0,9)

integer a;
integer b;

default
{

// Waits for another script to send a link message.
link_message(integer sender, integer num, string msg, key id)
{
list values = llParseString2List(msg, ["+"],[]); //convert string back to list


integer a=llList2Integer(values,0);
integer b=llList2Integer(values,9);
llSay(0, (string)a); //these are just to make sure value received temp...
llSay(0, (string)b); //these are just to make sure value received temp...

this script works and all that follow (ifs and elses) work fine.

but when i make a second state ( i want to loop it after message is recieved with some timers) a,b values 0, they lose their value. is there something im missing that saves or transfers integers saved from list to other states.

i would appreciate any help
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
05-12-2006 00:52
From: Danielz Shackle


integer a;
integer b;

default
{

integer a=llList2Integer(values,0);
integer b=llList2Integer(values,9);



You are defining integer a and b as global variables - then you are defining them again as local variables.

When you assign to a & b - they are local and will therefore not survive a state transition.


change the code thus :
CODE


a=llList2Integer(values,0);
b=llList2Integer(values,9);


Now the global a & b will be set and survive the state change.
Danielz Shackle
Registered User
Join date: 30 Apr 2006
Posts: 100
thank you
05-12-2006 01:36
i will play around with it more but it appears to work now. thank you