Difference between revisions of "User:Hidenori Glushenko"

From Second Life Wiki
Jump to: navigation, search
m (added SL Certification Participant/LSL Mentors category)
(Added 'Face Texture Setter' script code)
Line 6: Line 6:
  
  
== Activities ==
+
== Face Texture Setter ==
 +
You can change/toggle the texture/alpha setting on a specified face only touching on its face.
 +
 
 +
*blank texture and alpha 0%
 +
*blank texture and alpha 100%
 +
*transparent texture and alpha 0%
 +
*invisible texture and alpha 0%
 +
 
 +
NOTE : Server 1.24 or later / Viewer 1.21 or later
 +
 
 +
<lsl>
 +
/////////////////////////////////////////////////////////////////////
 +
//  iNNX SCRIPT
 +
//      xnniFaceTextureSetter
 +
//
 +
//  version
 +
string      VERSION                = "1.0";
 +
//                                  2008/08/30
 +
/////////////////////////////////////////////////////////////////////
 +
//  Copyright (c) 2008, Hidenori Glushenko
 +
//  All rights reserved.
 +
// 
 +
/////////////////////////////////////////////////////////////////////
 +
 
 +
//===================================================================
 +
//  GLOBAL VARIABLES
 +
//===================================================================
 +
list    TEXTURE_SETTINGS;
 +
 
 +
//===================================================================
 +
//  LOCAL FUNCTIONS
 +
//===================================================================
 +
init() {
 +
    integer i;
 +
    integer max = 9;
 +
    TEXTURE_SETTINGS    = [];
 +
    for ( i = 0; i < max; ++i ) {
 +
        TEXTURE_SETTINGS += 0;
 +
        TEXTURE_SETTINGS += llGetTexture( i );
 +
        TEXTURE_SETTINGS += llGetAlpha( i );
 +
    } 
 +
}
 +
 
 +
//===================================================================
 +
//  MAIN PROCEDURE
 +
//===================================================================
 +
default {
 +
    state_entry() {
 +
        init();
 +
    }
 +
   
 +
    touch_start(integer total_number) {
 +
        //  only owner
 +
        if ( llDetectedKey( 0 ) != llGetOwner() ) {
 +
            return;
 +
        }
 +
       
 +
        integer face    = llDetectedTouchFace( 0 );
 +
        integer setting = llList2Integer( TEXTURE_SETTINGS, face * 3 );
 +
       
 +
        ++setting;
 +
        if ( setting > 4 ) {
 +
            setting = 0;   
 +
        }
 +
       
 +
        if ( setting == 0 ) {
 +
            //  original texture and alpha
 +
            llOwnerSay( "face " + (string)face + ": set to original texture and alpha." );
 +
            llSetTexture( llList2Key( TEXTURE_SETTINGS, face * 3 + 1 ), face );
 +
            llSetAlpha( llList2Float( TEXTURE_SETTINGS, face * 3 + 2 ), face );
 +
        } else if ( setting == 1 ) {
 +
            //  set alpha 0% & blank texture
 +
            llOwnerSay( "face " + (string)face + ": set to blank texture and alpha 0%." );
 +
            llSetTexture( TEXTURE_BLANK , face );
 +
            llSetAlpha( 1.0, face );
 +
        } else if ( setting == 2 ) {
 +
            //  set alpha 100% & blank texture
 +
            llOwnerSay( "face " + (string)face + ": set to blank texture and alpha 100%." );
 +
            llSetTexture( TEXTURE_BLANK , face );
 +
            llSetAlpha( 0.0, face );
 +
        } else if ( setting == 3 ) {
 +
            //  set alpha 0% & transparent texture
 +
            llOwnerSay( "face " + (string)face + ": set to transparent texture and alpha 0%." );
 +
            llSetTexture( TEXTURE_TRANSPARENT , face );
 +
            llSetAlpha( 1.0, face );
 +
        } else if ( setting == 4 ) {
 +
            //  set alpha 0% & invisible texture
 +
            llOwnerSay( "face " + (string)face + ": set to invisible texture and alpha 0%." );
 +
            llSetTexture( "e97cf410-8e61-7005-ec06-629eba4cd1fb" , face );
 +
            llSetAlpha( 1.0, face );       
 +
        }
 +
       
 +
        TEXTURE_SETTINGS = llListReplaceList( TEXTURE_SETTINGS, [ setting ], face * 3, face * 3 );
 +
    }
 +
}
 +
