Jump to content
You are about to reply to a thread that has been inactive for 4161 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Posted

Platonic Generator is a tool to tessellatethe five platonic objects; Tetrahedron, Hexahedron, Octahedron, Icosahedron and Dodecahedron. This is a new version able of create bigger structures due the new limit of 64 m and other minor changes.

 

  • The first step is to create two primitives and link in one object and drop inside this script.
// This script create the object "Platonic Generator 0.4.7" and autodelete.
// Put this in the inventory of a linset with 2 prims.

default {
    state_entry() {
        
        if (llGetNumberOfPrims() != 2) {
            llOwnerSay("ERROR: The linkset must be of 2 prims");
            return;
        } // if
        
        llSetLinkPrimitiveParamsFast(
            LINK_THIS, [ 
                PRIM_NAME, "Platonic Generator 0.4.7",
                PRIM_TYPE, PRIM_TYPE_SCULPT, "71eeddee-a441-eace-6b2d-e3180dbb082a", PRIM_SCULPT_TYPE_PLANE, 
                PRIM_SIZE, <0.9, 0.9, 0.9>,
                PRIM_MATERIAL, PRIM_MATERIAL_METAL,
                PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1.0, 1.0, 0.0>, ZERO_VECTOR, PI_BY_TWO,
                PRIM_COLOR, ALL_SIDES, <0.6, 0.6, 0.6>, 1.0,
                PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_MEDIUM, PRIM_BUMP_NONE ]);
        
        
        llSetLinkPrimitiveParamsFast(
            LINK_ALL_CHILDREN, [ 
                PRIM_TYPE, PRIM_TYPE_SPHERE, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, ZERO_VECTOR, <0.0, 1.0, 0.0>,
                PRIM_SIZE, <1.1, 1.1, 1.1>,
                PRIM_POS_LOCAL, ZERO_VECTOR,
                PRIM_ROT_LOCAL, llEuler2Rot(<0.0, 90.0, 0.0> * DEG_TO_RAD),
                PRIM_MATERIAL, PRIM_MATERIAL_GLASS,
                PRIM_TEXTURE, ALL_SIDES, "990d1249-0b61-13bc-9a0c-cbad5f120aed", <1.0, 1.0, 0.0>, ZERO_VECTOR, -PI_BY_TWO,
                PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.6,
                PRIM_FULLBRIGHT, ALL_SIDES, TRUE,
                PRIM_GLOW, ALL_SIDES, 0.05]);
        
        llSetLinkTextureAnim(LINK_ALL_CHILDREN, ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 1, 1, 1.0, 1, 0.02);
        
        llRemoveInventory(llGetScriptName());
        
    } // state_entry
    
    changed(integer change) {
        
        if ((change & CHANGED_LINK) == CHANGED_LINK) {
            llResetScript();
        } // if
        
    } // changed
    
} // default

    Now you have a nice object but useless. 

 

  • Second step. Now, create other object and drop this other script inside.
string MSG_DELETE = "delete";
string MSG_PURGE = "purge";
string MSG_OK = "OK";
string MSG_NEXT = "NEXT";
string MSG_NODE_SIZE = "node_size";
string MSG_EDGE_THICKNESS = "edge_thickness";
string MSG_TRIANGLE_THICK = "triangle_thickness";

vector AXIS_UP = <0,0,1>;

// Constants for piece types.
string PRIM_TYPE_NODE = "NODE";
string PRIM_TYPE_EDGE = "EDGE";
string PRIM_TYPE_TRIANGLE = "TRIANGLE";
string PRIM_TYPE_RECTANGLE = "RECTANGLE";


string TRIANGLE_TEXTURE = "1f93926c-966d-9cb3-126c-1341b71a457d";
string CLEAR_TEXTURE = "f54a0c32-3cd1-d49a-5b4f-7b792bebc204";

float TIMEOUT = 3.0;

integer g_iListenDesc;
integer g_iChannel;
string g_sPieceType;
key g_kRezzerKey;

//
//     Protocol   Anti-Fail
//
//  1  Rezzer    -------------- rez --------------->    Object
//  2  Rezzer    <---------- whisper "OK" ----------    Object
//  3  Rezzer    ------- whisper parameters ------->    Object
//  4  Rezzer    <--------  shout "NEXT" -----------    Object
//
//   If object no receive parameters in TIMEOUT seconds, say again "OK"
//   If object no receive NEXT in TIMEOUT seconds, check object position, 
//   it is in the same position, whisper again parameters, else, rez the 
//   next object.

executeMessage(string message) {
    
    vector start_pos = llGetPos();
        
    list lTok = llParseString2List(message, ["|"], []);
    g_sPieceType = llList2String(lTok, 0);
        
    if (g_sPieceType == PRIM_TYPE_NODE) {
        
        vector target_pos = (vector) llList2String(lTok, 1);
        float fSize = (float) llList2String(lTok, 2);
        integer iNumNode = (integer) llList2String(lTok, 3);
        
        llSetRegionPos(target_pos);
        llSetLinkPrimitiveParamsFast(LINK_THIS, 
            [
                PRIM_POSITION, target_pos, 
                PRIM_SIZE, <fSize, fSize, fSize>,
                PRIM_TYPE, 
                    PRIM_TYPE_SPHERE, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, ZERO_VECTOR, <0.0, 1.0, 0.0>,
                PRIM_NAME, g_sPieceType
            ]);
        
        if (iNumNode >= 0) {
            llSetText((string) iNumNode, <1.0, 1.0, 1.0>, 1.0);
        } // if
            
    } else if (g_sPieceType == PRIM_TYPE_EDGE) {
            
        vector v1 = (vector) llList2String(lTok, 1);
        vector v2 = (vector) llList2String(lTok, 2);
        float thickness = (float) llList2String(lTok, 3);
        
        vector target_pos = (v2 + v1) / 2;
    
        llSetRegionPos(target_pos);
        llSetLinkPrimitiveParamsFast(LINK_THIS, 
            [
                PRIM_POSITION, target_pos,
                PRIM_ROTATION, llGetRot() * llRotBetween(AXIS_UP * llGetRot(), v2 - v1),
                PRIM_SIZE, <thickness, thickness, llVecDist(v2, v1)>,
                PRIM_TYPE, 
                    PRIM_TYPE_CYLINDER, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, ZERO_VECTOR, <1.0, 1.0, 0.0>, ZERO_VECTOR,
                PRIM_NAME, g_sPieceType
            ]);
            
    } else if (g_sPieceType == PRIM_TYPE_TRIANGLE) {
            
        vector scale = (vector) llList2String(lTok, 1);
        float y_shear = (float) llList2String(lTok, 2);
        vector target_pos = (vector) llList2String(lTok, 3);
        rotation rRot = (rotation) llList2String(lTok, 4);
        
        llSetRegionPos(target_pos);
        llSetLinkPrimitiveParamsFast(LINK_THIS, 
            [
                PRIM_POSITION, target_pos,
                PRIM_TYPE, 
                    PRIM_TYPE_BOX, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.0, 0.0>, <0.0, y_shear, 0.0>, 
                PRIM_SIZE, scale,
                PRIM_ROTATION, rRot,
                PRIM_NAME, g_sPieceType,
                PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.5,
                PRIM_TEXTURE, 0, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 1, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 2, TRIANGLE_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 3, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 4, TRIANGLE_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 5, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0
        ]);
            
    } else if (g_sPieceType == PRIM_TYPE_RECTANGLE) {
            
        vector scale = (vector) llList2String(lTok, 1);
        float y_tape = 1.0 - (float) llList2String(lTok, 2);
        float y_shear = (float) llList2String(lTok, 3);
        vector target_pos = (vector) llList2String(lTok, 4);
        rotation rRot = (rotation) llList2String(lTok, 5);
        
        llSetRegionPos(target_pos);
        llSetLinkPrimitiveParamsFast(LINK_THIS, 
            [
                PRIM_POSITION, target_pos,
                PRIM_TYPE, 
                    PRIM_TYPE_BOX, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, y_tape, 0.0>, <0.0, y_shear, 0.0>, 
                PRIM_SIZE, scale,
                PRIM_ROTATION, rRot,
                PRIM_NAME, g_sPieceType,
                PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.5,
                PRIM_TEXTURE, 0, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 1, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 2, TRIANGLE_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 3, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 4, TRIANGLE_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
                PRIM_TEXTURE, 5, CLEAR_TEXTURE, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0
        ]);
            
    } // if
    
    
} // executeMessage


default {
    
    state_entry() {
        
        llSetText("", ZERO_VECTOR, 0.0);
        
        llSetLinkPrimitiveParamsFast(LINK_THIS, 
            [
                PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, ZERO_VECTOR, <1.0, 1.0, 0.0>, ZERO_VECTOR, 
                PRIM_SIZE, <0.5, 0.5, 0.5>,
                PRIM_ROTATION, ZERO_ROTATION,
                PRIM_NAME, "Object",
                PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,
                PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0
        ]);
        
        
    } // state_entry
    
    state_exit() {
        
        llSetTimerEvent(0.0);
        llListenRemove(g_iListenDesc);
        
    } // state_exit

    on_rez(integer start_param) {
        
        g_iChannel = start_param;
        
        g_iListenDesc = llListen(g_iChannel, "", NULL_KEY, "");
        if (g_iChannel != 0) {
            llSetTimerEvent(TIMEOUT);
            llWhisper(g_iChannel, MSG_OK);
        } // if
        
    } // on_rez
    
    listen(integer channel, string name, key id, string message) {

        if (llGetOwnerKey(id) != llGetOwner()) {
            return;
        } // if
                
        if ((id == llGetKey()) || (channel == 0)) {
            return;
        } // if
        
        llSetTimerEvent(0.0);
        
        g_kRezzerKey = id;
        llWhisper(channel, MSG_NEXT);
        executeMessage(message);
        
        state InPos;
                
    } // listen
    
    timer() {
        
        llWhisper(g_iChannel, MSG_OK);
        
    } // timer
    
} // default

state InPos {
    
    state_entry() {
        
        llListen(g_iChannel, "", g_kRezzerKey, "");
    
    } // state_entry
    
    listen(integer channel, string name, key id, string message) {

        if (llGetOwnerKey(id) != llGetOwner()) {
            return;
        } // if
                
        if ((id == llGetKey()) || (channel == 0)) {
            return;
        } // if

        list lTok = llParseString2List(message, ["|"], []);
        string sMsg = llList2String(lTok, 0);
        
        if (sMsg == MSG_DELETE) {
            
            llDie();
            
        } else if (sMsg == MSG_PURGE) {
            
            llRemoveInventory(llGetScriptName());
            
        } else if ((sMsg == MSG_NODE_SIZE) && (g_sPieceType == PRIM_TYPE_NODE)) {
            
            float fSize = (float) llList2String(lTok, 1);
            llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_SIZE, <fSize, fSize, fSize>]);
            
        } else if ((sMsg == MSG_EDGE_THICKNESS) && (g_sPieceType == PRIM_TYPE_EDGE)) {
            
            vector vSize = llGetScale();
            float fSize = (float) llList2String(lTok, 1);
            llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_SIZE, <fSize, fSize, vSize.z>]);
            
        } else if ((sMsg == MSG_TRIANGLE_THICK) && (g_sPieceType == PRIM_TYPE_TRIANGLE)) {
            
            vector vSize = llGetScale();
            float fSize = (float) llList2String(lTok, 1);
            llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_SIZE, <fSize, vSize.y, vSize.z>]);
            
        } else if ((sMsg == MSG_TRIANGLE_THICK) && (g_sPieceType == PRIM_TYPE_RECTANGLE)) {

            vector vSize = llGetScale();
            float fSize = (float) llList2String(lTok, 1);
            llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_SIZE, <fSize, vSize.y, vSize.z>]);
                        
        } // if
                
    } // listen
    
} // InPos

Now you have an object with name "Object". Please, do not change the name.

 

  • Third step. Take the object with name "Object" and put in the inventory of the first object with name "Platonic Generator 0.4.7".

 

  • Fourth step. Drop in the Platonic Generator this script:
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/                                                                          _/_/
//_/_/                          PLATONIC GENERATOR                              _/_/
//_/_/                         By: JJValero Writer                              _/_/
//_/_/                                                                          _/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/
//_/_/     CONSTANTS

float GOLDEN = 1.618;          // NO CHANGE THIS VALUE. http://www.mathopenref.com/rectanglegolden.html

float EDGE_SIDE = 3.0;         // Default length of edge. (min = 1, max = 10)
float MAX_EDGE_SIDE = 35.0;
float MIN_EDGE_SIDE = 1.0;

float EDGE_THICKNESS = 0.3;    // default thickness of edge 0 = OFF
float MAX_EDGE_THICK = 3.0;
float MIN_EDGE_THICK = 0.0;

float NODE_SIZE = 0.4;         // default size of node.
float MAX_NODE_SIZE = 3.0;
float MIN_NODE_SIZE = 0.0;

float TRIANGLE_THICKNESS = 0.03; // default thickness of triangle 0 = OFF
float MAX_TRIANGLE_THICK = 1.0;
float MIN_TRIANGLE_THICK = 0.0;

string OBJECT_TO_REZ = "Object";

integer CHANNEL = -884726;     // channel for comunicate position to edges.
integer USER_CHANNEL = 5;      // user channel.

integer DEVELOP_MODE = FALSE;  // If TRUE, spheres shows the node number in floating text.

//-----------------------------------
// Structures supported.

string STRUCT_TETRAHEDRON = "Tetrahedron";
string STRUCT_HEXAHEDRON = "Hexahedron";
string STRUCT_OCTAHEDRON = "Octahedron";
string STRUCT_ICOSAHEDRON = "Icosahedron";
string STRUCT_DODECAHEDRON = "Dodecahedron";


string TETRAHEDRON_SCULPT = "1646063c-baf9-fb2e-fc2b-c74b992f178e";
string HEXAHEDRON_SCULPT = "3496f3c6-3b09-c052-fe00-59235dc57ddf";
string OCTAHEDRON_SCULPT = "5cce4c13-ba04-deba-aa93-e7b197e35670";
string ICOSAHEDRON_SCULPT = "71eeddee-a441-eace-6b2d-e3180dbb082a";
string DODECAHEDRON_SCULPT = "8bbe9747-8d89-a339-671d-09df4f664065";

// If you change one of those constants, check scripts of node and edge objects.
// ............................................................................... 
// chat commands
string MSG_DELETE = "delete";
string MSG_PURGE = "purge";
string MSG_REZ = "rez";
string MSG_HELP = "help";
string MSG_MENU = "menu";


