"SET a spell" To Save Some Scripts

The number of scripts on our regions is gradually but relentlessly increasing, and that's partly due to the popularity of scripted seating and the growth of scripted features in furniture. That's a problem when regions are having trouble running scripts often enough to keep up with events. One opportunity to reduce script count is when we have multiple copies of identical (modifiable) animated furniture -- a group of bar stools or dining chairs, etc. -- that are arranged in a permanent placement (that is, we may move them as a group, but we won't be rearranging them within the group. Then we can link them all together and use a single complement of animation scripts for the whole group. But the process is a bit involved, so I decided to write down how I made it work with pairs of seats that use AVsitter, the most common animation engine.

Before we start, check the AVpos notecard inside the furniture. First, if that notecard doesn't let you modify it, that's a mistake; No-Mod is not a meaningful setting for a script-readable notecard and you should replace it with a fresh, editable copy using any notecard-dumping utility script (including AVpos-shifter, see below). Second, scan through the top of the notecard, down to the "SITTER 0" line, to make sure it doesn't already contain a "SET" line; if it does, the process to merge seats would be too complicated to explain here.

A handy utility, AVpos-shifter, comes with AVsitter (and is open source as is the rest of the engine), and generates the contents of a new AVpos notecard with whichever link you specify should BECOME the root prim. When the AVpos-shifter script runs, however, that prim must NOT be root and must not contain any active scripts, and here we're going to shift all the positions from the root prim of one item to what is currently the root of another.

So we start by deciding which object should BECOME root; if there are couple animations, choose the one you'd want to do couple stuff, keeping in mind that whichever avatar sits on that target will default to the SITTER 0 role in those couple animations.

Add "#0-0" to that target root prim's DESCRIPTION field.

Temporarily set all the scripts in that target object to "Not Running" (Build > Scripts > Set Scripts to Not Running)

Then we link that target object to the object we're migrating FROM, choosing the "FROM" object last so it becomes temporarily root.

Add the AVpos-shifter script to the temporary root.

Then we click the target object with the scripts we set Not Running. The -shifter script will churn through all the poses, reporting how they should be set when migrated to the new target.

At the end of that step, -shifter will provide a web link with the same information, uncontaminated by local chat noise. We'll open that link in a browser.

Now we'll copy some lines from that browser text into the AVpos notecard in the target prim, setting up for the target prim's scripts to control seating on the other (temporarily root) object. But which ones to copy, and where to put them?

If the items contain couples SYNC animations, we'll want to keep those as already specified in the target AVpos. (There's a more complicated way to have multiple choices of locations for the couples animations; this involves specifying "multiple setups" following the AVsitter documentation.) Instead, we'll focus on making those single avatar POSEs available to the sitter in the non-target seat.

So we open the AVpos script in the target seat, find or create a SITTER 1 section and add the MENU(s), POSEs, pose-specific PROPs, and the pose configuration lines from the SITTER 0 section of the browser text. If there already was a SITTER 1 section, it will already have the couple SYNC animations and their specific corresponding configuration lines (with the {curly braces}) you want to keep, so don't use those from the browser text.

Add the line "SET 0" before the "SITTER 0" line in the notecard. (This and the distinct link descriptions is how AVsitter knows to animate the avatar in the seat they select instead of depending solely on the order in which they sit.)

Save the edited AVpos notecard in the target seat..

Add "#0-1" to the current, temporary root object.

Unlink the target root prim, Set Scripts Not Running in the non-target seat (they'll get removed at the end), Set Scripts Running in the target seat (it may fuss about not having enough prims for each sitter) and relink the object choosing the target last, making it root prim.

If the item did not contain couples animations, you'll need to add another copy of the existing [AV]sitA and -B scripts, which will take the names "[AV]sitA 1" and "[AV]sitB 1".

You may need to Build > Scripts > Reset Scripts in the object if it doesn't automatically reload the AVpos notecard.

Test out the seats with a friend. Once you're confident it's behaving, you can remove all the contents of the non-target seat, finally achieving the goal of reducing the script count.

This process can be generalized to handle more than two seats to save even more scripts.

As long as we're combining identical seats like this we won't need to import additional animations, but AVpos-shifter is used for many other purposes, including combining or migrating animations sets into not-yet-animated objects -- and that can mean packing a large number of inventory items into in-world objects, an operation that often fails. Fortunately Firestorm has a utility to help with this: https://wiki.phoenixviewer.com/fs_zdrop_ztake_mtake (hat-tip: Whirly Fizzle).

Note that linking identical items won't benefit total Land Impact because whatever weighting factor is driving the LI score for one of the items will be the SAME factor driving it for the other; indeed, a slight increase in total LI is very likely. Sometimes items include separate prims only for the purpose of having enough sit targets for all the sitters, and those would be unnecessary when you link multiple copies together, potentially recovering some LI. Or, if you can identify other items with DIFFERENT weighting factors driving their Land Impact, linking those in too might reduce total LI.
Reporter Qie Niangao

No comments:

Post a Comment


Park Plaza Hotel

Park Plaza Hotel
Please visit our Sponsor!

Luxury Living in Bay City

Park Plaza residents enjoy beautiful views, fine dining, and a roof top patio with hot tub; all this near route 66, and within walking distance to Hairy Hippo Fun Land and aquarium. Rates start at 55L a week for studios, and 185L a week for full size apartments. Free furnishings available. Contact Roc Plutonium for more information!