</lsl>
 +
 
 +
== Other Activities ==
  
 
* We've opened 'Scripters Cafe' in Second Life. Many scripters come and talk together.
 
* We've opened 'Scripters Cafe' in Second Life. Many scripters come and talk together.

Revision as of 16:39, 29 August 2008

About Hidenori Glushenko

  • Nationality: Japan
  • Gender: male
  • Playing since: 11/09/2006


Face Texture Setter

You can change/toggle the texture/alpha setting on a specified face only touching on its face.

  • blank texture and alpha 0%
  • blank texture and alpha 100%
  • transparent texture and alpha 0%
  • invisible texture and alpha 0%

NOTE : Server 1.24 or later / Viewer 1.21 or later

<lsl> ///////////////////////////////////////////////////////////////////// // iNNX SCRIPT // xnniFaceTextureSetter // // version string VERSION = "1.0"; // 2008/08/30 ///////////////////////////////////////////////////////////////////// // Copyright (c) 2008, Hidenori Glushenko // All rights reserved. // /////////////////////////////////////////////////////////////////////

//=================================================================== // GLOBAL VARIABLES //=================================================================== list TEXTURE_SETTINGS;

//=================================================================== // LOCAL FUNCTIONS //=================================================================== init() {

   integer i;
   integer max = 9;
   TEXTURE_SETTINGS    = [];
   for ( i = 0; i < max; ++i ) {
       TEXTURE_SETTINGS += 0;
       TEXTURE_SETTINGS += llGetTexture( i );
       TEXTURE_SETTINGS += llGetAlpha( i );
   }   

}

//=================================================================== // MAIN PROCEDURE //=================================================================== default {

   state_entry() {
       init();
   }
   
   touch_start(integer total_number) {
       //  only owner
       if ( llDetectedKey( 0 ) != llGetOwner() ) {
           return; 
       }
       
       integer face    = llDetectedTouchFace( 0 );
       integer setting = llList2Integer( TEXTURE_SETTINGS, face * 3 );
       
       ++setting;
       if ( setting > 4 ) {
           setting = 0;    
       }
       
       if ( setting == 0 ) {
           //  original texture and alpha
           llOwnerSay( "face " + (string)face + ": set to original texture and alpha." );
           llSetTexture( llList2Key( TEXTURE_SETTINGS, face * 3 + 1 ), face );
           llSetAlpha( llList2Float( TEXTURE_SETTINGS, face * 3 + 2 ), face );
       } else if ( setting == 1 ) {
           //  set alpha 0% & blank texture
           llOwnerSay( "face " + (string)face + ": set to blank texture and alpha 0%." );
           llSetTexture( TEXTURE_BLANK , face );
           llSetAlpha( 1.0, face );
       } else if ( setting == 2 ) {
           //  set alpha 100% & blank texture
           llOwnerSay( "face " + (string)face + ": set to blank texture and alpha 100%." );
           llSetTexture( TEXTURE_BLANK , face );
           llSetAlpha( 0.0, face );
       } else if ( setting == 3 ) {
           //  set alpha 0% & transparent texture
           llOwnerSay( "face " + (string)face + ": set to transparent texture and alpha 0%." );
           llSetTexture( TEXTURE_TRANSPARENT , face );
           llSetAlpha( 1.0, face );
       } else if ( setting == 4 ) {
           //  set alpha 0% & invisible texture
           llOwnerSay( "face " + (string)face + ": set to invisible texture and alpha 0%." );
           llSetTexture( "e97cf410-8e61-7005-ec06-629eba4cd1fb" , face );
           llSetAlpha( 1.0, face );        
       }
       
       TEXTURE_SETTINGS = llListReplaceList( TEXTURE_SETTINGS, [ setting ], face * 3, face * 3 );
   }

} </lsl>

Other Activities