• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: SVC-105
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Unassigned
Reporter: Argent Stonecutter
Votes: 18
Watchers: 10
Operations

If you were logged in you would be able to see more operations.
2. Second Life Service - SVC

Script control for link sets (linked prims).

Created: 11/Apr/07 05:13 AM   Updated: 17/Oct/09 02:00 PM
Return to search
Component/s: Scripts
Affects Version/s: None
Fix Version/s: None

Issue Links:
Duplicate
 
Relates
 


 Description  « Hide
Every new ll*Link* call (like llSetLinkPrimitiveParams) adds more complexity to the system. Some general technique to extend script range to linked prims would allow builders to massively reduce the number of running scripts in objecst without creating dozens of new special case calls.
  • llSetLinkScriptState(integer link, string script_name, integer running);

Sets the state of the named script in the target link (or links) running or not running.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Lex Neva added a comment - 11/Apr/07 09:19 AM
This kind of thing is fraught with complications. What if the child prim in question is no-modify? Normally you wouldn't be able to add a script, and therefore you wouldn't be able to modify the item using a script. This could possibly let you get around that. For that matter, llSetLinkPrimitiveParams might too. Huh. I think I'll go check that.

Lex Neva added a comment - 11/Apr/07 09:25 AM
Nevermind! Looks like you can't actually have a link set with one prim modifiable and one not.

Strife Onizuka added a comment - 11/Apr/07 01:17 PM
omg this would so complicate LSL. Every set & get function would need to be overhauled.

Besides the required work on most functions, I don't see a good reason why this shouldn't be implemented. Sure it will complicate scripting but I don't see that as a reason not to implement it. It would complicate debugging for new users.

Couple ways to implement this:
A new register in the LSL header that on event entry is set to LINK_THIS and when link numbers changed would become problematic.
OR
A UUID (in binary form) in the LSL header, and have it contain the prim it's acting on. When a link is added or removed from the set (not including avatars) these would all have to be validated.


Strife Onizuka added a comment - 11/Apr/07 01:18 PM
To ease in debugging there should be a llGetEffectiveLinkNumber as well.

Argent Stonecutter added a comment - 11/Apr/07 10:18 PM
Strife: have you actually seen the server code? Because it seems unlikely to me that the internal LSL functions could be implemented at all without parameters referencing the script and the prim the script is contained in, and these parameters would simply be set to the effective link information. The llSetEffectiveLinkNumber call would save and update the existing data, and the validation of the parameters would take place in that call.

Certainly llSetLinkScriptState() would be an easier call to implement, but the complexity of llSetEffectiveLinkNumber should not be so great as you're anticipating.


Argent Stonecutter added a comment - 07/Jun/07 11:07 AM
llSetLinkPrimitiveParams() seems to cover MOST of the cases, but not all.

Probably enough to make llSetEffectiveLinkNumber overkill.

But there's still a need for something equivalent to llSetLinkScriptState().


Haravikk Mistral added a comment - 09/Jun/07 06:39 AM
As I posted in SVC-287 I would like the llSetLinkScriptState() part of this suggestion, but I'm unsure about others. Being able to toggle on/off linked scripts would be extremely useful for avatars and so-on which may use scripts for effects and things which otherwise can't easily be done with a single main script, but which spend much of their time idle. This way we could just toggle on/off unused scripts.

Argent Stonecutter added a comment - 08/Jul/07 04:28 PM
llSetLinkScriptState() is important enough and seems to have universal support in the comments, I'm taking the more powerful call out of the proposal... leaving it here for reference:
  • llSetEffectiveLinkNumber(integer link);

