Tweenster/Auto Alpha: Difference between revisions
Jump to navigation
Jump to search
(Created page with "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!...") |
No edit summary |
||
Line 3: | Line 3: | ||
With Tweenster v3, Auto Alpha is really simple to use! | With Tweenster v3, Auto Alpha is really simple to use! | ||
<ol> | |||
<li>First, under "Alpha Cuts" on the Tweenster HUD, click "Clear All".</li> | |||
<li>Next, click the segments to set the alpha segments to suit your garment.</li> | |||
<li>On the Tweenster HUD, click "Options" and then choose "5" for "Output auto alpha code"</li> | |||
<li>In a few seconds, you will see some output like this: | |||
<pre> | <pre> | ||
Line 20: | Line 21: | ||
[06:40] >MM< Tweenster HUD v3: ------------------------------- | [06:40] >MM< Tweenster HUD v3: ------------------------------- | ||
</pre> | </pre> | ||
</li> | |||
<li>Copy the part between the ---- lines, and remove the bit at the front, so it becomes: | |||
<pre> | <pre> | ||
Line 34: | Line 35: | ||
(Please note that this is only an example, your output will be different). | (Please note that this is only an example, your output will be different). | ||
</li> | |||
<li>Next, paste these lines between the "// ------ PASTE CODE BELOW ------" and "// ------ PASTE CODE ABOVE ------" lines in the script, replacing what is there already.</li> | |||
<li>it save, and you're done! Just drop the script into your clothing. You may wish to set perms, but this is up to you.</li> | |||
</ol> | |||
== Script == | == Script == | ||
Line 43: | Line 45: | ||
// | // | ||
// | // | ||
// | // Tweenster Alpha Control API V3 | ||
// | // | ||
// License: Creative Commons Attribution-ShareAlike 4.0 International | // License: Creative Commons Attribution-ShareAlike 4.0 International |
Revision as of 13:44, 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, 1610435638, 255, 0); [06:40] >MM< Tweenster HUD v3: SendAlphas(1, 256, 115, 140); [06:40] >MM< Tweenster HUD v3: SendAlphas(2, 32775, 255, 0); [06:40] >MM< Tweenster HUD v3: SendAlphas(2, 8, 126, 129); [06:40] >MM< Tweenster HUD v3: SendAlphas(2, 16, 63, 192); [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:
SendAlphas(1, 1610435638, 255, 0); SendAlphas(1, 256, 115, 140); SendAlphas(2, 32775, 255, 0); SendAlphas(2, 8, 126, 129); SendAlphas(2, 16, 63, 192); 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, replacing what is there already.
- it 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 (2017) 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 4 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 ------
PrepareAlphas(1, 33377316, 255, 0);
PrepareAlphas(1, 256, 115, 140);
PrepareAlphas(1, 33554432, 24, 231);
PrepareAlphas(2, 8192, 25, 230);
PrepareAlphas(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 = "";
PrepareAlphas(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
}
}
}
}