Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

change from owner only to anyone.

Joshooah Lovenkraft
Just Joshin'
Join date: 28 Dec 2007
Posts: 1,376
08-25-2009 17:44
I'm not a very good scripter, although I am trying! I have this menu driven colour changer script that offers a simple dialog box with colour options and also a custom button that allows you to enter in custom rgb codes. I was surprisingly able to change the original from allowing owner only access to anyone, however, the custom button no longer works for either the owner or anyone. Could I get some help on where I went wrong, with explicit instructions if possible. Thanks :)

Original owner only script
CODE

// Global variables

integer g_listener = FALSE; // Listen Handler
integer randomChannel = 0; // Our random channel
integer place = 0; // Place in the Script
integer exit = FALSE; // Exit param
vector color = <1,1,1>; // Global color param

list colors = ["Orange","Purple","Lime","Pink","Teal","Gray","Blue","Red","Green","White","Yellow","Custom"];

list custom = ["0.8","0.9","1.0","0.5","0.6","0.7","0.2","0.3","0.4","0.0","0.1"];


default
{
touch_start(integer total_number)
{
if(llDetectedKey(0) == llGetOwner())
{
// Refresh the goods
place = 0;
llListenRemove(g_listener);

// Add a random channel
randomChannel = 10 + (integer)llFrand(100000);
g_listener = llListen(randomChannel,"",llGetOwner(),"");

// Fire up the expiration timer
llSetTimerEvent(720.0);

// Fire up the dialog
llDialog(llGetOwner(),"Select a Color Theme:",colors,randomChannel);
}
}
listen(integer chan, string name, key id, string msg)
{
// When we receive a dialog response...
if(chan == randomChannel) // Redundant, unless you want more chans
{
// This depth is reserved for Configuration Options
if(place == 0)
{
llSetTimerEvent(720.0);
++place;

integer test = llListFindList(colors,(list)msg);
if(test != -1)
{
// If we select "Orange"
if(test == 0)
{
color = <1,0.6,0>;
}

// If we select "Purple"
else if(test == 1)
{
color = <0.6,0,1>;
}

// If we select "Lime"
else if(test == 2)
{
color = <0.6,1,0>;
}

// If we select "Pink"
else if(test == 3)
{
color = <1,0,0.6>;
}

// If we select "Teal"
else if(test == 4)
{
color = <0,1,1>;
}

// If we select "Gray"
else if(test == 5)
{
color = <0.5,0.5,0.5>;
}

// If we select "Blue"
else if(test == 6)
{
color = <0.3,0.3,1>;
}

// If we select "Red"
else if(test == 7)
{
color = <1,0.3,0.3>;
}

// If we select "Green"
else if(test == 8)
{
color = <0.3,1,0.3>;
}

// If we select "White"
else if(test == 9)
{
color = <1,1,1>;
}

// If we select "Yellow"
else if(test == 10)
{
color = <1,1,0>;
}

// If we select "Custom"
else if(test == 11)
{
llDialog(llGetOwner(),"Custom Color Mode Selected! Choose a value for RED (Second Life RGB).",custom,randomChannel);
return;
}

llSetLinkColor(LINK_SET,color,ALL_SIDES);

exit = TRUE;
llSetTimerEvent(0.1);
return;
}
else
llSetTimerEvent(0.1);

}
// This depth is reserved for Custom Colors ONLY!
else if(place == 1)
{
llSetTimerEvent(720.0);
++place;

color.x = (float)msg;
llDialog(llGetOwner(),"Choose a value for GREEN (Second Life RGB).",custom,randomChannel);
}
else if(place == 2)
{
llSetTimerEvent(720.0);
++place;

color.y = (float)msg;
llDialog(llGetOwner(),"Choose a value for BLUE (Second Life RGB).",custom,randomChannel);
}
else if(place == 3)
{
llSetTimerEvent(720.0);
++place;

color.z = (float)msg;

llSetLinkColor(LINK_SET,color,ALL_SIDES);

exit = TRUE;
llSetTimerEvent(0.1);
return;
}
}
}
timer()
{
llSetTimerEvent(0.0);
if(exit == FALSE) llOwnerSay("Timer Expired. Please try again.");
llListenRemove(g_listener);
}
}



