Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Example
- // /2 curtain state1 - Will turn on all prims named "state1", and turn off all others not named "ignore"
- string IGNORE_STRING = "ignore"; // Name a prim this for it to be ignored.
- integer CHANNEL = 2;
- string CMD = "body";
- //GAB NOTE for every part of the body you want to be toggleable add an integer with an appropriate name, no spaces allowed (E.G. "integer leftboob")
- integer head;
- integer torso;
- integer legs;
- default
- {
- state_entry()
- {
- llListen(CHANNEL, "", "", "");
- }
- listen(integer channel, string name, key id, string msg)
- {
- // Since we are not listening for our owner specifically, check to see if
- // the owner of the object speaking, is our owner. Used to allow HUDs.
- if( llGetOwnerKey(id) == llGetOwner() )
- {
- msg = llToLower(msg);
- // Cut the message into pieces at the spaces.
- list args = llParseString2List(msg, [" "], []);
- string cmd = llList2String(args, 0);
- string arg = llList2String(args, 1);
- integer facenum = llList2Integer(args, 2);
- // Check to see if the command's what we want.
- if(cmd == CMD)
- {
- // It is! Loop through every prim in the object.
- integer prims = llGetNumberOfPrims()+1;
- while(--prims > 1)
- {
- string check = llGetLinkName(prims);
- // And then check to see if it matches, and also check to see if the
- // This will be true if the ignore string isn't found in the prim name
- if(llSubStringIndex(check, IGNORE_STRING) == -1)
- {
- // This will be true if we find what we're looking for.
- if(check == arg){
- //the following chunk of code can be copied and pasted as many times as you want, once
- //for each face to be made invisible, just change the 4 places where it says "head", don't
- //mess with "facenum", it's what lets you specify which face of the object you're toggling
- /*
- if(arg == "head"){
- if(head){
- head = 0;
- llSetLinkAlpha(prims, 0.0, facenum);
- }
- else{
- head =1;
- llSetLinkAlpha(prims, 1.0, facenum);
- }
- }
- */
- if(arg == "head"){
- if(head){
- head = 0;
- llSetLinkAlpha(prims, 0.0, facenum);
- }
- else{
- head =1;
- llSetLinkAlpha(prims, 1.0, facenum);
- }
- }
- else if(arg == "torso"){
- if(torso){
- torso = 0;
- llSetLinkAlpha(prims, 0.0, facenum);
- }
- else{
- torso =1;
- llSetLinkAlpha(prims, 1.0, facenum);
- }
- }
- if(arg == "legs"){
- if(legs){
- legs = 0;
- llSetLinkAlpha(prims, 0.0, facenum);
- }
- else{
- legs =1;
- llSetLinkAlpha(prims, 1.0, facenum);
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement