Jump to content

a little help for change color script


sndbad Ghost
 Share

You are about to reply to a thread that has been inactive for 2774 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

 hello friends i make sample script for change object color with TextBox

i use this script 

vector message ="" ;
integer  gListener;
default
{
    touch_start(integer total_number)
    {

        integer channel = -13572468;

        gListener = llListen( channel, "", "", "");     
        llTextBox(llDetectedKey(0), "Some info text for the top of the window...", channel);
    }
    listen(integer channel, string name, key id, string message)
    {
        llListenRemove(gListener);

        llSetColor(message, ALL_SIDES);
    }
}

its work fine . with master prim

but i need it works with linked prim not master object .

i hope you get what i mean

thanks 

 

Link to comment
Share on other sites

The LSL function, llSetColor, will apply color to the face of the root prim.  If you want to apply color to a face of a child prim, you'll have to use  llSetLinkColor or use llSetLinkPrimitiveParams with the PRIM_COLOR option.  Be sure that the color you apply is a vector.  As written, your script applies the variable, message, which is a string.  Before you apply it on the prim face, then, you'll either have to typecast it as (vector)message or use message to extract a color vector from a list you have saved in your script.

EDIT:  Actually, you have tried to do that typecasting, but have done it incorrectly.  You created a global vector variable called message, but then you used a different local variable, also called message, in your listen event.  The script will ignore your global variable because the local one will take precedence.  So, get rid of the useless global message and typecast the local one properly.

  • Like 2
Link to comment
Share on other sites

  • 6 months later...


sndbad Ghost wrote:

 hello friends i make sample script for change object color with TextBox

i use this script 
vector message ="" ;integer  gListener;default{    touch_start(integer total_number)    {        integer channel = -13572468;        gListener = llListen( channel, "", "", "");             llTextBox(llDetectedKey(0), "Some info text for the top of the window...", channel);    }    listen(integer channel, string name, key id, string message)    {        llListenRemove(gListener);        llSetColor(message, ALL_SIDES);    }}

its work fine . with master prim

but i need it works with linked prim not master object .

i hope you get what i mean

thanks 

 

Will this do it?

// 1 - Create two prims and link them.// 2 - Name the child prim CHILD_01integer GetPrimNum(string n) {    integer i = llGetLinkNumber() != 0;    integer x = llGetNumberOfPrims() + i;     for (; i < x; ++i)        if (llGetLinkName(i) == n) return i;    return -1;}default{    touch_start(integer total_number)    {        llListen(-13572468, "", "NULL_KEY", "");             llTextBox(llGetOwner(), "Modified by Punkyboo ...", -13572468);    }    listen(integer channel, string name, key id, string message)    {        key r = llGetOwnerKey(id); // Because llTextBox is NOT the owner itself.        key n = llGetOwner();        if (r != n) return;        else        {            llSetLinkPrimitiveParamsFast(GetPrimNum("CHILD_01"), [PRIM_COLOR, -1, (vector)message, 1.0]);            llListenRemove(-13572468); // Make something like this the last iteration, always.        }    }}

 EDIT: Oh maybe you wanted it open to the public lol, here ya go...

// 1 - Create two prims and link them.// 2 - Name the child prim CHILD_01integer GetPrimNum(string n) {    integer i = llGetLinkNumber() != 0;    integer x = llGetNumberOfPrims() + i;     for (; i < x; ++i)        if (llGetLinkName(i) == n) return i;    return -1;}default{    touch_start(integer total_number)    {        llListen(-13572468, "", llDetectedKey(0), "");             llTextBox(llDetectedKey(0), "Modified by Punkyboo ...", -13572468);    }    listen(integer channel, string name, key id, string message)    {        llSetLinkPrimitiveParamsFast(GetPrimNum("CHILD_01"), [PRIM_COLOR, -1, (vector)message, 1.0]);        llListenRemove(-13572468); // Make something like this the last iteration, always.    }}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2774 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...