Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float intensity = 0.3;
- float radius = 3.0;
- float falloff = 1.0;
- integer off = 0;
- integer lightState;
- float rot;
- list frames = [];
- integer light;
- list menuChoices =["Nickel","Brushed","Oiled"];
- integer channel_dialog;
- key ToucherID;
- string message = "\nPlease select a texture";
- integer listen_id;
- getPrimNumbers()
- {
- integer i;
- for (i=1;i<=llGetNumberOfPrims();i++)
- {
- if (llGetLinkName(i)=="frame")
- {
- frames += [i];
- }
- else if (llGetLinkName(i)=="light")
- {
- light = i;
- }
- }
- }
- setFrameColor(vector color)
- {
- llSay(0,"Setting frame to color : " + (string)color);
- llSetLinkPrimitiveParamsFast(2,[PRIM_COLOR,ALL_SIDES,color,1]);
- llSetLinkPrimitiveParamsFast(3,[PRIM_COLOR,ALL_SIDES,color,1]);
- llSetLinkPrimitiveParamsFast(4,[PRIM_COLOR,ALL_SIDES,color,1]);
- llSetLinkPrimitiveParamsFast(5,[PRIM_COLOR,ALL_SIDES,color,1]);
- }
- default
- {
- state_entry()
- {
- llSay(0,"\n\nTesting Script\n");
- getPrimNumbers();
- llSetLinkPrimitiveParamsFast(1,[PRIM_TEXTURE, ALL_SIDES, "LightSwitch", <1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0]);
- llSetLinkPrimitiveParamsFast(light,
- [PRIM_FULLBRIGHT,ALL_SIDES,lightState,
- PRIM_POINT_LIGHT,lightState,<1,1,1>,intensity,radius,falloff]);
- setFrameColor(<40,33,29>);
- }
- touch_start(integer num_detected)
- {
- integer i;
- integer l;
- integer primCount = llGetObjectPrimCount(llGetKey());
- if (llDetectedLinkNumber(0) == 1)
- {
- lightState = !lightState;
- rot = (lightState*180)*DEG_TO_RAD;
- llSetLinkPrimitiveParamsFast(1,[PRIM_TEXTURE,ALL_SIDES,"LightSwitch",<1.0,1.0,0>,<0,0,0>,rot]);
- llSetLinkPrimitiveParamsFast(light, [PRIM_FULLBRIGHT,ALL_SIDES,lightState,
- PRIM_POINT_LIGHT,lightState,<1,1,1>,intensity,radius,falloff]);
- for (i=0;i<llGetListLength(frames);i++)
- {
- l=llList2Integer(frames,i);
- llSetLinkPrimitiveParamsFast(l,[PRIM_FULLBRIGHT,ALL_SIDES,lightState]);
- }
- }
- else
- {
- channel_dialog = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
- ToucherID = llDetectedKey(0);
- llDialog(ToucherID, message, menuChoices, channel_dialog);
- listen_id = llListen(channel_dialog,"",ToucherID,"");
- }
- }
- listen(integer channel, string name, key id, string message)
- {
- vector frameColor;
- if (message == "Nickel")
- {
- frameColor = <171,170,167>;
- }
- else if (message == "Brushed")
- {
- frameColor = <211,170,109>;
- }
- else if (message == "Oiled")
- {
- frameColor = <40,33,29>;
- }
- setFrameColor(frameColor);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement