Friday, February 19, 2016

The Mesmerizer as an outfit manager

It's quite easy to set up the Mesmerizer so that it operates as a simple outfit manager, to let you change your sub's entire outfit with a single command.

For the sake of simplicity, we'll assume that the sub has three outfits, and you want to be able to switch them into any of these outfits at will.   The simplest way to do this is to create an "Outfits" folder in the #RLV folder, and put each of the three outfits into its own folder within "/Outfits".  Recall that the Mesmerizer uses "/" as a separator between folders in a path from the #RLV folder, and that a leading "/" means that the path starts at the #RLV folder itself.  We'll assume that the outfits are imaginatively named "Outfit 1", "Outfit 2" and "Outfit 3", so we'll put them in "/Outfits/Outfit 1", "/Outfits/Outfit 2" and "/Outfits/Outfit 3".  We'll further assume that, at the start, the sub is wearing "Outfit 1".

The goal is to create triggers that will make the sub change into one of the other outfits.  For example, we want to define a trigger "wear outfit 2" that will cause them to do exactly that.  As a first cut at a solution, you might define the trigger action to be something like wearreplaceall "/Outfits/Outfit 2".  We use a replace-style wear so that the new outfit will replace the old one, and an all-style wear so that if there are sub-folders inside the "Outfit 2" folder, then the sub will wear them too.

The problem with this is that wearreplace doesn't replace entire outfits - it replaces individual clothing items.  So if Outfit 1 (the one that the sub is initially wearing) includes something worn on, say the left lower leg attachment point, and so does Outfit 2, then the correct thing will happen - the new left lower leg attachment from Outfit 2 will replace the old one from Outfit 1.  However, if Outfit 2 didn't include anything on the left lower leg, then there would be nothing to "knock off" the attachment from Outfit 1, so the sub would end up with a mixture - all of Outfit 2, plus any bits of Outfit 1 that don't have corresponding items in Outfits 2.

What we really want to do is have the trigger-rule first take off Outfit 1 and then put on Outfit 2 - something like this: detachall "/Outfits/Outfit 1" wearoverall "/Outfits/Outfit 2".  Note the use here of wearoverall (as opposed to wearreplaceall).   This allows Outfit 2 to contain things that might want to be worn at the same point as some object that's really part of the sub's base avatar, rather than a specific outfit.  For example, the sub's hair might not be included in each outfit, but Outfit 2 might include something else worn on the skull - wearoverall allows the new object to be added without knocking the sub's hair off.

This almost works, but what we've actually defined is a trigger that will switch from Outfit 1 to Outfit 2.  It won't work if the sub happened to be wearing Outfit 3.  What we want is to detach anything that's part of any of the outfits before putting on the one we want.  Doing the detachall at the /Outfits level will do that, and the complete trigger definition is:

wear outfit 2 = detachall "/Outfits" wearoverall "/Outfits/Outfit 2" 

Similarly:

wear outfit 1 = detachall "/Outfits" wearoverall "/Outfits/Outfit 1"
wear outfit 3 = detachall "/Outfits" wearoverall "/Outfits/Outfit 3"

In a future version of the Mesmerizer, I may support parameterized triggers that would allow these three triggers to be specified as a single rule, but I think this is the best you can do today.



No comments:

Post a Comment