Anyone with broken custom button script
CODE

// Global variables

integer g_listener = FALSE; // Listen Handler
integer randomChannel = 0; // Our random channel
integer place = 0; // Place in the Script
integer exit = FALSE; // Exit param
vector color = <1,1,1>; // Global color param

list colors = ["Orange","Purple","Lime","Pink","Teal","Gray","Blue","Red","Green","White","Yellow","Custom"];

list custom = ["0.8","0.9","1.0","0.5","0.6","0.7","0.2","0.3","0.4","0.0","0.1"];


default
{
touch_start(integer total_number)
{

{
// Refresh the goods
place = 0;
llListenRemove(g_listener);

// Add a random channel
randomChannel = 10 + (integer)llFrand(100000);
g_listener = llListen(randomChannel,"",llDetectedKey(0),"");

// Fire up the expiration timer
llSetTimerEvent(720.0);

// Fire up the dialog
llDialog(llDetectedKey(0),"Select a Color Theme:",colors,randomChannel);
}
}
listen(integer chan, string name, key id, string msg)
{
// When we receive a dialog response...
if(chan == randomChannel) // Redundant, unless you want more chans
{
// This depth is reserved for Configuration Options
if(place == 0)
{
llSetTimerEvent(720.0);
++place;

integer test = llListFindList(colors,(list)msg);
if(test != -1)
{
// If we select "Orange"
if(test == 0)
{
color = <1,0.6,0>;
}

// If we select "Purple"
else if(test == 1)
{
color = <0.6,0,1>;
}

// If we select "Lime"
else if(test == 2)
{
color = <0.6,1,0>;
}

// If we select "Pink"
else if(test == 3)
{
color = <1,0,0.6>;
}

// If we select "Teal"
else if(test == 4)
{
color = <0,1,1>;
}

// If we select "Gray"
else if(test == 5)
{
color = <0.5,0.5,0.5>;
}

// If we select "Blue"
else if(test == 6)
{
color = <0.3,0.3,1>;
}

// If we select "Red"
else if(test == 7)
{
color = <1,0.3,0.3>;
}

// If we select "Green"
else if(test == 8)
{
color = <0.3,1,0.3>;
}

// If we select "White"
else if(test == 9)
{
color = <1,1,1>;
}

// If we select "Yellow"
else if(test == 10)
{
color = <1,1,0>;
}

// If we select "Custom"
else if(test == 11)
{
llDialog(llDetectedKey(0),"Custom Color Mode Selected! Choose a value for RED (Second Life RGB).",custom,randomChannel);
return;
}

llSetLinkColor(LINK_SET,color,ALL_SIDES);

exit = TRUE;
llSetTimerEvent(0.1);
return;
}
else
llSetTimerEvent(0.1);

}
// This depth is reserved for Custom Colors ONLY!
else if(place == 1)
{
llSetTimerEvent(720.0);
++place;

color.x = (float)msg;
llDialog(llDetectedKey(0),"Choose a value for GREEN (Second Life RGB).",custom,randomChannel);
}
else if(place == 2)
{
llSetTimerEvent(720.0);
++place;

color.y = (float)msg;
llDialog(llDetectedKey(0),"Choose a value for BLUE (Second Life RGB).",custom,randomChannel);
}
else if(place == 3)
{
llSetTimerEvent(720.0);
++place;

color.z = (float)msg;

llSetLinkColor(LINK_SET,color,ALL_SIDES);

exit = TRUE;
llSetTimerEvent(0.1);
return;
}
}
}
timer()
{
llSetTimerEvent(0.0);
if(exit == FALSE) llInstantMessage(llDetectedKey(0),("Timer Expired. Please try again."));
llListenRemove(g_listener);
}
}

