Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Choosing between objects

Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
08-21-2004 17:56
Ok. I've got a script that causes objects to move around.

Right now, I have the objects moving so that they -should- be moving about in a staggered fashion, first one moves, then the other, and so on. Each move is accompanied by a scan to make sure there are no other objects occupying the destination, and if there are, the script kills the object that is headed to the occupied location.

However, the potential for two objects to reach the same location at precisely the same time bothers me. Especially since an occurance like this, in an absolute worst case scenario (worst case being I've somehow missed a possibility in the script) of the objects remaning in place for a decent length of time spawning replications of themselves across the entire fillable space.

This would be bad.

Now, I'm pretty sure that my liberal tests I've scattered throughout the script will kill off all objects within ten minutes of the script starting, but I'd still like to prevent the possibility of two objects doing their assigned tasks in the same physical space. Since both objects will be containing the same script, a simple Sensor is out of the question, since there's also the chance that both could see the other object, and BOTH could kill themselves off at the same time, especially if they arrive at the location in question at the same time.

So does anyone here have any tips for preventing such from occuring? Or how to have two unconnected identical objects decide between them which should die, and which should not?
_____________________
</sarcasm>
Essence Lumin
.
Join date: 24 Oct 2003
Posts: 806
08-21-2004 18:50
Does Pete Fats do consulting?
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
08-21-2004 18:52
Without connecting them somehow, (probably listen / sensor with distinct names), your only option would be assuming avg(rand-set) == 0.5) and using a random generator to work out if the prim is supposed to die.

THe better solution is however to use llSetObjectName and a sensor.

-Adam
_____________________
Co-Founder / Lead Developer
GigasSecondServer