Jump to content

easy way to apply a script to the whole linkset?


You are about to reply to a thread that has been inactive for 2167 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

14 hours ago, tabletopfreak Toocool said:

in my other thread and cat face had nothing to offer but

 

1 hour ago, tabletopfreak Toocool said:

other than cat face attempting

 

1 hour ago, tabletopfreak Toocool said:

it was how caty, cat face was trying

 

I see nothing in her posts that is bad enough to warrent you being rude and calling her names.

 

Edited by LittleMe Jewell
  • Like 2
  • Sad 1
Link to comment
Share on other sites

50 minutes ago, LittleMe Jewell said:

I see nothing in her posts that is bad enough to warrent you being rude and calling her names.

Oh it was in another thread... I told him something is a self explaing variable.... he felt insulted, see yourself: I was very misbehaving there, LOL:

 

Edited by Fionalein
Link to comment
Share on other sites

What the heck is wrong with you guys being so petty about previous threads? Grow up and just focus on the task at hand.

I don't care who started it, it's so fricking frustrating having to shift through this stuff. Just let it go already and go sit in your own corners.

Here's a script I wrote in about 10 minutes, I've tested it and it should work. (See edit.)
Drop the script in and then the script you want to share to the whole object.
The script will delete itself and the script you put into the object, but not the ones it sent to every other prim.

string scriptToSend;
integer alreadySent;

default
{
    changed(integer change)
    {
        if(change & CHANGED_INVENTORY && alreadySent == FALSE)
        {
            integer contentScriptCount = llGetInventoryNumber(INVENTORY_SCRIPT);
            while(contentScriptCount--)
            {
                if(llGetInventoryName(INVENTORY_SCRIPT, contentScriptCount) != llGetScriptName())
                    scriptToSend = llGetInventoryName(INVENTORY_SCRIPT, contentScriptCount);
            }
            
            if(scriptToSend == "") return; // Stop and do nothing if a script isn't found.
            
            llOwnerSay("Starting..");
            integer objectPrimCount = llGetNumberOfPrims();
            while(objectPrimCount)
            {
                llGiveInventory(llGetLinkKey(objectPrimCount--), scriptToSend);
            }
            
            alreadySent = TRUE;
            llOwnerSay("Finished!");
            llRemoveInventory(scriptToSend);
            llRemoveInventory(llGetScriptName());
        }
    }
}

Edit; Right, the "arrives-disabled" thing. You can recompile all scripts in the object by selecting the tree (or multiple trees!), and going to Build > Scripts > Recompile Scripts (Mono). It'll open a little window showing the progress of the process, you don't have to do anything but wait.

Pro-tip: You can click on the top of the little sub-menu that has the Recompile Scripts button on it to pin it on your screen, that way you don't have to open it every time you click on it.

567618f994.png

Edited by Wulfie Reanimator
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Fionalein said:

Oh it was in another thread... I told him something is a self explaing variable.... he felt insulted, see yourself: I was very misbehaving there, LOL:

 

I had already read the other thread before I made my comment and I still think you said nothing that deserved a personal insult. 

  • Like 1
Link to comment
Share on other sites

7 hours ago, Wulfie Reanimator said:

@LittleMe Jewell: No offense but please do not continue with this, it's not relevant to the thread.

Please allow us to differ in opinion, the thread starter stared it with an indirect insult in my direction, so I won't go away and suffer this behaviour to continue. The way he decided to post his question is relevant to forum manners.

Edited by Fionalein
  • Like 1
Link to comment
Share on other sites

  • Administrators

Hey folks!

Just a quick reminder, please try and remain on topic and keep it civil when posting on the forums. If you have issues with another Resident we ask that you either take it to PMs (or any other appropriate channels) or drop the matter entirely, as it will only contribute to derailing the thread from the intended topic. 

 

Otherwise I'll have to break out my secret weapon...

 

Image result for get along shirt

 

Carry on!

  • Like 2
  • Thanks 1
  • Haha 5
Link to comment
Share on other sites

On 4/20/2018 at 8:31 PM, Wulfie Reanimator said:

What the heck is wrong with you guys being so petty about previous threads? Grow up and just focus on the task at hand.

