Jump to content

Removing an element from a list


SEMaster Aftermath
 Share

You are about to reply to a thread that has been inactive for 346 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello everyone, I am working on a creating a waiting list. I currently have the ability for a person to add their name to the list by clicking on the object. However, I would also like to (as the object owner) remove a name from the list if that person is no longer interested in being on the list. I attempted the ListItemDelete function, but can not get it to work.

I was hoping it would be as simple as doing the listname -= personname, but I guess lsl doesn't recognize -= like it does the +=.

Any help would be appreciated, thank you.

Link to comment
Share on other sites

4 minutes ago, SEMaster Aftermath said:

I attempted the ListItemDelete function, but can not get it to work.

To get that specific custom function to work, you must copypaste it at the top of your script (before any state/event) before you can use it in your own code.

If you want to use the built-in function llDeleteSubList, you just have to remember to assign the result of the function to something.

  • Thanks 1
Link to comment
Share on other sites

When a person wants to be removed from the list, you'll need to loop through the list to find the name (or UUID, or whatever marker you are using as an ID).  llListFindList is useful for that purpose.  Once you've found it, you can use  llDeleteSubList to get rid of it.  There are other ways (for example, you could use JSON and its LSL functions instead of using lists) , but that's often the easiest.

  • Thanks 1
Link to comment
Share on other sites

33 minutes ago, SEMaster Aftermath said:

.I need to use the entry number on the list, or can I use the person's name?

you need the entry # in the list; llListFindList() can help you find the entry number if you know exactly the thing in the list you're trying to delete.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 346 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...