Tweenster/Auto Alpha: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
[06:40] >MM< Tweenster HUD v3: Your code is between the lines: | [06:40] >MM< Tweenster HUD v3: Your code is between the lines: | ||
[06:40] >MM< Tweenster HUD v3: ------------------------------- | [06:40] >MM< Tweenster HUD v3: ------------------------------- | ||
[06:40] >MM< Tweenster HUD v3: SendAlphas(1, | [06:40] >MM< Tweenster HUD v3: SendAlphas(1, 33377316, 255, 0); | ||
[06:40] >MM< Tweenster HUD v3: SendAlphas(1, 256, 115, 140); | [06:40] >MM< Tweenster HUD v3: SendAlphas(1, 256, 115, 140); | ||
[06:40] >MM< Tweenster HUD v3: SendAlphas( | [06:40] >MM< Tweenster HUD v3: SendAlphas(1, 33554432, 24, 231); | ||
[06:40] >MM< Tweenster HUD v3: SendAlphas(2, 8192, 25, 230); | [06:40] >MM< Tweenster HUD v3: SendAlphas(2, 8192, 25, 230); | ||
[06:40] >MM< Tweenster HUD v3: SendAlphas(2, 16384, 3, 252); | [06:40] >MM< Tweenster HUD v3: SendAlphas(2, 16384, 3, 252); | ||
Line 25: | Line 23: | ||
<pre> | <pre> | ||
SendAlphas(1, | SendAlphas(1, 33377316, 255, 0); | ||
SendAlphas(1, 256, 115, 140); | SendAlphas(1, 256, 115, 140); | ||
SendAlphas( | SendAlphas(1, 33554432, 24, 231); | ||
SendAlphas(2, 8192, 25, 230); | SendAlphas(2, 8192, 25, 230); | ||
SendAlphas(2, 16384, 3, 252); | SendAlphas(2, 16384, 3, 252); |
Latest revision as of 13:54, 15 July 2018
Auto Alpha is a system for creators to automatically set alphas on the Tweenster body when an item of clothing is worn.
With Tweenster v3, Auto Alpha is really simple to use!
- First, under "Alpha Cuts" on the Tweenster HUD, click "Clear All".
- Next, click the segments to set the alpha segments to suit your garment.
- On the Tweenster HUD, click "Options" and then choose "5" for "Output auto alpha code"
- In a few seconds, you will see some output like this:
[06:40] >MM< Tweenster HUD v3: Your code is between the lines: [06:40] >MM< Tweenster HUD v3: ------------------------------- [06:40] >MM< Tweenster HUD v3: SendAlphas(1, 33377316, 255, 0); [06:40] >MM< Tweenster HUD v3: SendAlphas(1, 256, 115, 140); [06:40] >MM< Tweenster HUD v3: SendAlphas(1, 33554432, 24, 231); [06:40] >MM< Tweenster HUD v3: SendAlphas(2, 8192, 25, 230); [06:40] >MM< Tweenster HUD v3: SendAlphas(2, 16384, 3, 252); [06:40] >MM< Tweenster HUD v3: -------------------------------
- Copy the part between the ---- lines, and remove the bit at the front, so it becomes something like:
SendAlphas(1, 33377316, 255, 0); SendAlphas(1, 256, 115, 140); SendAlphas(1, 33554432, 24, 231); SendAlphas(2, 8192, 25, 230); SendAlphas(2, 16384, 3, 252);
(Please note that this is only an example, your output will be different).
- Next, paste these lines between the "// ------ PASTE CODE BELOW ------" and "// ------ PASTE CODE ABOVE ------" lines in the script (it's around line 32), replacing what is there already.
- Hit save, and you're done! Just drop the script into your clothing. You may wish to set perms, but this is up to you.
Script
////////////////////////////////////////////////////////////////////////////////////////
//
//
// Tweenster Alpha Control API V3
//
// License: Creative Commons Attribution-ShareAlike 4.0 International
//
// Copyright (2018) Meshmerized and CasperTech Ltd
//
//
////////////////////////////////////////////////////////////////////////////////////////
//=======================================================================
//
// INSTRUCTIONS
//
//=======================================================================
//
// The V3 Alpha API has been made much easier to use.
//
// Simply set the alphas you want on Tweenster. Then, on the HUD,
// go to OPTIONS and then 5 for "Output Auto Alpha Code".
//
// Then, simply paste the code into the AutoAlpha function below
// (between the { } ).
//
// Example code is provided, just delete the stuff that's there already.
AutoAlpha()
{
// ------ PASTE CODE BELOW ------
SendAlphas(1, 33377316, 255, 0);
SendAlphas(1, 256, 115, 140);
SendAlphas(1, 33554432, 24, 231);
SendAlphas(2, 8192, 25, 230);
SendAlphas(2, 16384, 3, 252);
// ------ PASTE CODE ABOVE ------
}
//=======================================================================
//=======================================================================
//
// Don't modify anything below this line unless you know what you're doing
//
//=======================================================================
integer on = FALSE;
list unsetCommands = [];
list setCommands = [];
string unsetCommand = "";
string setCommand = "";
string passCode = "";
SendAlphas(integer set, integer partMask, integer faceMask, integer alphaMask)
{
setCommands += [llDumpList2String([set, partMask, faceMask, alphaMask], "\n")];
unsetCommands += [llDumpList2String([set, partMask, faceMask, (~alphaMask) &~ 4294967040], "\n")];
}
SendCommand(string command)
{
if (passCode == "")
{
llOwnerSay("AutoAlpha: Warning: Tried to send command without knowing the passcode..");
}
llRegionSayTo(llGetOwner(), 10101, "TWEENSTERV3\n3\n" + llGetObjectName()+"\n" + llSHA1String(passCode + (string)llGetKey()) + "\n" + command);
}
Apply(integer on)
{
if (on)
{
unsetCommands = [];
setCommands = [];
AutoAlpha();
setCommand = llDumpList2String(setCommands, "\n");
unsetCommand = llDumpList2String(unsetCommands, "\n");
llRegionSayTo(llGetOwner(), 10101, "TWEENSTERV3\n2");
}
else
{
SendCommand(unsetCommand);
}
}
default
{
state_entry()
{
//The Tweenster body will talk back to us on port 10102, so this sets
//up a listener
llListen( 10102, "", "", "" );
}
attach(key id)
{
if (id != NULL_KEY)
{
// We wait 5 seconds before applying alphas to give other attachments time to unset theirs
llSleep(5.0);
Apply(TRUE);
}
else if (unsetCommand != "")
{
Apply(FALSE);
}
}
listen(integer channel, string name, key id, string message)
{
//IMPORTANT : Always check that the message has come from the correct owner
if (channel == 10102 && llGetOwnerKey(id) == llGetOwner())
{
list message_list = llParseStringKeepNulls(message, ["\n"], []);
if (llList2String(message_list,0)!="TWEENSTERV3") return;
integer cmd = llList2Integer(message_list,1);
if (cmd == 1)
{
list masks = llParseStringKeepNulls(llList2String(message_list,2), ["|"], []);
// These are no longer used by the Auto Alpha system.
// However, they are available to you to use if you wish.
}
else if (cmd == 2)
{
passCode = llList2String(message_list, 2);
SendCommand(setCommand);
}
if (cmd == 3)
{
//Alphas have been set successfully
}
}
}
}