I don't care who started it, it's so fricking frustrating having to shift through this stuff. Just let it go already and go sit in your own corners.

Here's a script I wrote in about 10 minutes, I've tested it and it should work. (See edit.)
Drop the script in and then the script you want to share to the whole object.
The script will delete itself and the script you put into the object, but not the ones it sent to every other prim.


string scriptToSend;
integer alreadySent;

default
{
    changed(integer change)
    {
        if(change & CHANGED_INVENTORY && alreadySent == FALSE)
        {
            integer contentScriptCount = llGetInventoryNumber(INVENTORY_SCRIPT);
            while(contentScriptCount--)
            {
                if(llGetInventoryName(INVENTORY_SCRIPT, contentScriptCount) != llGetScriptName())
                    scriptToSend = llGetInventoryName(INVENTORY_SCRIPT, contentScriptCount);
            }
            
            if(scriptToSend == "") return; // Stop and do nothing if a script isn't found.
            
            llOwnerSay("Starting..");
            integer objectPrimCount = llGetNumberOfPrims();
            while(objectPrimCount)
            {
                llGiveInventory(llGetLinkKey(objectPrimCount--), scriptToSend);
            }
            
            alreadySent = TRUE;
            llOwnerSay("Finished!");
            llRemoveInventory(scriptToSend);
            llRemoveInventory(llGetScriptName());
        }
    }
}

Edit; Right, the "arrives-disabled" thing. You can recompile all scripts in the object by selecting the tree (or multiple trees!), and going to Build > Scripts > Recompile Scripts (Mono). It'll open a little window showing the progress of the process, you don't have to do anything but wait.

Pro-tip: You can click on the top of the little sub-menu that has the Recompile Scripts button on it to pin it on your screen, that way you don't have to open it every time you click on it.

567618f994.png

PERFECTION , thank you for helping me and clearly explaining how to use the script ,let me look you up in word to tip you

Link to comment
Share on other sites

  • 2 weeks later...
On 4/20/2018 at 2:55 AM, Rolig Loon said:

Hi, again. B|   Ruthven has shown you the way to handle one tree.  The way to handle 50+ trees (assuming that they are identical) is to script one tree and copy it 50+ times.  That's a lot more efficient than loading scripts into 50+ trees.

There's no way to script 50+ trees at once.  With a little bit of planning, though, you could change the leaf texture on every single tree with one command.  You would need to write your basic tree script to listen for a command from a master script that sends it the UUID of a new texture and then substitutes the new one for whatever was there before.  It would mean thinking through the logic carefully, but wouldn't actually be all that hard.  Once you had all the trees scripted, then you could change the entire forest from spring leaves to summer ones or moth-eaten ones or fanciful fairyland ones with the touch of a button on your master scripted object.  Might be kind of fun.

An even better way that doesn't make the region beg for mercy would be to use a root prim and a single script driving every single tree's animation as a single, large, linkset.

Link to comment
Share on other sites

Within the distance and L. I. limits on linksets that's good advice, although it will make little or no difference to region performance.  In the O.P.'s case, where he has trees across a whole region, it's not possible to put them all in the same linkset, but he could certainly create a few local ones, possibly reducing L.I. in the bargain.  The only real downside to having one script in the root control the textures on a large number of child prims is that when that one script fails, the entire forest goes down together -- a rather small worry compared to the relative efficiency of having to write and install only one script.

  • Like 1
Link to comment
Share on other sites

6 hours ago, Rolig Loon said:

he could certainly create a few local ones, possibly reducing L.I. in the bargain. 

But only if the existing linksets aren't taking advantage of "rounding down" fractional L.I. in the same category of weight. Were it not for my overwhelming tendency to sloth, I'd write a script that scanned the region for opportunities to link together objects with LIs driven by complementary weight categories -- an obsessive hobby for me to do manually every time I rez a new item.

I still think llRemoteLoadScriptPin is underutilized for this "seasonal foliage" kind of thing. It's a lot of overhead when it runs, installling all those scripts as if each tree has just arrived in the sim, but this happens very infrequently, and otherwise that whole interval is spent with all those scripts idly taking up scheduler slots and memory. (But of course as long as there's plenty of memory and the simulation frame has time to spare it won't matter at all.)

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2167 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...