Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

With conflicting scripts in an object, which has priority?

AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
06-29-2007 14:18
If an object contains two independent scripts, both of which have an llSetTarget() but with different vectors, which one takes precedence when "changed(integer change)" occurs or how would you set such a precedence?
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
06-29-2007 14:22
my gut feeling is that they both run, but that the sequence the two calls occur in is out of your control unless you explicitely have them syncronize with eachother using messaging. So the end result would be like calling llSetTarget() twice (the last one will be whats set) in whatever the script engine runs the two scripts in.
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
06-29-2007 14:33
Do scripts run simultaneously? I just assumed they are allocated time slots and presumably a small script would run in one slot. This would suggest that there is some method of choice as to which of the two scripts in the object is processed first.

So if the state in both is triggered by a common incident, by putting an llSleep(0.1) in one, it would gain priority by being the last to set the target?

So the one with priority will change the target for the OBJECT, not the SCRIPT so if the low priority SCRIPT is operating it will be using the target from the high prioirty script even though it conflicts with its target setting.

This would suggest that putting a second script into an object running a no-copy script you could override the original llSetTarget() and substitute a new one in the copy-protected script?????
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
06-29-2007 16:20
From: AnnMarie Otoole
This would suggest that there is some method of choice as to which of the two scripts in the object is processed first.

Unfortunately, that method seems to be "random chance."
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
06-29-2007 18:20
Wrong question. But the answer is not to do it. Remove the conflict. Conflicting scripts are a waste of resources and bad programming.
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
06-29-2007 20:40
I seriously doubt that one line of code that changes a target from a previously set location to a new one is any burden on the system but I will keep a fire extinguisher handy.

If it allows me to re-locate the target previously set by a "no-copy and no-modify script" in an object I own then the approach has merit.

If it is random, it won't work. If the most recent instruction sets the target then it will work so long as I delay the setting time in my script.

But I can see I'll just have to write the code and try it.