Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How Do I Have Many List and Change the List name?

Mickeywishes Au
Registered User
Join date: 7 May 2006
Posts: 16
04-11-2007 12:42
Hello and Thank-you to everyone ahead of time.

Please bear with me I will try to explain the best I can for what I am trying to do.

I have an Object that makes a list and adds to it when triggered. I want to know if I can change the name of the list. Like this:

I name the list:
list addnametolist;

Can I in the script make the same list a different name like:
Taking the Name of the object itself and replacing that name as the name of the list-
addnametolist=llGetObjectName();

Or JUst nameing the list in the script:
list llGetObjectName();

I believe this will only start a list with the name llGetObjectName(), not the object name or get an error.

Is there another way to change a name of a list or start a new list with the name of the object itself??

I want to be able to change name or start a new named list within the Script itself not as a defined global list.

Any way possible??

Thank you again very much.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
04-11-2007 12:46
If I am understanding you, nope, you can't do that.

It might help to know what you are really trying to accomplish, as there may be some other approach we can come up with.

Rj
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
04-11-2007 13:06
The "name" of a list (or any variable) is really only of relevance to the coder (or anyone reading the source code), so that you can easily identify which variable you're reading from or writing to. Once compiled, a variable doesn't have a name, as such, just an identifier, essentially "global integer #1", "local list #4", etc., but not spelled out like this, just in "machine language".


From: Mickeywishes Au
addnametolist=llGetObjectName();
If anything, this would just create a one-element list, containing a string with the return value of llGetObjectName(). But more likely it will return a type mismach error, since, though you can use concatenation operators to add a string to a list, even an empty one, you can't literally assign a string to a list variable.


From: someone
Or JUst nameing the list in the script:
list llGetObjectName();
This will probably return a "Name previously declared within scope" error, since llGetObjectName is already the name of an existing function. Even if it wasn't, placing parenthesis after the name means you'd be declaring a function which returns a list, not a variable.


From: someone
I want to be able to change name or start a new named list within the Script itself not as a defined global list.
If you want a list to be persistent beyond it's local scope, it will have to be declared as a global list variable. Otherwise, you can just declare it as a local variable.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 13:08
Variables are symbolic names used to allow us humans to keep track of script memory. Once declared they are fixed (at least in LSL) when the compiler turns them into byte code.

My question, like RJ's, is why would you want to rename a variable? It gains no additional functionality if you call it CurrentList or zx1234d.
Mickeywishes Au
Registered User
Join date: 7 May 2006
Posts: 16
04-11-2007 13:53
Thank you for the replies, I figured that this was the case.

I am working on another system to do what I am trying to accomplish.

It would have been easier if I could make the list the name of my object , so that is why I asked if it was possible but I will solve the problem another way.

OK here is what I am doing, Making Objects that you pay. When others say they like you it keeps track of them in a list. They will aslo have an object making its own like list when picked. Then if 2 people like each other they will each be sent a message that they like one another.

And again thank you for the help. :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 14:07
From: Mickeywishes Au
Thank you for the replies, I figured that this was the case.

I am working on another system to do what I am trying to accomplish.

It would have been easier if I could make the list the name of my object , so that is why I asked if it was possible but I will solve the problem another way.

OK here is what I am doing, Making Objects that you pay. When others say they like you it keeps track of them in a list. They will aslo have an object making its own like list when picked. Then if 2 people like each other they will each be sent a message that they like one another.

And again thank you for the help. :)


I cant see where the ability to rename a variable will have any relevance in what you are trying to achieve. All you are talking about doing is tracking avatar names (or keys) in lists. You just need a master list which contains one element per avatar. The element position within this master list will directly tie up with a child list tracking the people who like that person. Given script memory limitations you may be better served to put the child lists in child scripts which would also make the system more scaleable. If you want it to match your thought processes better then put each child script in its own prim and have them communicate via messages (linked or spoken). That way you can name the object and think of the whole thing in terms of that object name.

In fact the more I think about it the more I think the seperate prims approach would work.
Each prim would be renamed after its likeable avatar and then when liked would speak on a common channel saying who they liked. Any other objects within range would hear the likes message and if they found their own name in it take appropriate action.
Mickeywishes Au
Registered User
Join date: 7 May 2006
Posts: 16
04-11-2007 14:23
From: Newgate Ludd
I cant see where the ability to rename a variable will have any relevance in what you are trying to achieve. All you are talking about doing is tracking avatar names (or keys) in lists. You just need a master list which contains one element per avatar. The element position within this master list will directly tie up with a child list tracking the people who like that person. Given script memory limitations you may be better served to put the child lists in child scripts which would also make the system more scaleable. If you want it to match your thought processes better then put each child script in its own prim and have them communicate via messages (linked or spoken). That way you can name the object and think of the whole thing in terms of that object name.

In fact the more I think about it the more I think the seperate prims approach would work.
Each prim would be renamed after its likeable avatar and then when liked would speak on a common channel saying who they liked. Any other objects within range would hear the likes message and if they found their own name in it take appropriate action.



Thats what I am doing right now, already have the master lists for each and are communicationg to separate prim. :)

Thank you again, was just racking my brain for other ways to do it.:)