string MSG_OK = "OK";         // The object says OK when it is rezzed.
string MSG_NEXT = "NEXT";     // The object says NEXT when received parameters.
string MSG_NODE_SIZE = "node_size";  // Says to nodes their new size.
string MSG_EDGE_THICKNESS = "edge_thickness"; // Says to edges their new thickness.
string MSG_TRIANGLE_THICK = "triangle_thickness"; // Says to triangles their new thickness.

// ...............................................................................

string PRIM_TYPE_NODE = "NODE";
string PRIM_TYPE_EDGE = "EDGE";
string PRIM_TYPE_TRIANGLE = "TRIANGLE";
string PRIM_TYPE_RECTANGLE = "RECTANGLE";

// ............................................................................... 

// Main Menu options
string OPC_DELETE = "Delete";
string OPC_PURGE = "Purge";
string OPC_REZ = "Rez";
string OPC_STRUCT = "Struct";
string OPC_SIZE = "Size";
string OPC_EDGE_THICK = "Edge Thick";
string OPC_NODE_SIZE = "Node Size";
string OPC_TRIANGLE_THICK = "Tr. Thick";
string OPC_RETURN = "Return";
string OPC_DONE = "Done";
string OPC_VERBOSE = "Verbose";
string OPC_QUIET = "Quiet";

// Size options
string OPC_SIZEP1 = "+1";
string OPC_SIZEL1 = "-1";
string OPC_SIZEP05 = "+0.5";
string OPC_SIZEL05 = "-0.5";
string OPC_SIZEP01 = "+0.1";
string OPC_SIZEL01 = "-0.1";
string OPC_SIZEP005 = "+0.05";
string OPC_SIZEL005 = "-0.05";
string OPC_SIZEP001 = "+0.01";
string OPC_SIZEL001 = "-0.01";
string OPC_MAX = "Max";
string OPC_MIN = "Min";
string OPC_OFF = "Off";

// Triangle Stuff
//float DELTA = 0.01;          // Minimal distance between 2 vertices.
float TIMEOUT = 6.0;

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/
//_/_/   GLOBALS

list g_lRelPos;              // Position of all nodes
list g_lConnectList;         // pair of node numbers, every pair is one edge.
list g_lTriangleList;        // List os triangle nodes
list g_lRectangleList;       // List of rectangles


integer g_iListenDesc;       // listen descriptor of user channel.
integer g_iUserListenDesc;   // listen descriptor of build channel.
integer g_iCounter;
integer g_iMax;
vector g_vSavedPos;
integer g_bVerbose;

string g_sActualMenu;

string g_sActualStruct;     // structure to rez
float g_fEdgeLength;        // Length of the edge. (Max is 10 m)
float g_fEdgeThick;         // Thickness of edge.
float g_fNodeSize;          // Size of the node.
float g_fTriangleDepth;     // thickness of triangles rezzed


string g_sObjectParams;    // Parameters to send to object.


//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/
//_/_/   FUNCTIONS

// List of coordinates taken from http://en.wikipedia.org/wiki/Icosahedron
list getNodeList(float fSize) {
    
    float A = fSize / 2;
    float B = (fSize * GOLDEN) / 2;
    float C = (fSize * (1.0 / GOLDEN)) / 2;
        
    list lRelPos = [];
    
    if (g_sActualStruct == STRUCT_ICOSAHEDRON) {
        
        lRelPos = [
            <0, A, B>,   <0, A, -B>,   <0, -A, B>,   <0, -A, -B>,
            <A, B, 0>,   <A, -B, 0>,   <-A, B, 0>,   <-A, -B, 0>,
            <B, 0, A>,   <-B, 0, A>,   <B, 0, -A>,   <-B, 0, -A>
            ];
        
    } else if (g_sActualStruct == STRUCT_DODECAHEDRON) {
        
        lRelPos = [
            <-A, -A, -A>, <-A, -A,  A>,  <-A,  A, -A>,  <-A,  A,  A>, 
            < A, -A, -A>, < A, -A,  A>,  < A,  A, -A>,  < A,  A,  A>,
            < 0,  C,  B>, < 0,  C, -B>,  < 0, -C,  B>,  < 0, -C, -B>,
            < C,  B,  0>, < C, -B,  0>,  <-C,  B,  0>,  <-C, -B,  0>,
            < B,  0,  C>, < B,  0, -C>,  <-B,  0,  C>,  <-B,  0, -C>
            ];

    } else if (g_sActualStruct == STRUCT_TETRAHEDRON) {
        
        lRelPos = [<A, A, A>, <-A, -A, A>, <-A, A, -A>, <A, -A, -A>];
        
    } else if (g_sActualStruct == STRUCT_HEXAHEDRON) {

        lRelPos = [
            <A, A, A>, <A, A, -A>, <A, -A, A>, <A, -A, -A>,
            <-A, A, A>, <-A, A, -A>, <-A, -A, A>, <-A, -A, -A>
        ];
                
    } else if (g_sActualStruct == STRUCT_OCTAHEDRON) {

        lRelPos = [<A, 0, 0>, <-A, 0, 0>, <0, A, 0>, <0, -A, 0>, <0, 0, A>, <0, 0, -A>];
                
    } // if

    return lRelPos;
    
} // getNodeList

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

list getConnectList() {

    list lConnectList = [];
    
    if (g_sActualStruct == STRUCT_ICOSAHEDRON) {
        
        lConnectList = [ 
            0, 2, 0, 9, 0, 6, 0, 4, 0, 8, 1, 6, 1, 11, 1, 3, 1, 10, 1, 4,
            6, 4, 6, 9, 6, 11, 4, 8, 4, 10, 10, 3, 3, 11, 11, 9, 9, 2, 2, 8,
            8, 10, 5, 3, 5, 10, 5, 8, 5, 2, 5, 7, 7, 2, 7, 9, 7, 11, 7, 3 
            ];
    
    } else if (g_sActualStruct == STRUCT_DODECAHEDRON) {

        lConnectList = [ 
            0, 19, 0, 15, 0, 11, 2, 19, 2, 9, 2, 14, 9, 11, 9, 6, 19, 18, 18, 3, 3, 14,
            6, 12, 12, 14, 6, 17, 17, 4, 4, 11, 4, 13, 13, 15, 18, 1, 1, 15, 13, 5, 5, 16,
            16, 17, 1, 10, 10, 5, 10, 8, 8, 3, 8, 7, 7, 16, 7, 12    
            ];

    } else if (g_sActualStruct == STRUCT_TETRAHEDRON) {
        
        lConnectList = [ 0, 1, 0, 2, 0, 3, 1, 2, 1, 3, 2, 3 ];
        
    } else if (g_sActualStruct == STRUCT_HEXAHEDRON) {
        
        lConnectList = [ 
            0, 1, 1, 3, 3, 2, 2, 0, 
            4, 5, 5, 7, 7, 6, 6, 4,
            0, 4, 2, 6, 1, 5, 3, 7
        ];
        
    } else if (g_sActualStruct == STRUCT_OCTAHEDRON) {
        
        lConnectList = [ 
            4, 0, 4, 1, 4, 2, 4, 3,
            5, 0, 5, 1, 5, 2, 5, 3, 
            0, 2, 2, 1, 1, 3, 3, 0
        ];
        
    } // if
        
    return lConnectList;

} // getConnectList

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

