Colorchange script problems
|
|
Linnrenate Crosby
Registered User
Join date: 5 Jun 2007
Posts: 49
|
09-07-2007 03:47
Hia all, Someone gave me this script to use on my color/bracelets, but i cannot figure out how to make it work as i am no script wiz at all. Therefore i need some help, the prim in my objects that i want to use this script on are named mainpart. Hope someone can break it down for me what i must do and how i trigger the color change. //Created By vanler Everett 0ct-15-04 vector black = <0,0,0>; vector gray = <.5,.5,.5>; vector white = <1,1,1>; vector pink = <255,0,255>; vector red = <1,0,0>; vector orange = <1,.3,.3>; vector yellow = <1,1,0>; vector green = <0,1,0>; vector blue = <0,0,1>; vector teal = <0,1,1>; vector purple = <.5, 0, .5>; default { state_entry() { string sName = llKey2Name(llDetectedKey(0)); key owner = llGetOwner(); llListen(6,"",owner,""  ; } on_rez(integer param) { llResetScript(); } listen( integer channel, string name, key id, string message ) { // ========== COPY THE 4 lines below for another COLOR command, then remove the // marks to activate it. // if(message=="colorname"  // { // llSetColor(<R,G,B>, ALL_SIDES); // } if( message == "dark red"  { llSetColor(<128,0,0>,ALL_SIDES); } if( message == "teal"  { llSetColor(teal,ALL_SIDES); } if( message == "purple"  { llSetColor(purple,ALL_SIDES); } if( message == "yellow"  { llSetColor(yellow,ALL_SIDES); } if( message == "black"  { llSetColor(black,ALL_SIDES); } if( message == "white"  { llSetColor(<1,1,1>,ALL_SIDES); } if( message == "blue"  { llSetColor(<0,0,1>,ALL_SIDES); } if( message == "green"  { llSetColor(<0,1,0>,ALL_SIDES); } if( message == "red"  { llSetColor(<1,0,0>,ALL_SIDES); } if( message == "gray"  { llSetColor(gray,ALL_SIDES); } if( message == "pink"  { llSetColor(pink,ALL_SIDES); } if( message == "orange"  { llSetColor(orange,ALL_SIDES); } } }
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-07-2007 03:57
put this script in your object. then via chat command change the color
chat command:
/6 color
example:
/6 blue
|
|
Linnrenate Crosby
Registered User
Join date: 5 Jun 2007
Posts: 49
|
09-07-2007 04:18
/6 green lol... that is me when it comes to scripts  Thanks a lot Milcoi
|
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
09-07-2007 17:11
Here's an alternate/abridged version: From: someone list colors = ["black", <0,0,0>, "gray", <.5,.5,.5>, "white", <1,1,1>, "pink", <255,0,255>, "red", <1,0,0>, "orange", <1,.3,.3>, "yellow", <1,1,0>, "green", <0,1,0>, "blue", <0,0,1>, "teal", <0,1,1>, "purple", <.5, 0, .5>]; default { state_entry() { llListen(6, "", llGetOwner(), ""  ; } on_rez(integer param) { llResetScript(); } listen( integer channel, string name, key id, string message ) { message = llToLower(message); integer i = llListFindList(colors, [message]); if (i == -1) return; else llSetColor(llList2Vector(colors, i + 1), ALL_SIDES); } }
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-07-2007 18:12
I hate going the type /chan + command route. First there is a listen that has to stay open all of the time. Secondly there are only 11 choices which is perfect for a dialog menu. You could also dress this up even more and add in a llFrand channel: integer chan = -2987359; list menu_colors; list colors = ["black", <0,0,0>, "gray", <.5,.5,.5>, "white", <1,1,1>, "pink", <255,0,255>, "red", <1,0,0>, "orange", <1,.3,.3>, "yellow", <1,1,0>, "green", <0,1,0>, "blue", <0,0,1>, "teal", <0,1,1>, "purple", <.5, 0, .5>];
default { state_entry() { menu_colors = llList2ListStrided(colors, 0, -1, 2); } touch_start(integer num_detected) { llListen(chan,"",llGetOwner(),""); llSetTimerEvent(20); llDialog(llDetectedKey(0), "Pick a color", menu_colors, chan); } on_rez(integer param) { llResetScript(); } listen( integer channel, string name, key id, string message ) { message = llToLower(message); integer i = llListFindList(colors, [message]); if (i == -1) return; else llSetColor(llList2Vector(colors, i + 1), ALL_SIDES); } timer() { llSetTimerEvent( 0 ); llListenRemove(chan); return; } } [\PHP]
_____________________
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
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
09-07-2007 18:20
just fyi pink wont work since its still in RGB format and not float format 
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-07-2007 18:40
From: Osgeld Barmy just fyi pink wont work since its still in RGB format and not float format  It's working, just tested in world. I couldn't live without pink!
_____________________
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
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-07-2007 19:16
Here this is better: integer random_chan; integer chan; list menu_colors; list colors = ["black", <0,0,0>, "gray", <.5,.5,.5>, "white", <1,1,1>, "pink", <255,0,255>, "red", <1,0,0>, "orange", <1,.3,.3>, "yellow", <1,1,0>, "green", <0,1,0>, "blue", <0,0,1>, "teal", <0,1,1>, "purple", <.5, 0, .5>];
default { state_entry() { menu_colors = llList2ListStrided(colors, 0, -1, 2); llListenRemove(chan); random_chan = 0; { do { random_chan = ((integer) llFrand(3) - 1) * ((integer) llFrand(2147483647)); } while(random_chan == 0); } } touch_start(integer num_detected) { chan = llListen(random_chan,"",llGetOwner(),""); llSetTimerEvent(20); llDialog(llDetectedKey(0), "Pick a color", menu_colors, random_chan); } on_rez(integer param) { llResetScript(); } listen( integer channel, string name, key id, string message ) { message = llToLower(message); integer i = llListFindList(colors, [message]); if (i == -1) return; else llSetColor(llList2Vector(colors, i + 1), ALL_SIDES); } timer() { llSetTimerEvent( 0 ); llListenRemove(chan); return; } } [\PHP]
_____________________
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
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
09-07-2007 21:42
From: Jesse Barnett I hate going the type /chan + command route. First there is a listen that has to stay open all of the time. Secondly there are only 11 choices which is perfect for a dialog menu. You could also dress this up even more and add in a llFrand channel:
Easier solution would be just to rotate the colors along a list on each touch. Then there's no listen and no dialog either.
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
09-07-2007 22:13
my take
|