Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A few questions

Asami Omizu
Registered User
Join date: 8 Apr 2009
Posts: 2
01-22-2010 17:04
Okay I am totally confused with looking at everything in the forums for what I am trying to accomplish and the free script I got from Void Singer's page on Wiki. Plus the answer that Void gave me from a private message was a bit to vague for my understanding with scripts. I know enough to get hung with them *giggles*. Also was told if I needed more specific help to post here. What I need to do is modify Void Singer's script which I absolutely love to work only slightly different (well that is my hopes).

What I need is once the script is place in a HUD "button" for it to be able to send its color to specifically name prims on a skirt that would be worn. I need to know what exactly to change in the script.

The primary prim in which the script is going won't be the master prim of the HUD.
I plan to sell my skirt with the color and texture " HUD " together so there can't owner issues. If someone would be so kind to show me what needs to be modified in the script below it would be most helpful, thanks.

Script below:
CODE

/*//( v7-D Enh. Color Picker v1.2 )//*/

/*//-- IMPORTANT NOTE
This Script MUST be
placed in one of the
prims it is going to
modify or it will not
work properly!

All Prims that are to
be modified at the
same time MUST have
the SAME NAME !!!
//*/

key gKeyOwner;
integer gIdxPanel;
integer gChnDialog;
list gLstTargets;
integer gIntTargets;
vector gColDefault = <0.0, 0.0, 0.0>;
string gStrProduct = "v7-D Adv Color Picker v1.2";
list gLstButtons = ["-1", "-8", "-64", "+1", "+8", "+64",
"Recall", "Done!", "Save",
"All Colors", "Red Only", "Green Only", "Blue Only"];
list gLstBValues = [-0.003922, -0.031373, -0.250980, 0.003922, 0.031373, 0.250980,
<1.0, 1.0, 1.0>, <1.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 1.0>];


fColorDialog(){
vector vColTemp = llGetColor( ALL_SIDES ) * 255;
//-- build the dialog to send
llDialog( gKeyOwner,
gStrProduct + "\n\nModifying "
+ llList2String( gLstButtons, gIdxPanel )
+ "\n\nCurrent Values (0-255):\n"
+ "R:" + (string)llRound( vColTemp.x )
+ ", G:" + (string)llRound( vColTemp.y )
+ ", B:" + (string)llRound( vColTemp.z )
+ " = #" + fFloat2HexStr( vColTemp.x )
+ fFloat2HexStr( vColTemp.y )
+ fFloat2HexStr( vColTemp.x ),
llDeleteSubList( gLstButtons, gIdxPanel, gIdxPanel ),
gChnDialog );
llSetTimerEvent( 45.0 );
}

string fFloat2HexStr( float vFltInput ){
integer vBitInput = llRound( vFltInput );
string vStrValue = "0123456789ABCDEF";
return llGetSubString( vStrValue, gIntTargets = vBitInput / 16, gIntTargets )
+ llGetSubString( vStrValue, gIntTargets = vBitInput % 16, gIntTargets );
}

fSetColor( vector vColUse ){
//-- loop through target list of linked prims
gIntTargets = gLstTargets != [];
@Loop;
llSetLinkColor( llList2Integer( gLstTargets, --gIntTargets ), vColUse, ALL_SIDES );
if (gIntTargets) jump Loop;
}


default{
state_entry(){
gKeyOwner = llGetOwner();
gChnDialog = (integer)("0xF" + llGetSubString( gKeyOwner, 1, 7 ));

string vStrTargetID = llGetObjectName();
gIntTargets = llGetNumberOfPrims();
@Loop;
if (llGetLinkName( gIntTargets ) == vStrTargetID){
gLstTargets += (list)gIntTargets;
}
if (~(--gIntTargets)) jump Loop;
state sReady;
}

changed( integer vBitChanges ){
if ((CHANGED_OWNER | CHANGED_LINK) & vBitChanges){
llResetScript();
}
}
}