list getTriangleList() {

    list lConnectList = [];
    
    if (g_sActualStruct == STRUCT_ICOSAHEDRON) {
        
        lConnectList = [ 
            0, 4, 6, 0, 6, 9, 0, 8, 4, 0, 8, 2, 0, 2, 9,
            3, 7, 5, 3, 5, 10, 3, 10, 1, 3, 1, 11, 3, 11, 7,
            1, 6, 11, 6, 11, 9, 11, 9, 7, 9, 7, 2, 7, 2, 5, 2, 5, 8, 5, 8, 10, 8, 10, 4, 10, 4, 1, 4, 1, 6
            ];
    
    } else if (g_sActualStruct == STRUCT_DODECAHEDRON) {

        lConnectList = [
            17, 4, 6, 19, 0, 2, 9, 6, 2, 11, 0, 4, 4, 13, 17, 6, 17, 12,
             0, 19, 15, 14, 2, 19, 18, 1, 3, 8, 10, 7, 10, 1, 5, 8, 7, 3
            ];

    } else if (g_sActualStruct == STRUCT_TETRAHEDRON) {
        
        lConnectList = [ 0, 1, 2, 0, 2, 3, 0, 1, 3, 1, 3, 2 ];
        
    } else if (g_sActualStruct == STRUCT_OCTAHEDRON) {
        
        lConnectList = [ 
            4, 0, 2, 4, 2, 1, 4, 1, 3, 4, 3, 0,
            5, 0, 2, 5, 2, 1, 5, 1, 3, 5, 3, 0
        ];
        
    } // if
        
    return lConnectList;

} // getTriangleList

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

list getRectangleList() {

    list lConnectList = [];
    
    if (g_sActualStruct == STRUCT_DODECAHEDRON) {

        lConnectList = [
            4, 6, 11, 9, 2, 0, 9, 11, 6, 2, 12, 14, 0, 4, 15, 13,
            14, 19, 3, 18, 19, 15, 18, 1, 13, 17, 5, 16, 17, 12, 16, 7, 
            7, 3, 12, 14, 1, 5, 15, 13, 10, 7, 5, 16, 3, 1, 8, 10
            ];
        
    } else if (g_sActualStruct == STRUCT_HEXAHEDRON) {
        
        lConnectList = [ 
            1, 3, 0, 2, 3, 7, 2, 6, 7, 5, 6, 4, 
            5, 1, 4, 0, 5, 1, 7, 3, 4, 0, 6, 2
            ];
        
    } // if
        
    return lConnectList;

} // getRectangleList

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

string decimalTrunc(float fIn) {
    
    float fIn = (float)((string) fIn);
    integer iIn = (integer) (fIn * 100);
    
    integer iIntPart = iIn / 100;
    integer iDecimal = iIn % 100;
    
    string sDecimal;
    if (iDecimal < 10) {
        sDecimal = "0" + (string) iDecimal;
    } else {
        sDecimal = (string) iDecimal;
    } // if
    
    string sOut = (string) iIntPart + "." + sDecimal;
    if (sOut == "0.00") {
        sOut = "Off";
    } // if
    
    return sOut;
    
} // decimalTrunc
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


showConfig() {
    
    string sMsg = "Selected: " + g_sActualStruct + "\n";
    
    sMsg += "Size: " + decimalTrunc(g_fEdgeLength) + "\n";
    sMsg += "Edge thickness: " + decimalTrunc(g_fEdgeThick) + "\n";
    sMsg += "Node Size: " + decimalTrunc(g_fNodeSize) + "\n";
    sMsg += "Triangle thickness: " + decimalTrunc(g_fTriangleDepth) + "\n";
        
    llSetText(sMsg, <1.0, 1.0, 1.0>, 1.0);
    
} // showConfig

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

// safe_posJum, do not work in various regions.
// Changed by a combination of llSetRegionPos and llSetLinkPrimitiveParamsFast.
safe_posJump(vector target_pos) {
    
    llSetRegionPos(target_pos);
    llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, target_pos]);
        
} // safe_posJump

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

showHelp() {
    
    string sChan = "\t/" + (string) USER_CHANNEL + " ";
    
    string sMsg = "\n";
    sMsg += sChan + MSG_HELP + "\tshows this message.\n";
    sMsg += sChan + MSG_REZ + "\tfor rez " + g_sActualStruct + ".\n";
    sMsg += sChan + MSG_DELETE + "\tfor delete " + g_sActualStruct + ".\n";
    sMsg += sChan + MSG_PURGE + "\tfor remove scripts.\n";
    sMsg += sChan + MSG_MENU + "\tshows main menu.";
    
    llOwnerSay(sMsg);
    
} // showHelp

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

mainMenu(key kUser) {
    
    list lOptions = [ OPC_DONE, "." ];
    
    if (g_bVerbose) {
        lOptions += [ OPC_QUIET ];
    } else {
        lOptions += [ OPC_VERBOSE ];
    } // if
        
    lOptions += [
        OPC_DELETE, OPC_PURGE, OPC_REZ, 
        OPC_EDGE_THICK, OPC_NODE_SIZE, OPC_TRIANGLE_THICK, 
        OPC_STRUCT, OPC_SIZE, "."
        ];
    
    g_sActualMenu = "";
    
    string sMsg = "Options\n";
    sMsg += " " + OPC_DONE   + ":\t  Close this dialog box.\n";
    
    if (g_bVerbose) {
        sMsg += " " + OPC_QUIET   + ":\t Quiet mode.\n";
    } else {
        sMsg += " " + OPC_VERBOSE   + ":   Verbose mode.\n";
    } // if
    
    sMsg += " " + OPC_DELETE   + ":\tDelete the structure.\n";
    sMsg += " " + OPC_PURGE   + ":\t  Remove scripts from objects.\n";
    sMsg += " " + OPC_REZ + ":\t\t Rez the structure.\n";
    sMsg += " " + OPC_STRUCT + ":\tSelect structure.\n";
    sMsg += " " + OPC_SIZE + ":\t\tChanges size.\n";
    sMsg += " " + OPC_EDGE_THICK + ":\tChanges thickness of edge.\n";
    sMsg += " " + OPC_NODE_SIZE + ":\tChanges node size.\n";
    sMsg += " " + OPC_TRIANGLE_THICK + ":\tChanges thickness of triangle.\n";

    llDialog(kUser,sMsg, lOptions, USER_CHANNEL);
    
} // mainMenu

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

structMenu(key kUser) {
    
    list lOptions = [ 
        OPC_RETURN, ".", OPC_DONE,
        STRUCT_ICOSAHEDRON, STRUCT_DODECAHEDRON, STRUCT_TETRAHEDRON, 
        STRUCT_HEXAHEDRON, STRUCT_OCTAHEDRON
    ];
    
    string sMsg = "Options\n";
    sMsg += "Structure selected: " + g_sActualStruct + "\n\n"; 
    sMsg += " Select one of the listed structures.";

    llDialog(kUser,sMsg, lOptions, USER_CHANNEL);
    
} // structMenu

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

