JackRipper666 Posted January 15, 2014 Share Posted January 15, 2014 Hello everyone. I am trying to make a script where I can target a specific face of a prim so that if someone touches for example face 5 of a cube prim something will happen. If they touch face 4 something else will happen which would happen. Only thing I'm puzzled on is how to use faces in this way. I was trying something like the code below but not really understanding llDetectedTouchFace. Maybe someone can help understand what I am trying to do with it though. default { touch_start(integer num_detected) { integer face5 = llDetectedTouchFace(0); integer face4 = llDetectedTouchFace(0); if (face == 5) { llSay(1,"You touched face 5"); } else if (face == 4) { llSay(1,"You touched face 4"); } } } Link to comment Share on other sites More sharing options...
LepreKhaun Posted January 15, 2014 Share Posted January 15, 2014 You almost had it! default{ touch_start(integer num_detected) { integer face = llDetectedTouchFace(0); if (face == 5) { llSay(1,"You touched face 5"); } else if (face == 4) { llSay(1,"You touched face 4"); } } } 1 Link to comment Share on other sites More sharing options...
Xiija Posted January 15, 2014 Share Posted January 15, 2014 Link to comment Share on other sites More sharing options...
steph Arnott Posted January 15, 2014 Share Posted January 15, 2014 INFO: "Maybe someone can help understand what I am trying to do with it though." default{ touch_start(integer num_detected) { integer face = llDetectedTouchFace(0);//The surface //that was detected when touched is assigned to this //integer. if (face == 5)//If 4 was the detected surface //then the assigned integer comparison is false, so ignore this //and move to the next comparison. { llSay(1,"You touched face 5"); } else if (face == 4)//The integer assigned is 4 //so the comparison is true, so run this code. { llSay(1,"You touched face 4"); } }} default{ touch_start(integer num_detected) { integer face5 = llDetectedTouchFace(0);//Assign the detected //surface touched to this integer. integer face4 = llDetectedTouchFace(0);//Assign the detected //surface touched to this integer. if (face == 5)//This integer does not exist. Only //face4 and face5 do. { llSay(1,"You touched face 5"); } else if (face == 4)//This integer does not exist. Only //face4 and face5 do. { llSay(1,"You touched face 4"); } }} ADDED: I noticed that you have channel 1 as the output, you will never see the result. Use llOwnerSay(string message) instead, i.e. llOwnerSay("you touched face 4"); Any channel that is not the PUBLIC_CHANNEL (0) is for script communication and will not be visible to you. If that was your intention then still use the llOwnerSay as well to confirm output is correct. BTW others will say commenting out lines does not affect script, it does in some instances so delete those debug lines when you are happy, (keeps the code clean as well) it doing what you expected. 1 Link to comment Share on other sites More sharing options...
JackRipper666 Posted January 15, 2014 Author Share Posted January 15, 2014 Thanks guys, really appreciate it! I'll give this a try. Link to comment Share on other sites More sharing options...
Recommended Posts
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