_____________________


Hello Avatard - Your Emporium of Fun Stuff
In-world: http://slurl.com/secondlife/Fordham/178/19/63
Xstreet: https://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=103499
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-25-2009 17:56
"Note: The llDetected* functions will only return a meaningful value in the collision(), collision_start(), collision_end(), sensor(), touch(), touch_start(), or touch_end() events."

CODE

integer g_listener = FALSE;
integer randomChannel = 0;
integer place = 0;
integer exit = FALSE;
vector color = <1, 1, 1 >;
list colors =["Orange", "Purple", "Lime", "Pink", "Teal", "Gray", "Blue", "Red", "Green", "White", "Yellow", "Custom"];
list custom =["0.8", "0.9", "1.0", "0.5", "0.6", "0.7", "0.2", "0.3", "0.4", "0.0", "0.1"];
key tID;

default {
touch_start(integer total_number) {
place = 0;
tID = llDetectedKey(0);
llListenRemove(g_listener);
randomChannel = 10 + (integer) llFrand(100000);
g_listener = llListen(randomChannel, "", tID, "");
llSetTimerEvent(720.0);
llDialog(tID, "Select a Color Theme:", colors, randomChannel);
}
listen(integer chan, string name, key id, string msg) {
if (chan == randomChannel) {
if (place == 0) {
llSetTimerEvent(720.0);
++place;
integer test = llListFindList(colors, (list) msg);
if (test != -1) {
if (test == 0) {
color = <1, 0.6, 0 >;
}
else if (test == 1) {
color = <0.6, 0, 1 >;
}
else if (test == 2) {
color = <0.6, 1, 0 >;
}
else if (test == 3) {
color = <1, 0, 0.6 >;
}
else if (test == 4) {
color = <0, 1, 1 >;
}
else if (test == 5) {
color = <0.5, 0.5, 0.5 >;
}
else if (test == 6) {
color = <0.3, 0.3, 1 >;
}
else if (test == 7) {
color = <1, 0.3, 0.3 >;
}
else if (test == 8) {
color = <0.3, 1, 0.3 >;
}
else if (test == 9) {
color = <1, 1, 1 >;
}
else if (test == 10) {
color = <1, 1, 0 >;
}
else if (test == 11) {
llDialog(tID,
"Custom Color Mode Selected! Choose a value for RED (Second Life RGB).",
custom, randomChannel);
return;
}
llSetLinkColor(LINK_SET, color, ALL_SIDES);
exit = TRUE;
llSetTimerEvent(0.1);
return;
}
else
llSetTimerEvent(0.1);
}

else if (place == 1) {
llSetTimerEvent(720.0);
++place;
color.x = (float) msg;
llDialog(tID, "Choose a value for GREEN (Second Life RGB).", custom,
randomChannel);
}
else if (place == 2) {
llSetTimerEvent(720.0);
++place;
color.y = (float) msg;
llDialog(tID, "Choose a value for BLUE (Second Life RGB).", custom,
randomChannel);
}
else if (place == 3) {
llSetTimerEvent(720.0);
++place;
color.z = (float) msg;
llSetLinkColor(LINK_SET, color, ALL_SIDES);
exit = TRUE;
llSetTimerEvent(0.1);
return;
}
}
}
timer() {
llSetTimerEvent(0.0);
if (exit == FALSE)
llInstantMessage(tID, ("Timer Expired. Please try again."));
llListenRemove(g_listener);
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Joshooah Lovenkraft
Just Joshin'
Join date: 28 Dec 2007
Posts: 1,376
08-25-2009 20:11
Thanks so much for the help and speedy reply Jesse! Now I can go back and see what I messed up. Cheers.
_____________________


Hello Avatard - Your Emporium of Fun Stuff
In-world: http://slurl.com/secondlife/Fordham/178/19/63
Xstreet: https://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=103499