Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Best way to send a list over llMessageLinked

Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
04-08-2007 11:19
Hello all, maybe its just me (I've been on vacation) but I can't seem to get my lists transfer to other scripts in the same object using llLinkedMessage.


This is how it goes:
I have 6 memory scripts (num 1-6)
I have one main script
I have 6 notecards

Since the one main script will encounter stack heap for 6 note cards full of data, I decided I'd foward the data (on lists) to the memory scripts (soon though, I will have
20 - 50 notecards going through that one script, its something I'm working on).

Steps:
- Initalization, notecards are read one at a time
- Notecard data is transfered to a list (one at a time)
- Then I transfered the data to the mem scripts using lllinkedmessage (I did a llList2CSV)
- The list is erased to conserve space on the main script
- The memory script converts the CVS back into a List (to keep the data in an organized list in the mem script)
- This is repeated for all of them
- When its time to call the data back, I have the memory scripts convert the List back into CVS and send it over linked message to the main script
- The main script converts it into a List and reads it off in chat
- After each completed notecard has been read the data transfered is erased to conserve the little space I have left (Yes, it makes it way easier to have everything flowing through one script)
- Shakes hands with the mem script (one at a time)
- This is repeated until all the data is read off in chat

I don't think it ever got past the 4th to last step, I doesn't even read the information, only the eerie evil silence.
I might do some debug tests, or (trying to avoid this) split the main script up and try an' come up for something to combat the various delays it will cause.
Maybe the scripts were acting up but my coding seemed perfectly logical, from what I observed, everything works fine, it messes up on the LinkedMessage part (the lists)- I tested it without lists and it worked perfectly fine (AKA, entering the data by hand)

Any suggestions would be helpful :D
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
04-08-2007 11:31
I don't transfer whole lists, I message the script holding the list for the information that I need.
Maybe you can do that too.
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr

SL books http://astore.amazon.com/secondlife-sl-20/

Need a beta tester for quality assurance ?
Need a translator for English, French, Spanish ?
Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
04-08-2007 11:32
What I don't get is why store something you have already stored on notecards?

Anyway to fix your problem you could check the remaining heap size and when it's too low stop the flow until everything is processed then start again. It looks like a sync problem to me.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
Obvious question
04-08-2007 11:53
If your memory scripts are doing nothing with the data why bother converting from string back to list in order to just convert back to a string?

Lists have a high overhead compared to strings so you will save more memory by retaining the string format.
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
04-08-2007 12:20
I agree with Newgate and Simil...

...just retain your string format, and then pass only your needed information to your main script via the link-message.

In fact...if I need to look through a data set and pull a specific result out...and I need to have 'memory storage' scripts...I will generally do the data-look-up function within the memory storage script. Essentially, I would have the main script send a link message for what it wants, and have the 'slave script' return a link message of the resultant data.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
04-08-2007 12:31
... or extract directly from the notecards when you need it.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-08-2007 12:40
From: Twisted Pharaoh
... or extract directly from the notecards when you need it.



You're overlooking the fact that it is not always possible to know in advance what data you require from the notecard, i.e. you may not have a line number to look up so would have to read the entire card which is not good practise.

Like Kenn I would tend to organise my data so the memory scripts read their own notecards and then relay information back when requested.
Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
04-08-2007 13:59
You can still have a string buffer and window with it through the notecards a filesystem doesnt do anything else.

Totally random data would almost never happen. Say if it is a list of names you can sort it and then use dichotomy on it. Same for a list or numbers or vectors. I would use memory script for data grabbed in world but for notecards i would look for ways to organize them first.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-08-2007 15:19
From: Twisted Pharaoh
You can still have a string buffer and window with it through the notecards a filesystem doesnt do anything else.

Totally random data would almost never happen. Say if it is a list of names you can sort it and then use dichotomy on it. Same for a list or numbers or vectors. I would use memory script for data grabbed in world but for notecards i would look for ways to organize them first.



I agree totally random data rarely happens, but when writing scripts such that the end user has the option to edit and even extend the data you cannot always use such an approach.
Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
04-08-2007 16:22
That's right. For the message part i would rather use llEMail()/llGetNextEMail() calls. My guess would be that llMessageLinked uses some heap and not llEMail() but I might be wrong on this.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-09-2007 01:57
From: Twisted Pharaoh
That's right. For the message part i would rather use llEMail()/llGetNextEMail() calls. My guess would be that llMessageLinked uses some heap and not llEMail() but I might be wrong on this.


Its my understanding that all of the event's parameters are all created on the heap, i.e. if a listen receives the full 1024 bytes of data and the script receiving it doesnt have 1024 bytes free it will crash.
Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
04-09-2007 03:05
Of course parameters use the heap, the question is where the pending emails are stacked, it might be taken in charge by the serverl.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-09-2007 06:14
From: Twisted Pharaoh
Of course parameters use the heap, the question is where the pending emails are stacked, it might be taken in charge by the serverl.



I think queue events would have to be stored by the server and only parcelled out to the script as it gets the event. If you think each listen message can be upto 1K in size and a queue can be 64 items thats 64K ergo it has to be handled by teh server. Like wise emails can be upto 4K (I think?) so would destroy the scripts memory even quicker.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
04-09-2007 06:41
From: Newgate Ludd
Its my understanding that all of the event's parameters are all created on the heap, i.e. if a listen receives the full 1024 bytes of data and the script receiving it doesnt have 1024 bytes free it will crash.

I think it is worse. My limited understanding is that all objects are passed by value. The parameters to any event are stored on the stack of that event, so copying the parameter to manipulate it (many list functions produce more lists) would place it on another function's stack and the answer might go to a global variable on the heap so there is a doubling/tripling up to get you closer to a stack/heap collision.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-09-2007 11:39
From: ed44 Gupte
I think it is worse. My limited understanding is that all objects are passed by value. The parameters to any event are stored on the stack of that event, so copying the parameter to manipulate it (many list functions produce more lists) would place it on another function's stack and the answer might go to a global variable on the heap so there is a doubling/tripling up to get you closer to a stack/heap collision.


Yes all parameters are passed by value which makes my answers previously posted redundant/obvious when you think about it!
Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
04-09-2007 13:09
From: Newgate Ludd
You're overlooking the fact that it is not always possible to know in advance what data you require from the notecard, i.e. you may not have a line number to look up so would have to read the entire card which is not good practise.

Like Kenn I would tend to organise my data so the memory scripts read their own notecards and then relay information back when requested.


Ah, good ideas, thank you. I will have the memory scripts have their own notecards to read, then have it go into the main script. Beautiful, I can already see it working. And yes, I have too much data and SL goes too slow with reading notecards to let me just continually read from the notecard, and sometimes I need to get data back-to-back (IE. data even milisecond or so) and to read the notecard would be way to slow... to all of you who can't "understand" :confused: .

Anyways, thanks for the ideas people, it should work fine now :D
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-09-2007 14:14
From: Tre Giles
Ah, good ideas, thank you. I will have the memory scripts have their own notecards to read, then have it go into the main script. Beautiful, I can already see it working. And yes, I have too much data and SL goes too slow with reading notecards to let me just continually read from the notecard, and sometimes I need to get data back-to-back (IE. data even milisecond or so) and to read the notecard would be way to slow... to all of you who can't "understand" :confused: .

Anyways, thanks for the ideas people, it should work fine now :D



If you need data down to milli seconds then you're really on hiding to nothing with LSL
Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
04-09-2007 15:02
From: Newgate Ludd
If you need data down to milli seconds then you're really on hiding to nothing with LSL


A little exaggeration there :P

But I got my system to work none-the-less.