Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Memos?

Darkland Fluffy
Registered User
Join date: 20 Jan 2006
Posts: 4
03-27-2006 14:32
I've been trying to write a memo script, and I believe that it's done by writing to lists, and then retrieving data from those lists and printing it (either with llOwnerSay[etc] or in a dialog). I am quite inexperienced with lists.

If at all possible, could someone provide me with a basic script of how this could be done, this will help me to study on it.

I appreciate the help ;)
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-27-2006 18:29
I try, but not tested. I hope it works. :D
:::USAGE:::
Using channel 1 and say something, it is memorized.
If you say, "/1PRINT", they are all numbering and printed by llOwnerSay.
If you say, "/1CLEAR ALL", the data are all deleted.
If you say, "/1CLEAR 3", the third one is deleted.
CODE
list MemoList;

default
{
state_entry()
{
llListen( 1, "", llGetOwner(), "" );
}
listen(integer channel, string name, key id, string message)
{
if(message == "PRINT")
{
integer i;
for(i = 0; i < llGetListLength(MemoList); i++)
{
llOwnerSay("Memo " + (string)(i + 1) + ": " + llList2String(MemoList, i));
}
else if(llGetSubString(message, 0, 4) == "CLEAR")
{
string WHICH = llGetSubString(message, 6, -1);
if(WHICH == "ALL")
{
MemoList = [];
}
else
{
integer THIS = (integer)WHICH - 1;
llDeleteSubList(MemoList, THIS, THIS);
}
}
else
{
MemoList += [message];
}
}
}


[EDIT]Thank you Feynt. I corrected it. ;)
_____________________
:) Seagel Neville :)
Feynt Mistral
Registered User
Join date: 24 Sep 2005
Posts: 551
03-27-2006 20:13
MeomoList = []; eh? >;)

What Seagel typed is largely correct, except for a few typos (most glaringly is the i > llGetListLength in the for loop, when it should be i < llGetListLength). Keep in mind though that logging out or detatching your memo-recorder will also wipe all of your notes.

For permanent storage of strings, you should investigate llSetObjectName, llSetObjectDesc, and llSetTexture. I'm not sure of llSetTexture's string limits, but llSetObjectName has a limit of 63 characters and llSetObjectDesc has a maximum of 127 characters. Permanent storage of variables (strings in particular, though vector and rotation values also apply) is really the only excuse for unnecessarily primmy objects. So don't be afraid of making a 20 prim note pad that your avatar holds in his hands, even if 17 of them represent sheets of paper. >D
_____________________
I dream of a better tomorrow in SL!
You should too. Visit, vote, voice opinions.
Support CSG! Tell LL how much it would mean to subtract one prim from another!
Prim Animation! Stop by and say something about it, show your support!
Darkland Fluffy
Registered User
Join date: 20 Jan 2006
Posts: 4
03-28-2006 07:42
Thanks a lot. ;)