Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
11-20-2005 07:18
I'm just now getting to working with lists in SL and I'm a bit confused with a good way to compare and update a list. right now I keep running into stack-heap collision errors because I'm doing something wrong and I was hoping someone could shed some light on my errors.
what I'm trying to accomplish is an actively scanning radar that autoupdates a list of targets that you can cycle through. I want it so that on the 1st scan it will generate a "master" list of targets in the scan range, and then on all subsequent scans it will get a list of targets and compare them to the master list. if a name is found that's not on the master list it will add the name to the master list, and if a name on the master list is not found on an "update scan" it will remove that name from the master list. right now all I'm seeming to do is double up every name that's on the list, causing the stack-heap collision thingy.
|
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
|
11-20-2005 07:35
Here is one way to see if something is not in a list and then add it. event(key newKey) { if (llListFindList(listOfKeys, [testKey]) == -1) { //Add new key to list since it's not found listofKeys += newKey; } }
However, in you question, wouldn't simply replacing the master list with the new list do what you want?
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
11-20-2005 09:28
From: Hank Ramos However, in you question, wouldn't simply replacing the master list with the new list do what you want?
I tried doing that, but because of the way my combat sim relies on weapons communicating damage with each other to which targets and where the damage has taken place, it results in homing missiles losing track of their targets and anti-missile systems failing almost entirely if the target goes out of range of the person scanning it while munitions are already on their way.
|