sizeMenu(key kUser) {
    
    g_sActualMenu = OPC_SIZE;
    
    list lOptions = [ 
        OPC_RETURN, ".", OPC_DONE,
        OPC_SIZEL1, OPC_SIZEL05, OPC_SIZEL01, 
        OPC_SIZEP1, OPC_SIZEP05, OPC_SIZEP01,
        OPC_MAX, OPC_MIN
    ];
    
    string sMsg = "Options\n";
    sMsg += "Actual size is : " + decimalTrunc(g_fEdgeLength) + "\n\n"; 

    llDialog(kUser,sMsg, lOptions, USER_CHANNEL);
    
} // sizeMenu

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

edgeMenu(key kUser) {
    
    g_sActualMenu = OPC_EDGE_THICK;
    
    list lOptions = [ 
        OPC_RETURN, ".", OPC_DONE,
        OPC_SIZEL01, OPC_SIZEL005, OPC_SIZEL001, 
        OPC_SIZEP01, OPC_SIZEP005, OPC_SIZEP001,
        OPC_MAX, OPC_MIN, OPC_OFF
    ];
    
    string sMsg = "Options\n";
    sMsg += "Actual edge thickness is : " + decimalTrunc(g_fEdgeThick) + "\n\n"; 

    llDialog(kUser,sMsg, lOptions, USER_CHANNEL);
    
} // edgeMenu

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

nodeMenu(key kUser) {
    
    g_sActualMenu = OPC_NODE_SIZE;
    
    list lOptions = [ 
        OPC_RETURN, ".", OPC_DONE,
        OPC_SIZEL01, OPC_SIZEL005, OPC_SIZEL001, 
        OPC_SIZEP01, OPC_SIZEP005, OPC_SIZEP001,
        OPC_MAX, OPC_MIN, OPC_OFF
    ];
    
    string sMsg = "Options\n";
    sMsg += "Actual node size is : " + decimalTrunc(g_fNodeSize) + "\n\n"; 

    llDialog(kUser,sMsg, lOptions, USER_CHANNEL);
    
} // nodeMenu

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

triangleMenu(key kUser) {
    
    g_sActualMenu = OPC_TRIANGLE_THICK;
    
    list lOptions = [ 
        OPC_RETURN, ".", OPC_DONE,
        OPC_SIZEL01, OPC_SIZEL005, OPC_SIZEL001, 
        OPC_SIZEP01, OPC_SIZEP005, OPC_SIZEP001,
        OPC_MAX, OPC_MIN, OPC_OFF
    ];
    
    string sMsg = "Options\n";
    sMsg += "Actual triangle thickness is : " + decimalTrunc(g_fTriangleDepth) + "\n\n"; 

    llDialog(kUser,sMsg, lOptions, USER_CHANNEL);
    
} // triangleMenu


//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

rez_triangle(vector a, vector b, vector c) {
    
    vector origin = llGetPos();
    
    a = origin + a;
    b = origin + b;
    c = origin + c;

    float fSideAB = llVecDist(a, b);
    float fSideBC = llVecDist(b, c);
    float fSideCA = llVecDist(c, a);
    
    if ((fSideAB >= fSideBC) && (fSideAB >= fSideCA)) {
        
        triangle(c, a, b);
        
    } else if ((fSideBC >= fSideAB) && (fSideBC >= fSideCA)) {

        triangle(a, b, c);
        
    } else if ((fSideCA >= fSideAB) && (fSideCA >= fSideBC)) {
        
        triangle(b, c, a);
        
    } // if
    
} // rez_triangle
         
triangle(vector a, vector b, vector c) {

    float width = llVecDist(b, c);
    
    vector left = llVecNorm(b - c);
    vector fwd = llVecNorm(left % (a - c));
    vector up = fwd % left;
    
    float height = (a - c) * up;
    
    float fShear = 0.5 - ((b-a) * left) / width;
    vector vPos = 0.5 * ((b+c) + (height * up));
    vector vScale = <g_fTriangleDepth, width, height>;
    rotation rRot = llAxes2Rot(fwd, left, up);
    
    g_sObjectParams = PRIM_TYPE_TRIANGLE + "|" + (string) vScale + "|" + (string) fShear + 
                       "|" + (string) vPos + "|" + (string) rRot;
    
    llRezObject(OBJECT_TO_REZ, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, CHANNEL);

} // triangle

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

// "rez_triangle()" and "triangle()" functions are based in a freebie of "seifer surface"

rez_rectangle(vector a, vector b, vector c, vector d) {
    
    vector origin = llGetPos();
    
    a = origin + a;
    b = origin + b;
    c = origin + c;
    d = origin + d;

    if (llVecDist(a, b) >= llVecDist(c, d)) {
        
        rectangle(a, b, c, d);
        
    } else {
        
        rectangle(c, d, a, b);
        
    } // if
    
} // rez_rectangle

rectangle(vector a, vector b, vector c, vector d) {
    
    float width = llVecDist(a, b);
    
    vector left = llVecNorm(a - b);
    vector fwd = llVecNorm(left % (a - c));
    vector up = fwd % left;
    
    float height = (a - c) * up;
    
    float fShear = 0.0;
    vector vPos = (a + b + c+ d) / 4; //0.5 * ((b+c) + (height * up));
    vector vScale = <g_fTriangleDepth, width, height>;
    rotation rRot = llAxes2Rot(fwd, left, up);
    
    float fTape = (llVecDist(c, d) / llVecDist(a, b)) - 1.0;
    //float fTape = -0.35; //1.0;
    
    g_sObjectParams = PRIM_TYPE_RECTANGLE + "|" + (string) vScale + "|" + (string) fTape + 
                       "|" + (string) fShear + "|" + (string) vPos + "|" + (string) rRot;
    
    llRezObject(OBJECT_TO_REZ, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, CHANNEL);
    
} // rectangle

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

rez_node(vector a) {
    
    vector vNodePos = llGetPos() + a;
        
    integer iNumNode = -1;
    if (DEVELOP_MODE) {
        iNumNode = g_iCounter;
    } // if
        
    g_sObjectParams = PRIM_TYPE_NODE + "|"+ (string) vNodePos + "|" + (string) g_fNodeSize + "|" + (string) iNumNode;
    
    llRezObject(OBJECT_TO_REZ, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, CHANNEL);
    
} // rez_node

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

rez_edge(vector a, vector b) {
    
    vector origin = llGetPos();
    
    a = origin + a;
    b = origin + b;
    
    g_sObjectParams = PRIM_TYPE_EDGE + "|" + (string) a + "|" + (string) b + "|" + (string) g_fEdgeThick;
    llRezObject(OBJECT_TO_REZ, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, CHANNEL);
    
} // rez_edge

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/
//_/_/   STATES

default {
    
    state_entry() {

        // Default settings.
        g_sActualStruct = STRUCT_ICOSAHEDRON;
        g_fEdgeLength = EDGE_SIDE;
        g_fEdgeThick = EDGE_THICKNESS;
        g_fNodeSize = NODE_SIZE;
        g_fTriangleDepth = TRIANGLE_THICKNESS;
                
        g_bVerbose = FALSE;
        g_sActualMenu = "";
        
        llSetLinkPrimitiveParamsFast(
            LINK_THIS, [ 
                  PRIM_TYPE, PRIM_TYPE_SCULPT, ICOSAHEDRON_SCULPT, PRIM_SCULPT_TYPE_PLANE, 
                  PRIM_SIZE, <0.9, 0.9, 0.9>  ]);
        
        llSetLinkTextureAnim(LINK_ALL_CHILDREN, ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 1, 1, 1.0, 1, 0.02);

        llOwnerSay("Listening in channel " + (string) USER_CHANNEL + "\n");
        llOwnerSay("Say /" + (string) USER_CHANNEL + " " + MSG_HELP + " for help or touch me to dialog menu.");
        
        state UserInterface;
        
    } // state_entry
    
} // default

