Change font size
It is currently Fri Aug 17, 2018 7:45 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 3 posts ]
Author Message
 Post subject: What Face?
PostPosted: Tue Apr 21, 2009 3:58 am 
Furious Typer
User avatar

Joined: Sun Aug 31, 2008 4:34 pm
Posts: 107
Ever in the heat of battle, you need to know which face you have on a prim?
carry this
{L_CODE}:
//prim face check
default
{
    touch_start(integer num_detected) {
        integer i;
        for (i = 0; i < num_detected; i++) {
            integer touchedFace = llDetectedTouchFace(i);     

            if (touchedFace == -1) {
                llWhisper(0, "Sorry, your viewer doesn't support touched faces.");
            }
            else {
                llSay(0, "You touched face: " + (string)touchedFace);
            }
        }
    }
}


Top
 Profile  
 
 Post subject: Re: What Face?
PostPosted: Tue Apr 21, 2009 2:44 pm 
Furious Typer

Joined: Fri Dec 12, 2008 9:47 am
Posts: 258
and if you have an object and need the linknumber + face... then use ->

{L_CODE}:
default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer num_detected)
    {
       
        integer i = 0;
        for(i=0; i<num_detected; ++i)
            llWhisper(0, "Link number clicked: " + (string)llDetectedLinkNumber(i));

i = 0;
        for (i = 0; i < num_detected; i++) {
            integer touchedFace = llDetectedTouchFace(i);     

            if (touchedFace == -1) {
                llWhisper(0, "Sorry, your viewer doesn't support touched faces.");
            }
            else {
                // Store away the original color
                llWhisper(0, "Touched Face: " + (string)touchedFace);
                vector oldColor = llGetColor(touchedFace);

                // Flash white and black on the touched face
                llSetLinkColor(llDetectedLinkNumber(0),<1., 1., 1.>, touchedFace);
                llSleep(0.1);
                llSetLinkColor(llDetectedLinkNumber(0),<0., 0., 0.>, touchedFace);
                llSleep(0.1);

                // Put the color back to how we found it.
                llSetLinkColor(llDetectedLinkNumber(0),oldColor, touchedFace);
            }
        }
    }

}

_________________
{L_IMAGE}{L_IMAGE}{L_IMAGE}


Top
 Profile  
 
 Post subject: Re: What Face?
PostPosted: Sat Apr 03, 2010 5:01 pm 
User avatar

Joined: Tue Jun 02, 2009 11:54 am
Posts: 6
Location: CST
This original script is by Xylor Baysklef. All I did was make a new 10x10 texture for OSG so you can see the numbers on all sides you put this script into. Will visually show you all sides on a prim...up to 100 sides.

{L_CODE}:
////////////////////////////////////////////
// Side Numbering Script
//
// Written by Xylor Baysklef
////////////////////////////////////////////

/////////////// CONSTANTS ///////////////////
key NUMBERS_TEXTURE = "57a39a34-829e-4dab-bc2f-85419f48095f";//Texture done for OSG
///////////// END CONSTANTS /////////////////

///////////// GLOBAL VARIABLES ///////////////
/////////// END GLOBAL VARIABLES /////////////

ShowNumber(integer num, integer face) {
    integer Row = num / 10;
    integer Col = num % 10;
    llOffsetTexture(-0.45 + 0.1 * Col, 0.45 - 0.1 * Row, face);
}

default {
    state_entry() {
        // Reset rotation, alpha, color and turn off animations.
        llRotateTexture(0.0, ALL_SIDES);
        llSetAlpha(1.0, ALL_SIDES);
        llSetColor(<1, 1, 1>, ALL_SIDES);
        llSetTextureAnim(FALSE, 0, 0, 0, 0, 0, 0);
       
        // Show the numbers texture.
        llSetTexture(NUMBERS_TEXTURE, ALL_SIDES);
        llScaleTexture(0.1, 0.1, ALL_SIDES);

        // Go through each side and show a number.
        integer i;
        for (i = 0; i < llGetNumberOfSides(); i++) {
            ShowNumber(i, i);
        }
    }
}

_________________
Absurd but normal - go figure !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 3 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net