Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

setting colors using increase and decrease arrows?

RaptonX Zorger
Registered User
Join date: 26 Jan 2006
Posts: 79
09-17-2006 13:11
Ok, this one has had me pulling my hair out


when I say /33 color <1,0.5,0> or whatever, it works fine

now if I have a HUD say llShout(33, "color <1,0.5,0>";); no problem

but if I do it this way

llShout(33, "color " + (string)<1,0.5,0>;);

it only sets the first part of the color vector to 1.0000000 and none of the others.....

Do I have to convert the colors to 255 mode in order to make this work? I'm rather confused by this.
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
09-17-2006 15:41
I'm not sure exactly how your implementing this, but I would make a vector before the shout. So for instance:

CODE


vector COLOR = <1.0, 0.5, 0>;
llShout(33, "color " + (string) COLOR);



Try that, see if it works :)
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
09-17-2006 18:17
From the temporary lsl wiki:
http://rpgstats.com/wiki/index.php?title=Color


Colours are vectors containing 0.0 - 1.0 normalized vectors. You need to divide 0 - 255 colour vectors by 255 before using them.
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
09-17-2006 18:31
From: ed44 Gupte
From the temporary lsl wiki:
http://rpgstats.com/wiki/index.php?title=Color


Colours are vectors containing 0.0 - 1.0 normalized vectors. You need to divide 0 - 255 colour vectors by 255 before using them.



That just means that SL only takes numbers between 0 and 1, you can put in 0.254 for a value. If you have a color like R125, G200, B100, then you would have to divide them by 255 to get the corresponding values for llSetColor to work.
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
09-17-2006 19:27
Maybe it has something to do with how you're converting the string in the listen at the other end back to a vector. I notice your first example had "color <1,0.5,0>" (with no spaces after the commas) but I'm pretty sure "color " + (string)<1,0.5,0> would actually be sent as "color <1.0, 0.5, 0.0>". I don't have SL handy to test atm so you'd have to double-check that, but there's another possibility for you to investigate anyway.
Aakanaar LaSalle
Registered User
Join date: 1 Sep 2006
Posts: 132
09-17-2006 20:34
nah, he has spaces in all cases..

I have a script that i'm shouting a vector as well (on a negative channel) and it works fine.. using (string) Vector (i am putting it in a variable before I send it. yes.)

how are you retreiving it back out? using llGetSubString(string, 6, -1); ??

Edit: Scratch that.. if the /33 color: <blah> is working, then it isn't how youre retrieving it.. but the code you show there does look right. Perhaps double check that you havn't got a stray comma or something messing it up, and/or try a variable?

I can't say how many times I keep trying to enter <1.0, 0,5, 0.0> which for some reason it doesn't like.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
09-17-2006 23:05
use lots of llOwnerSay debugging commands:
CODE
 llOwnerSay ((string) whatVectorYouThinkItHasRead)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-18-2006 01:08
I have a similar item, non HUD though, that works using the following code

CODE

// iIndex is the index into the colour array
vector vcolour = llList2Vector(lColours, iIndex );
string msg = "COLOUR:" + (string)vcolour;
llShout(chnnl,msg);



the receiver end is

CODE

listen( integer channel, string name, key id, string message )
{
list lData = llParseString2List(message, [":"], [""]);
string command = llList2String(lData, 0);
string item = llList2String(lData, 1);

if(DebugOn)
llOwnerSay("heard [" + command + "] [" + item + "]");

if("COLOUR" == command)
{
vector clr = (vector)item;
llSetColor(clr,ALL_SIDES);
}

}