state UserInterface {
    
    state_entry() {
        
        g_iUserListenDesc = llListen(USER_CHANNEL, "", NULL_KEY, "");
        showConfig();
        
    } // state_entry
    
    state_exit() {
        
        llListenRemove(g_iUserListenDesc);
        
    } // state_exit
    
    on_rez(integer start_param) {
        
        llResetScript();
        
    } // on_rez
    
    touch_start(integer num_detected) {
        
        if (llDetectedKey(0) != llGetOwner()) {
            return;
        } // if
        
        mainMenu(llDetectedKey(0));        
        
    } // touch_start
    
    listen(integer channel, string name, key id, string message) {
        
        if (llGetOwnerKey(id) != llGetOwner()) {
            return;
        } // if
        
        string sMsg = llToLower(message);
        if ((sMsg == MSG_DELETE) || (sMsg == MSG_PURGE)) {
            
            llRegionSay(CHANNEL, sMsg);
            if (message != sMsg) {
                mainMenu(id);
            } // if
            
        } else if (sMsg == MSG_HELP) {
            
            showHelp();
            
        } else if (sMsg == llToLower(OPC_VERBOSE)) {
            
            g_bVerbose = TRUE;
            llOwnerSay("Verbose mode activated.");
            mainMenu(id);
            
        } else if (sMsg == llToLower(OPC_QUIET)) {
            
            g_bVerbose = FALSE;
            mainMenu(id);
            
        } else if ((sMsg == MSG_MENU) || (sMsg == llToLower(OPC_RETURN))) {
            
            mainMenu(id);
            
        } else if (sMsg == llToLower(OPC_STRUCT)) {
            
            structMenu(id);
            
        } else if (sMsg == llToLower(OPC_SIZE)) {
            
            sizeMenu(id);
            
        } else if (sMsg == llToLower(OPC_EDGE_THICK)) {
            
            edgeMenu(id);
            
        } else if (sMsg == llToLower(OPC_NODE_SIZE)) {
            
            nodeMenu(id);
            
        } else if (sMsg == llToLower(OPC_TRIANGLE_THICK)) {
            
            triangleMenu(id);

        } else if (sMsg == llToLower(STRUCT_ICOSAHEDRON)) {
            
            llSetLinkPrimitiveParamsFast(
                LINK_THIS, [ 
                  PRIM_TYPE, PRIM_TYPE_SCULPT, ICOSAHEDRON_SCULPT, PRIM_SCULPT_TYPE_PLANE, 
                  PRIM_SIZE, <0.9, 0.9, 0.9> ]);
                        
            g_sActualStruct = STRUCT_ICOSAHEDRON;
            if (g_bVerbose == TRUE) {
                llOwnerSay("Selected : " + g_sActualStruct);
            } // if
            showConfig();
            mainMenu(id);

        } else if (sMsg == llToLower(STRUCT_DODECAHEDRON)) {

            llSetLinkPrimitiveParamsFast(
                LINK_THIS, [ PRIM_TYPE, PRIM_TYPE_SCULPT, DODECAHEDRON_SCULPT, PRIM_SCULPT_TYPE_PLANE, 
                  PRIM_SIZE, <0.9, 0.9, 0.9> ]);
                
            g_sActualStruct = STRUCT_DODECAHEDRON;
            if (g_bVerbose == TRUE) {
                llOwnerSay("Selected : " + g_sActualStruct);
            } // if
            showConfig();
            mainMenu(id);
            
        } else if (sMsg == llToLower(STRUCT_TETRAHEDRON)) {

            llSetLinkPrimitiveParamsFast(
                LINK_THIS, [ PRIM_TYPE, PRIM_TYPE_SCULPT, TETRAHEDRON_SCULPT, PRIM_SCULPT_TYPE_PLANE, 
                  PRIM_SIZE, <0.8, 0.8, 0.8> ]);
                        
            g_sActualStruct = STRUCT_TETRAHEDRON;
            if (g_bVerbose == TRUE) {
                llOwnerSay("Selected : " + g_sActualStruct);
            } // if
            showConfig();
            mainMenu(id);
            
        } else if (sMsg == llToLower(STRUCT_HEXAHEDRON)) {

            llSetLinkPrimitiveParamsFast(
                LINK_THIS, 
                [ PRIM_TYPE, PRIM_TYPE_SCULPT, HEXAHEDRON_SCULPT, PRIM_SCULPT_TYPE_PLANE, 
                  PRIM_SIZE, <0.6, 0.6, 0.6> ]);
            
            g_sActualStruct = STRUCT_HEXAHEDRON;
            if (g_bVerbose == TRUE) {
                llOwnerSay("Selected : " + g_sActualStruct);
            } // if
            showConfig();
            mainMenu(id);
            
        } else if (sMsg == llToLower(STRUCT_OCTAHEDRON)) {

            llSetLinkPrimitiveParamsFast(
                LINK_THIS, [ PRIM_TYPE, PRIM_TYPE_SCULPT, OCTAHEDRON_SCULPT, PRIM_SCULPT_TYPE_PLANE, 
                  PRIM_SIZE, <1.0, 1.0, 1.0> ]);

            g_sActualStruct = STRUCT_OCTAHEDRON;
            if (g_bVerbose == TRUE) {
                llOwnerSay("Selected : " + g_sActualStruct);
            } // if
            showConfig();
            mainMenu(id);
            
        } else if ((sMsg == OPC_SIZEP1) || (sMsg == OPC_SIZEL1) || (sMsg == OPC_SIZEP05) ||
                   (sMsg == OPC_SIZEL05) || (sMsg == OPC_SIZEP01) || (sMsg == OPC_SIZEL01) ||
                   (sMsg == OPC_SIZEL005) || (sMsg == OPC_SIZEL001) || (sMsg == OPC_SIZEP005) ||
                   (sMsg == OPC_SIZEP001) ) {
                       
            float fIncr = (float) sMsg;
            float fNew = 0.0;
            
            if (g_sActualMenu == OPC_SIZE) {

                fNew = (float)((string)(g_fEdgeLength + fIncr));
                if ((fNew <= MAX_EDGE_SIDE) && (fNew >= MIN_EDGE_SIDE)) {
                    g_fEdgeLength = fNew;
                    if (g_bVerbose == TRUE) {
                        llOwnerSay("Size changed to: " + (string) g_fEdgeLength);
                    } // if
                    showConfig();
                } // if
                sizeMenu(id);
                
            } else if (g_sActualMenu == OPC_EDGE_THICK) {
                
                fNew = (float)((string)(g_fEdgeThick + fIncr));
                if ((fNew <= MAX_EDGE_THICK) && (fNew >= MIN_EDGE_THICK)) {
                    g_fEdgeThick = fNew;
                    if (g_bVerbose == TRUE) {
                        llOwnerSay("Edge thickness changed to: " + (string) g_fEdgeThick);
                    } // if
                    llRegionSay(CHANNEL, MSG_EDGE_THICKNESS + "|" + (string) g_fEdgeThick);
                    showConfig();
                } // if
                edgeMenu(id);
                
            } else if (g_sActualMenu == OPC_NODE_SIZE) {
                
                fNew = (float)((string)(g_fNodeSize + fIncr));
                if ((fNew <= MAX_NODE_SIZE) && (fNew >= MIN_NODE_SIZE)) {
                    g_fNodeSize = fNew;
                    if (g_bVerbose == TRUE) {
                        llOwnerSay("Node size changed to: " + (string) g_fNodeSize);
                    } // if
                    llRegionSay(CHANNEL, MSG_NODE_SIZE + "|" + (string) g_fNodeSize);
                    showConfig();
                } // if
                nodeMenu(id);
                
            } else if (g_sActualMenu == OPC_TRIANGLE_THICK) {
                
                fNew = (float)((string)(g_fTriangleDepth + fIncr));
                if ((fNew <= MAX_TRIANGLE_THICK) && (fNew >= MIN_TRIANGLE_THICK)) {
                    g_fTriangleDepth = fNew;
                    if (g_bVerbose == TRUE) {
                        llOwnerSay("Triangle thickness changed to: " + (string) g_fTriangleDepth);
                    } // if
                    llRegionSay(CHANNEL, MSG_TRIANGLE_THICK + "|" + (string) g_fTriangleDepth);
                    showConfig();
                } // if
                triangleMenu(id);
                
            } // if
            
        } else if (sMsg == llToLower(OPC_MAX)) {
            
            if (g_sActualMenu == OPC_SIZE) {
                
                g_fEdgeLength = MAX_EDGE_SIDE;
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Size changed to: " + (string) g_fEdgeLength);
                } // if
                showConfig();
                sizeMenu(id);
                
            } else if (g_sActualMenu == OPC_EDGE_THICK) {
                
                g_fEdgeThick = MAX_EDGE_THICK;
                if (g_bVerbose == TRUE) {
                        llOwnerSay("Edge thickness changed to: " + (string) g_fEdgeThick);
                } // if
                llRegionSay(CHANNEL, MSG_EDGE_THICKNESS + "|" + (string) g_fEdgeThick);
                showConfig();
                edgeMenu(id);
                
            } else if (g_sActualMenu == OPC_NODE_SIZE) {
                
                g_fNodeSize = MAX_NODE_SIZE;
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Node size changed to: " + (string) g_fNodeSize);
                } // if
                llRegionSay(CHANNEL, MSG_NODE_SIZE + "|" + (string) g_fNodeSize);
                showConfig();
                nodeMenu(id);
                
            } else if (g_sActualMenu == OPC_TRIANGLE_THICK) {
                
                g_fTriangleDepth = MAX_TRIANGLE_THICK;
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Triangle thickness changed to: " + (string) g_fTriangleDepth);
                } // if
                llRegionSay(CHANNEL, MSG_TRIANGLE_THICK + "|" + (string) g_fTriangleDepth);
                showConfig();
                triangleMenu(id);
                
            } // if
                        
        } else if (sMsg == llToLower(OPC_MIN)) {

            if (g_sActualMenu == OPC_SIZE) {
                
                g_fEdgeLength = MIN_EDGE_SIDE;
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Size changed to: " + (string) g_fEdgeLength);
                } // if
                showConfig();
                sizeMenu(id);
                
            } else if (g_sActualMenu == OPC_EDGE_THICK) {
                
                g_fEdgeThick = (float)((string)(MIN_EDGE_THICK + 0.01));
                if (g_bVerbose == TRUE) {
                        llOwnerSay("Edge thickness changed to: " + (string) g_fEdgeThick);
                } // if
                llRegionSay(CHANNEL, MSG_EDGE_THICKNESS + "|" + (string) g_fEdgeThick);
                showConfig();
                edgeMenu(id);
                
            } else if (g_sActualMenu == OPC_NODE_SIZE) {
                
                g_fNodeSize = (float)((string)(MIN_NODE_SIZE + 0.01));
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Node size changed to: " + (string) g_fNodeSize);
                } // if
                llRegionSay(CHANNEL, MSG_NODE_SIZE + "|" + (string) g_fNodeSize);
                showConfig();
                nodeMenu(id);
                
            } else if (g_sActualMenu == OPC_TRIANGLE_THICK) {
                
                g_fTriangleDepth = (float)((string)(MIN_TRIANGLE_THICK + 0.01));
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Triangle thickness changed to: " + (string) g_fTriangleDepth);
                } // if
                llRegionSay(CHANNEL, MSG_TRIANGLE_THICK + "|" + (string) g_fTriangleDepth);
                showConfig();
                triangleMenu(id);
                
            } // if
            
        } else if (sMsg == llToLower(OPC_OFF)) {

            if (g_sActualMenu == OPC_EDGE_THICK) {
                
                g_fEdgeThick = MIN_EDGE_THICK;
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Disabled rez edges.");
                } // if
                llRegionSay(CHANNEL, MSG_EDGE_THICKNESS + "|" + (string) g_fEdgeThick);
                showConfig();
                edgeMenu(id);
                
            } else if (g_sActualMenu == OPC_NODE_SIZE) {
                
                g_fNodeSize = MIN_NODE_SIZE;
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Disabled rez nodes.");
                } // if
                llRegionSay(CHANNEL, MSG_NODE_SIZE + "|" + (string) g_fNodeSize);
                showConfig();
                nodeMenu(id);
                
            } else if (g_sActualMenu == OPC_TRIANGLE_THICK) {
                
                g_fTriangleDepth = MIN_TRIANGLE_THICK;
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Disabled rez triangles.");
                } // if
                llRegionSay(CHANNEL, MSG_TRIANGLE_THICK + "|" + (string) g_fTriangleDepth);
                showConfig();
                triangleMenu(id);
                
            } // if
            
        } else if (sMsg == MSG_REZ) {
            
            g_vSavedPos = llGetPos();
            
            float fTrueSize = g_fEdgeLength;
            if (g_sActualStruct == STRUCT_DODECAHEDRON) {
                fTrueSize *= GOLDEN;
            } else if (g_sActualStruct == STRUCT_TETRAHEDRON) {
                fTrueSize /= llSqrt(2);
            } else if (g_sActualStruct == STRUCT_OCTAHEDRON) {
                fTrueSize *= llSqrt(2);
            } // if
            
            safe_posJump(g_vSavedPos + <0.0, 0.0, fTrueSize>);
            
            g_lRelPos = getNodeList(fTrueSize);
            g_lConnectList = getConnectList();
            g_lTriangleList = getTriangleList();
            g_lRectangleList = getRectangleList();
        
            state rezzNodes;
            
        } // if
        
    } // listen
    
} // UserInterface

state rezzNodes {
    
    state_entry() {
        
        if (g_fNodeSize > MIN_NODE_SIZE) {

            g_iMax = llGetListLength(g_lRelPos);
            g_iCounter = 0;
            
            if (g_iMax > 0) {
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Rezzing Nodes.");
                } // if
                g_iListenDesc = llListen(CHANNEL, OBJECT_TO_REZ, NULL_KEY, "");

                vector v1 = llList2Vector(g_lRelPos, g_iCounter);
                rez_node(v1);
                
            } else {
                
                state rezzEdges;
                
            } // if
            
        } else {

            state rezzEdges;

        } // if
        
    } // state_entry
        
    state_exit() {
        
        llListenRemove(g_iListenDesc);
        
    } // state_exit
        
    on_rez(integer start_param) {
        
        llResetScript();
        
    } // on_rez
        
    listen(integer channel, string name, key id, string message) {
        
        if ((llGetOwnerKey(id) != llGetOwner()) || (id == llGetKey())) {
            return;
        } // if
        
        if (message == MSG_OK) {

            llWhisper(CHANNEL, g_sObjectParams);
            
        } else if (message == MSG_NEXT) {
            
            g_iCounter ++;
            if (g_iCounter < g_iMax) {
                
                vector v1 = llList2Vector(g_lRelPos, g_iCounter);
                rez_node(v1);
                
            } else {
                state rezzEdges;
            } // if
            
        } // if
        
    } // listen
    
} // rezzNodes

state rezzEdges {

    state_entry() {
        
        if (g_fEdgeThick > MIN_EDGE_THICK) {

            g_iMax = llGetListLength(g_lConnectList);
            g_iCounter = 0;
            
            if (g_iMax >= 2) {
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Rezzing Edges.");
                } // if
                g_iListenDesc = llListen(CHANNEL, OBJECT_TO_REZ, NULL_KEY, "");
        
                vector v1 = llList2Vector(g_lRelPos, llList2Integer(g_lConnectList, g_iCounter));
                vector v2 = llList2Vector(g_lRelPos, llList2Integer(g_lConnectList, g_iCounter + 1));
                rez_edge(v1, v2);
                
            } else {
                
                state rezTriangles;
                
            } // if
            
        } else {

            state rezTriangles;

        } // if
                
    } // state_entry
        
    state_exit() {
        
        llListenRemove(g_iListenDesc);
        
    } // state_exit
        
    on_rez(integer start_param) {
        
        llResetScript();
        
    } // on_rez
        
    listen(integer channel, string name, key id, string message) {
        
        if ((llGetOwnerKey(id) != llGetOwner()) || (id == llGetKey())) {
            return;
        } // if
        
        if (message == MSG_OK) {
            
            llWhisper(CHANNEL, g_sObjectParams);
            
        } else if (message == MSG_NEXT) {
            
            g_iCounter += 2;
            if (g_iCounter < g_iMax) {
                
                vector v1 = llList2Vector(g_lRelPos, llList2Integer(g_lConnectList, g_iCounter));
                vector v2 = llList2Vector(g_lRelPos, llList2Integer(g_lConnectList, g_iCounter + 1));
                rez_edge(v1, v2);
                
            } else {
                state rezTriangles;
            } // if
            
        } // if
        
    } // listen
   
} // rezzEdges

state rezTriangles {
  
    state_entry() {
        
        if (g_fTriangleDepth > MIN_TRIANGLE_THICK) {
         
            g_iMax = llGetListLength(g_lTriangleList);
            g_iCounter = 0;
            
            if (g_iMax >= 3) {
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Rezzing Triangles.");
                } // if
                g_iListenDesc = llListen(CHANNEL, OBJECT_TO_REZ, NULL_KEY, "");
                
                vector v1 = (vector) llList2String(g_lRelPos, llList2Integer(g_lTriangleList, g_iCounter));
                vector v2 = (vector) llList2String(g_lRelPos, llList2Integer(g_lTriangleList, g_iCounter + 1));
                vector v3 = (vector) llList2String(g_lRelPos, llList2Integer(g_lTriangleList, g_iCounter + 2));
                rez_triangle(v1, v2, v3);
                
            } else {
                
                state rezRectangles;
                
            } // if
            
        } else {

            state rezRectangles;

        } // if
        
    } // state_entry
        
    state_exit() {
        
        llListenRemove(g_iListenDesc);
        
    } // state_exit
        
    on_rez(integer start_param) {
        
        llResetScript();
        
    } // on_rez
        
    listen(integer channel, string name, key id, string message) {
        
        if ((llGetOwnerKey(id) != llGetOwner()) || (id == llGetKey())) {
            return;
        } // if
        
        if (message == MSG_OK) {
            
            llWhisper(CHANNEL, g_sObjectParams);
            
        } else if (message == MSG_NEXT) {
            
            g_iCounter += 3;
            if (g_iCounter < g_iMax) {
                
                vector v1 = (vector) llList2String(g_lRelPos, llList2Integer(g_lTriangleList, g_iCounter));
                vector v2 = (vector) llList2String(g_lRelPos, llList2Integer(g_lTriangleList, g_iCounter + 1));
                vector v3 = (vector) llList2String(g_lRelPos, llList2Integer(g_lTriangleList, g_iCounter + 2));
            
                rez_triangle(v1, v2, v3);
                
            } else {
                
                state rezRectangles;
                
            } // if
            
        } // if
        
    } // listen
 
    
} // rezTriangles

state rezRectangles {
  
    state_entry() {
        
        if (g_fTriangleDepth > MIN_TRIANGLE_THICK) {
         
            g_iMax = llGetListLength(g_lRectangleList);
            g_iCounter = 0;
            
            if (g_iMax >= 4) {
                if (g_bVerbose == TRUE) {
                    llOwnerSay("Rezzing Rectangles.");
                } // if
                g_iListenDesc = llListen(CHANNEL, OBJECT_TO_REZ, NULL_KEY, "");
                
                vector v1 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter));
                vector v2 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter + 1));
                vector v3 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter + 2));
                vector v4 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter + 3));
                rez_rectangle(v1, v2, v3, v4);
                
            } else {

                state UserInterface;
                
            } // if
            
        } else {

            state UserInterface;

        } // if
        
    } // state_entry
        
    state_exit() {
        
        llListenRemove(g_iListenDesc);
        safe_posJump(g_vSavedPos);
        llOwnerSay("Done!");
        
    } // state_exit
        
    on_rez(integer start_param) {
        
        llResetScript();
        
    } // on_rez
        
    listen(integer channel, string name, key id, string message) {
        
        if ((llGetOwnerKey(id) != llGetOwner()) || (id == llGetKey())) {
            return;
        } // if

        if (message == MSG_OK) {
            
            llWhisper(CHANNEL, g_sObjectParams);
            
        } else if (message == MSG_NEXT) {
            
            g_iCounter += 4;
            if (g_iCounter < g_iMax) {
                
                vector v1 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter));
                vector v2 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter + 1));
                vector v3 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter + 2));
                vector v4 = (vector) llList2String(g_lRelPos, llList2Integer(g_lRectangleList, g_iCounter + 3));
            
                rez_rectangle(v1, v2, v3, v4);
                
            } else {
                
                state UserInterface;
                
            } // if
            
        } // if
        
    } // listen
 
    
} // rezRectangles

 

  • That's all. Now take your object to your inventory. 

 

  • Like 1
  • 6 months later...
Posted

In the third script, if you comment out the line:

 

float fIn = (float)((string) fIn);

which doesn't do anything, it will also work on opensim.

 

 

Posted

I no remember why i put this line, but probably is a bug or error. On the other hand, I do not have the habits to redefine input parameters, It is almost certain that it is a mistake.

 In OpenSim, the UUID of the sculpties and textures are not correct, but you can find the sculties on my freebie site.

 

Greetings

 

You are about to reply to a thread that has been inactive for 4161 days.

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
×
×
  • Create New...