Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

color change script isn't working

Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-17-2005 10:52
I can't figure out why it's not working. it's a button that's used to move a HUD attachment (keypad) in and out of view. when the keypad is "off" the button should be red. when it's "on" it should be green. it's not changing any colors right now, just sitting as the default white from when I created the prim


**colorchanging script**
CODE

default
{
state_entry()
{

}


link_message(integer sender_number, integer number, string message, key id)
{

vector orig = llGetLocalPos();

if (message == "KeyboardPadOn")
{
llSetColor(<0,1,0>,1);
}


if (message == "KeyboardPadOff")
{
llSetColor(<1,0,0>,1);
}

}

}


**script which tells the pad to turn on or off based on touch**

CODE

key operator;
default
{

touch_start(integer total_number)
{
llOwnerSay( "Keyboard Pad On.");
llMessageLinked(LINK_ALL_CHILDREN, 0, "KeyboardPadOn", operator);
llTriggerSound("9a17201e-8266-a21c-4070-06023dabebcb",1.0);
llSetColor(<1,0,0>,1); //tried incorperating the color change script in here. still doesn't work
state otherway;

}
}

state otherway
{
touch_start(integer total_number)
{
llOwnerSay( "Keyboard Pad Off.");
llMessageLinked(LINK_ALL_CHILDREN, 0, "KeyboardPadOff", operator);
llTriggerSound("9a17201e-8266-a21c-4070-06023dabebcb",1.0);
llSetColor(<0,0,1>,1); //I tried issuing the color change command in here but it still doesn't work
state default;

}
}

JackBurton Faulkland
PorkChop Express
Join date: 3 Sep 2005
Posts: 478
11-17-2005 10:53
You need a llListen call in your state_ entry in your reciever script
_____________________
You know what Jack Burton always says... what the hell?
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-17-2005 11:10
Try ALL_SIDES instead of 1. Side 1 might not be the side facing you when you attach a cube to the HUD. You could also try editing your HUD attachment and rotating it to see if some other side is being colored. Or invoke the script, then drop the attachment and look at it on the ground to see if a face changed color.

Edit: Also, AFAIK LINK_ALL_CHILDREN will send to all children, and leave out the root prim. So if these are all in the same prim, the second script may not get triggered. Did you try putting in some llSay() calls to check if the link message is being received?
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-17-2005 11:14
From: Ziggy Puff
Try ALL_SIDES instead of 1. Side 1 might not be the side facing you when you attach a cube to the HUD.



ah thank you, that was my problem. silly mistakes FTW.