A Beginning
This script was written by CHAT-GPT based on plain English specifications:
default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_COLOR, ALL_SIDES, <1, 0, 0>, 1.0]); // set the color of all faces to red
}
touch_start(integer total_number)
{
integer face = llDetectedTouchFace(0); // get the index of the touched face
list current_color = llGetLinkPrimitiveParams(LINK_THIS, [PRIM_COLOR, face]); // get the current color of the touched face
vector new_color; // create a variable for the new color
if (llList2Vector(current_color, 0) == <0, 0, 1>) // if the current color is blue
{
new_color = <0, 1, 0>; // set the new color to green
}
else if (llList2Vector(current_color, 0) == <1, 0, 0>) // if the current color is red
{
new_color = <1, 1, 0>; // set the new color to yellow
}
else // if the current color is neither red nor blue
{
new_color = <0, 0, 1>; // set the new color to blue
}
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_COLOR, face, new_color, 1.0]); // change the color of the touched face
}
}
- Make the box red;
- When I touch a red face, make it blue;
- When I touch a blue face, make it green
Comments
Post a Comment