Sets the "effective" link number of the curent script for the remainder of the current event. After this call, all LSL functions that effect the current link effect the link provided. If link references multiple prims, then calls to *get( link information will either fail with an error or return the link information for the actual link the script is in.

The "effective link" would revert to the curent link at the end of the event, or if it's called again with LINK_THIS as a parameter.


Kirrineth Dragonash added a comment - 02/Feb/08 09:06 AM
I'm building a HUD and I could really, really use llSetLinkScriptState() right now, as it's impossible to call llSetText() on a linked item. The only alternative I have is to add 50 scripts that all have to be running, all the time, just waiting for a linked message to set the text. What I really need is llSetLinkText(), but, failing that, llSetLinkScriptState() would allow me to only turn those scripts on as and when I needed them.

Argent Stonecutter added a comment - 25/Feb/08 08:49 AM
Here are the functions that I have wanted to apply to linked prims:

llSetLinkText(integer link, string text, integer alpha);
llSetLinkParticleSystem(integer link, list particle_system);
llGetLinkPrimitiveParameters(integer link, list requested_parameters);

Any more that are really used? I think these three cover virtually everything I have to do in little helper scripts in links that aren't already covered by llSetLinkPrimitiveParameters.


Haravikk Mistral added a comment - 25/Feb/08 11:39 AM
Ehm, only one I can think of to add off the top of my head would be:

llSetLinkTextureAnim(integer link, integer flags, integer x_frames, integer y_frames, float start, float length, float rate);

This one would be useful for doing neat things with animated HUDs and such.


Argent Stonecutter added a comment - 25/Feb/08 12:14 PM
Good call, I should have thought of that one.

Lycia Undercroft added a comment - 21/Jul/09 02:59 AM
In regard to these requests, I have noticed a certain number of mod items that are utterly destroyed if they are re-linked. This is undoubtedly caused by having to pre-calculate the link numbers for child prims and the inevitable reshuffle that occurs on re-links. All of the tools here are excellent additions to the language, but at a minimum, being able to name and retrieve that name from a child prim would allow reliable access to your children, and re-linking would no longer be a death sentence for such scripts.

Making this work would require the script to index numbers and names, but that seems preferable to manually calculating the names and the fragility that produces.


Argent Stonecutter added a comment - 21/Jul/09 03:58 AM
You can already retrieve the name from a child prim: llGetLinkName(). Having a maintenance routine that gets run from appropriate events to recalculate the link numbers is pretty routine.

Lycia Undercroft added a comment - 21/Jul/09 09:41 AM
Ahh yes! Pardon my noobishness, I looked for something like that for an hour and couldn't find it on the wiki, Thank you!

I do still support the ideas here though.


BETLOG Hax added a comment - 21/Jul/09 09:43 PM
requesting :
llGetLinkColor(integer link, integer face)
llGetLinkAlphainteger link, integer face)
llGetLinkDesc(integer link, string name)
[without needing to use the fairly cumbersome syntax of llGetObjectDetails and as a logical partner to llGetLinkName()]

llSetLinkDesc(integer link, string name)
llSetLinkName(integer link, string name)
...in fact i'd even settle for this to be added into llSetLinkPrimitiveParams and the much feature-requested llGetLinkPrimitiveParams ... although the 0.2 delay would hinder many of the logical uses.. it'd still be VERY useful.

a common-use example for all of the above would be in HUD buttons, specifically where their color/alpha state could be instantly referenced between multiple scripts/prims without the need for additional state-storing variables and a nightmare of linkmessages.


Cinco Pizzicato added a comment - 17/Oct/09 02:00 PM
I'm voting for this JIRA, but I disagree with the implementation. There are serious design defects in LSL, and just giving a raft of llLinkedThingie commands won't solve that. What has to happen is that the dot operator needs to be expanded, to give objects actual object-orientation.

For instance, if you want to reset a script in child prim 2, you do this:

me.child(2).llResetOtherScript("scripty");

If you want to animate a child prim you do this:

me.child(3).llSetRot(ZERO_ROTATION);

And if you want to keep a reference, you do this:

prim foo = me.child(3);

or you do this:

object_rez(key id)

{ prim theThingIRezzed = llKeyToPrim(id); theThingIRezzed.llSetColor(<0,0,0>, ALL_SIDES); }

And then, given that this model makes sense, scripting is better and more fun and more efficient and probably solves global warming and makes everyone think of cute kittens.