For llSetLinkPrimitiveParams()
or it's Fast
counterpart, we simply need a value that is not currently a link number. But being future proof is nice so we try to choose one that will never be a link number. To be safe from future expansion of linkset limitations we can probably choose the highest 32 bit signed integer, 2147483647 (or 0x7FFFFFFF), and lucky us, there is even a constant for it in LSL:
llSetLinkPrimitiveParams( DEBUG-CHANNEL, [ ... ] );
But there is no double guessing Lindens. It was given that constant because the chat channel space was filling up fast and nobody had used it for existing content. It could eventually be employed for something else in link numbers too! So as an experiment in second dystopia I looked at using 0
because the root linknumber changes to 1
when linked at all. Yet that fails when the scripted prim could be unlinked. We need a variable that gives 0
when linked but 1
when unlinked;
llSetLinkPrimitiveParams( prim_count==1, [ ... ] );
If you have a function for counting your links anyway then using this will evaluate correctly both ways, if the count has not changed since. Unlinking will not always run the changed event before the prim flies off to the zero corner! So here is an alternative to DEBUG-CHANNEL
that gets the current safe disposal value regardless of linkset, attachment, or seating:
llSetLinkPrimitiveParams( !( ( llGetObjectPrimCount( llGetKey() ) > 1 ) || ( llGetNumberOfPrims() > 1 ) ), [ ... ] );
Of course it's worth noting, if you only intend to use a dummy value there because all your parameters will declare links with PRIM-LINK-TARGET
, then this is all without cause; That first link number will be discarded by the next link declaration anyway.