state sReady{
state_entry(){
gIdxPanel = 9;
}

touch_end( integer vIntTotal ){
if (llDetectedKey( 0 ) == gKeyOwner){
state sRunning;
}
}

changed( integer vBitChanges ){
if ((CHANGED_OWNER | CHANGED_LINK) & vBitChanges){
state default;
}
}
}


state sRunning{
state_entry(){
llListen( gChnDialog, "", gKeyOwner, "" );
fColorDialog();
}

listen( integer vIntChannel, string vStrName, key vKeySpeaker, string vStrHeard ){
//-- get the index of the reply from our button list
integer vIdxReply = llListFindList( gLstButtons, (list)vStrHeard );
//-- is it a valid index? ~(-1) = FALSE
if (~vIdxReply){
//-- reply index 0 -5
if (6 > vIdxReply){
//-- get current color add change amount form dialog
vector vColCalc = llGetColor( ALL_SIDES )
+ llList2Vector( gLstBValues, gIdxPanel - 3 )
* llList2Float( gLstBValues, vIdxReply );
//-- Clamp color values to [0, 1]
fSetColor( <(0.0 < vColCalc.x && vColCalc.x < 1.0) * vColCalc.x,
(0.0 < vColCalc.y && vColCalc.y < 1.0) * vColCalc.y,
(0.0 < vColCalc.z && vColCalc.z < 1.0) * vColCalc.z>
+ <(vColCalc.x >= 1.0),
(vColCalc.y >= 1.0),
(vColCalc.z >= 1.0)> );
//-- reply index 6-8
}else if (9 > vIdxReply){
//-- Apply Saved Color
if (6 == vIdxReply){
fSetColor( gColDefault );
//-- done, go back to waiting
}else if (7 == vIdxReply){
llSetTimerEvent( 0.0 );
state sReady;
//-- save current color
}else{
gColDefault = llGetColor( ALL_SIDES );
llWhisper( 0, "Color saved." );
}
//-- reply index 9-12
}else if (13 > vIdxReply){
//-- change dialog panel
gIdxPanel = vIdxReply;
}
fColorDialog();
}
}

timer(){
//-- timeout to kill listens
llSetTimerEvent( 0.0 );
llOwnerSay( gStrProduct + " Dialog Timed Out." );
state sReady;
}

changed( integer vBitChanges ){
if ((CHANGED_OWNER | CHANGED_LINK) & vBitChanges){
state default;
}
}
}

/*//-- License Text --//*/
/*// Free to copy, use, modify, distribute, or sell, with attribution. //*/
/*// (C)2009 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ] //*/
/*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/
/*// All usages must contain a plain text copy of the previous 2 lines. //*/
/*//-- --//*/
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-22-2010 17:26
since my original recommendation I had a different thought, of using a listen in this script rather than a touch-end event, and then triggering this script via a chatted hud message. I won't write it all out, but if someone else feels like it, be my guest.

I don't personally like the solution as it leaves a running listen, but I can see how it'd be useful for a hud.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Asami Omizu
Registered User
Join date: 8 Apr 2009
Posts: 2
01-22-2010 17:40
If I am following possibly following your thought with this, that may work although I am unsure how to implement it properly. The main thing I want is your blue menu to come down and if possible not having it respond to touch. If the trigger can be done through the HUD by touch on a channel that would be great too. I was just confused on what you meant.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-23-2010 09:19
CODE

state sReady{
state_entry(){
gIdxPanel = 9;
llListen( -42, "", "", "v7-D Enh. Color Picker" );

}

listen( integer vIntNul, string vStrNul, key vKeySpk, string vStrNull ){
if (llGetOwnerKey( vKeySpk ) == gKeyOwner){

state sRunning;
}
}

changed( integer vBitChanges ){
if ((CHANGED_OWNER | CHANGED_LINK) & vBitChanges){
state default;
}
}
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -