Jump to content

MSTRPLN

Resident
  • Posts

    97
  • Joined

  • Last visited

Posts posted by MSTRPLN

  1. Hello, i'm almost done with my hud i have one more feature to add before i can make it communicate between the actual meshes.

    I'm not sure how i would explain this so it's understandable so here's a little gif to explain: - Click

    The way it's constructed for me is the following:
    HUD.thumb.png.54cd83421a387bd02e852635f0070746.png

    the HUD would send that output to the mesh and tell on which face to change which texture to (more specific the texture + offset). This could be 1, 3, all etc.
    On the left example of the mesh the 2 parts would be on top of each other instead of next to eachother.

    A full_perm copy of the hud working in-game could be given for a live representation of what it does already, just send me a IM

    some more images to understand:
    Screenshot_2.png.c55f8b0cbedc5f3df24edb523f1dfedb.pngScreenshot_3.png.b8c120b72be93eca5ae22eeca8b9a646.pngScreenshot_4.thumb.png.ff3415592b1d63c89f5b230479998421.pngScreenshot_5.thumb.png.fe3bf6b6d42205d6928718af033a0a15.png

    The code:
     

    // Name: HUD Script
    // Category: Modular Road kit
    // Author: Chris Parker
    // Created: 18-08-2017
    
    // Setup for the texture changer 
    integer numberOfColumns = 3;
    integer numberOfRows = 5; 
    
    // Channel Setup
    integer channel = -50502;
    
    // Toggle
    integer gOn;
    
    // Rotating unused elements
    vector rotated = <0, -90, 0>;
    rotation rOn = ZERO_ROTATION;
    rotation rOff;
    
    // Textures
    key kTitleTex = "a1805d46-f48e-c4fd-648e-c00d608d1604";
    key kWetRoadBtn = "a83fcd2c-4df2-8e8a-3edd-03ba8b0b7a7b";
    key kRoadMarkingsBtn = "3a7c7475-21f0-31f4-4da7-d094c819c6c3";
    key kRoadTexturesBtn = "b97dc6ac-e2be-403b-f6ed-558eb4c11932";
    key kRoadLinesBtn = "2677b56d-ecc5-67c0-1a57-9f69c69bf158";
    vector vTabRepeats = <0.5, 1.0, 0.0>;
    vector vTabOn = <-0.25, 0, 0>;
    vector vTabOff = <0.25, 0, 0>;
    
    // Linknumbers
    integer giTitle;
    integer giTabs;
    integer giDryRoad;
    integer giDisplay_1;
    integer giMarksDisplay;
    integer giLinesDisplay;
    integer giNext;
    integer giPrev;
    integer giClear;
    
    // Current Tab
    list glTabs = [0,0,"Wet Road", "Road Markings", "Road Textures", "Road Lines"];
    integer giCurrTab = 2;
    integer giSelectedTextureNum;
    
    // Sorting
    list glSortNum = ["13","14","15","10","11","12","7","8","9","4","5","6","1","2","3"];
    list glSortNum2 = ["28","29","30","25","26","27","22","23","24","19","20","21","16","17","18"];
    list glSortNum3 = ["43","44","45","40","41","42","37","38","39","34","35","36","31","32","33"];
    
    
    // Texture List
    list glWetRoad = ["Wet 1", "Wet 2", "Wet 3"];
    list glRoadMarkings = ["Decal 1", "Decal 2", "Decal 3", "Decal 4", "Decal 5", "Decal 6", "Decal 7", "Decal 8", "Decal 9", "Decal 10", "Decal 11", "Decal 12", "Decal 13", "Decal 14", "Decal 15", "Decal 16", "Decal 17", "Decal 18", "Decal 19", "Decal 20", "Decal 21", "Decal 22", "Decal 23", "Decal 24", "Decal 25", "Decal 26", "Decal 27", "Decal 28", "Decal 29", "Decal 30", "Decal 31", "Decal 32"];
    list glRoadTextures = ["Road 1", "Road 2", "Road 3", "Road 4", "Road 5", "Road 6", "Road 7", "Road 8", "Curb 1", "Curb 2", "Curb 3", "Curb 4"];
    list glRoadLines = ["Line 1", "Line 2", "Line 3", "Line 4", "Line 5", "Line 6", "Line 7", "Line 8"];
    
    // Pages
    list glPages = ["Page 1", "Page 2", "Page 3"];
    integer giCurrPage = 1;
    
    // Preview selector 8 texture faces max
    list lPosition = [0,1,2,3,4,5,6,7];
    
    
    GetLinkNum()
    {
        integer iP = llGetNumberOfPrims();
        while(iP)
        {
            string sName = llGetLinkName(iP);
            if (sName == "Title")
            {
                giTitle = iP;
            }
            else if (llGetSubString(sName, 0,7) == "Mesh_HUD")
            {
                giTabs = iP;
            }
            else if (sName == "Dry Road")
            {
                giDryRoad= iP;
            }
            else if (sName == "Display 1")
            {
                giDisplay_1 = iP;
            }
            else if (sName == "Marks Display")
            {
                giMarksDisplay= iP;
            }
            else if (sName == "Lines Display")
            {
                giLinesDisplay = iP;
            }
            else if (sName == "Next")
            {
                giNext = iP;
            }
            else if (sName == "Prev")
            {
                giPrev = iP;
            }
            else if (sName == "Clear")
            {
                giClear= iP;
            }
            --iP;
        }
    }
    
    integer TextureSelection(vector _st)
    {
        // ZERO_VECTOR (<0.0, 0.0, 0.0> ... the origin) is in the bottom left corner of the face
        // touchST.x goes across the face from the left to the right
        // touchST.y goes up the face from the bottom to the top
        
        integer columnIndex = (integer) (_st.x * numberOfColumns);
        integer rowIndex    = (integer) (_st.y * numberOfRows);
        integer cellIndex   = (rowIndex * numberOfColumns) + columnIndex;
        if (giCurrPage == 2)
        {
            return llList2Integer(glSortNum2, cellIndex);
        }
        else if (giCurrPage == 3)
        {
            return llList2Integer(glSortNum3, cellIndex);
        }
        else
        {
            return llList2Integer(glSortNum, cellIndex);
        }
    }
    
    
    default
    {
        state_entry()
        {
            GetLinkNum();
            llSetText(llGetObjectName(), <1.0, 1.0, 1.0>, 1.0 );
            
            rotated *= DEG_TO_RAD;
            rOff = llEuler2Rot(rotated);
        }
    
        touch_start(integer num_detected)
        {
            gOn = !gOn;
            
            integer iLinkNum = llDetectedLinkNumber(0);
            string sLinkName = llGetLinkName(iLinkNum);
            integer iTouchFace = llDetectedTouchFace(0);
            vector vTouchST = llDetectedTouchST(0);
            
            if (sLinkName == "Display 1")
            {
                string sCurrentTab = llList2String(glTabs, giCurrTab);
                giSelectedTextureNum = TextureSelection(vTouchST);
                //llOwnerSay("Texture # " + (string)giSelectedTextureNum + " has been clicked in tab " + llList2String(glTabs, giCurrTab));
                
                if (sCurrentTab == "Wet Road")
                {
                    llOwnerSay("This Texture has been seleted: " + llList2String(glWetRoad, giSelectedTextureNum -1));
                }
                else if (sCurrentTab == "Road Markings")
                {
                     llOwnerSay("This Texture has been seleted: " + llList2String(glRoadMarkings, giSelectedTextureNum -1));
                }
                else if (sCurrentTab == "Road Textures")
                {
                     llOwnerSay("This Texture has been seleted: " + llList2String(glRoadTextures, giSelectedTextureNum -1));
                }
                else if (sCurrentTab == "Road Lines")
                {
                     llOwnerSay("This Texture has been seleted: " + llList2String(glRoadLines, giSelectedTextureNum -1));
                }
            }
            
            // If "Prev" button is pressed
            if (sLinkName == "Prev")
            {
                if (giCurrPage > 1)
                {
                    giCurrPage--;
                    llOwnerSay("Current page: " +(string)giCurrPage);
                }
            }
            // If "Next" button is pressed
            if (sLinkName == "Next")
            {
                if (giCurrPage < 3)
                {
                    giCurrPage++;
                    llOwnerSay("Current page: " +(string)giCurrPage);
                }
            }
            // If "Clear" button is pressed
            if (sLinkName == "Clear")
            {
                if (giCurrTab == 3)
                {
                llOwnerSay("Clear Decals");
                }
                else if (giCurrTab == 4)
                {
                llOwnerSay("Clear Road");
                }
                else if (giCurrTab == 5)
                {
                llOwnerSay("Clear Lines");
                }
            }
            
            // Reset road back to dry
            if(sLinkName == "Dry Road")
            {
                if (giCurrTab == 2)
                {
                    llOwnerSay("Dry Road");
                }
            }
            
            // Toggle rain Animation
            if(sLinkName == "Animated")
            {
                if (giCurrTab == 2)
                {
                    if (gOn)
                    {
                        llOwnerSay("Animate");
                        llSetLinkPrimitiveParamsFast(10, [ PRIM_TEXTURE, ALL_SIDES, "cecbcc14-cc70-9f60-3486-fec8f9de3e4e", <1.0, 0.5, 0.0>, <0.0, -0.25, 0.0>, 0.0 ]);
                    }
                    else if (!gOn)
                    {
                        llOwnerSay("!Animate");
                        llSetLinkPrimitiveParamsFast(10, [ PRIM_TEXTURE, ALL_SIDES, "cecbcc14-cc70-9f60-3486-fec8f9de3e4e", <1.0, 0.5, 0.0>, <0.0, 0.25, 0.0>, 0.0 ]);
                    }
                }
            }
            
            if (giCurrTab == 3)
            {
                //Page texture switching
                if (iLinkNum == 6 | iLinkNum == 4)
                {
                    if (giCurrPage == 1)
                    {
                        llSetLinkTexture(3, "452e4d7a-405c-d530-f2e9-39af7584bc2a", ALL_SIDES);
                        llOwnerSay("Page 1 texture applied");
                    }
                    else if (giCurrPage == 2)
                    {
                        llSetLinkTexture(3, "d851c87b-ee5d-5f2f-7929-95714f20a367", ALL_SIDES);
                        llOwnerSay("Page 2 texture applied");
                    }
                    else if (giCurrPage == 3)
                    {
                        llSetLinkTexture(3, "5533a062-2b74-1086-0e9d-d95a196c1442", ALL_SIDES);
                        llOwnerSay("Page 3 texture applied");
                    }
                }
            }
                     
            // If tab menu is clicked
            if(iLinkNum == 1)
            {        
                // Delete Button
                if(iTouchFace == 0)
                { 
                    llOwnerSay("DeleteHUD");
                }
                // Minimize Button
                if(iTouchFace == 1)
                { 
                    llOwnerSay("DetachHUD");
                }
                // Wet Road Button
                if(iTouchFace == 2)
                {  
                    giCurrTab = 2;
                    giCurrPage = 1;
                    // Title offset
                    llSetLinkPrimitiveParamsFast(2, [ PRIM_TEXTURE, 1, kTitleTex, <1.0, 0.25, 0.0>, <0.0, 0.375, 0.0>, 0.0 ]);
                    // wet road offset
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 2, kWetRoadBtn, vTabRepeats, vTabOn, 0.0 ]);
                    // all others offset back
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 3, kRoadMarkingsBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 4, kRoadTexturesBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 5, kRoadLinesBtn, vTabRepeats, vTabOff, 0.0 ]);
                    
                    // Rotate Road lines Previewer = OFF
                    llSetLinkPrimitiveParamsFast(9, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate Road markings Previewer = OFF
                    llSetLinkPrimitiveParamsFast(8, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate Dry road button = ON
                    llSetLinkPrimitiveParamsFast(7, [PRIM_ROT_LOCAL, rOn]);
                    llSetLinkPrimitiveParamsFast(10, [PRIM_ROT_LOCAL, rOn]);
                    // Rotate page buttons = OFF
                    llSetLinkPrimitiveParamsFast(6, [PRIM_ROT_LOCAL, rOff]);
                    llSetLinkPrimitiveParamsFast(5, [PRIM_ROT_LOCAL, rOff]);
                    llSetLinkPrimitiveParamsFast(4, [PRIM_ROT_LOCAL, rOff]);
                    
                    //Set Display 01 background texture
                    llSetLinkPrimitiveParamsFast(3, [ PRIM_TEXTURE, ALL_SIDES, "b9437edd-c3e0-afe7-1b63-ea56893f723a", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);
                }
    
                // Road Markings Button
                if(iTouchFace == 3)
                {  
                    giCurrTab = 3;
                    giCurrPage = 1;
                    // Title offset
                    llSetLinkPrimitiveParamsFast(2, [ PRIM_TEXTURE, 1, kTitleTex, <1.0, 0.25, 0.0>, <0.0, 0.125, 0.0>, 0.0 ]);
                    // road markings offset
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 3, kRoadMarkingsBtn, vTabRepeats, vTabOn, 0.0 ]);
                    // all others offset back
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 2, kWetRoadBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 4, kRoadTexturesBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 5, kRoadLinesBtn, vTabRepeats, vTabOff, 0.0 ]);
                    
                    // Rotate Road lines Previewer = OFF
                    llSetLinkPrimitiveParamsFast(9, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate Road markings Previewer = ON
                    llSetLinkPrimitiveParamsFast(8, [PRIM_ROT_LOCAL, rOn]);
                    // Rotate Dry road button = OFF
                    llSetLinkPrimitiveParamsFast(7, [PRIM_ROT_LOCAL, rOff]);
                    llSetLinkPrimitiveParamsFast(10, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate page buttons = ON
                    llSetLinkPrimitiveParamsFast(6, [PRIM_ROT_LOCAL, rOn]);
                    llSetLinkPrimitiveParamsFast(5, [PRIM_ROT_LOCAL, rOn]);
                    llSetLinkPrimitiveParamsFast(4, [PRIM_ROT_LOCAL, rOn]);
                    
                    llSetLinkTexture(3, "452e4d7a-405c-d530-f2e9-39af7584bc2a", ALL_SIDES);
                    llOwnerSay("Default page texture applied");
                }
                // Road Textures Button
                if(iTouchFace == 4)
                { 
                    giCurrTab = 4;
                    giCurrPage = 1;
                    // Title offset
                    llSetLinkPrimitiveParamsFast(2, [ PRIM_TEXTURE, 1, kTitleTex, <1.0, 0.25, 0.0>, <0.0, -0.125, 0.0>, 0.0 ]);
                    // road textures offset
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 4, kRoadTexturesBtn, vTabRepeats, vTabOn, 0.0 ]);
                    // all others offset back
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 3, kRoadMarkingsBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 2, kWetRoadBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 5, kRoadLinesBtn, vTabRepeats, vTabOff, 0.0 ]);
                    
                    // Rotate  Road lines Previewer = OFF
                    llSetLinkPrimitiveParamsFast(9, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate Road markings Previewer = OFF
                    llSetLinkPrimitiveParamsFast(8, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate Dry road button = OFF
                    llSetLinkPrimitiveParamsFast(7, [PRIM_ROT_LOCAL, rOff]);
                    llSetLinkPrimitiveParamsFast(10, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate page buttons = OFF
                    llSetLinkPrimitiveParamsFast(6, [PRIM_ROT_LOCAL, rOff]);
                    llSetLinkPrimitiveParamsFast(5, [PRIM_ROT_LOCAL, rOn]);
                    llSetLinkPrimitiveParamsFast(4, [PRIM_ROT_LOCAL, rOff]);
                    
                    //Set Display 01 background texture
                    llSetLinkPrimitiveParamsFast(3, [ PRIM_TEXTURE, ALL_SIDES, "ed943688-013d-c48b-4546-9822e8afd18f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);
                }
                // Road Lines Button
                if(iTouchFace == 5)
                {
                    giCurrTab = 5;
                    giCurrPage = 1;
                    // Title offset
                    llSetLinkPrimitiveParamsFast(2, [ PRIM_TEXTURE, 1, kTitleTex, <1.0, 0.25, 0.0>, <0.0, -0.375, 0.0>, 0.0 ]);
                    // road lines offset
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 5, kRoadLinesBtn, vTabRepeats, vTabOn, 0.0 ]);
                    // all others offset back
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 3, kRoadMarkingsBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 4, kRoadTexturesBtn, vTabRepeats, vTabOff, 0.0 ]);
                    llSetLinkPrimitiveParamsFast(1, [ PRIM_TEXTURE, 2, kWetRoadBtn, vTabRepeats, vTabOff, 0.0 ]);
                    
                    // Rotate Road lines Previewer = ON
                    llSetLinkPrimitiveParamsFast(9, [PRIM_ROT_LOCAL, rOn]);
                    // Rotate Road markings Previewer = OFF
                    llSetLinkPrimitiveParamsFast(8, [PRIM_ROT_LOCAL, rOff]); 
                    // Rotate Dry road button = OFF
                    llSetLinkPrimitiveParamsFast(7, [PRIM_ROT_LOCAL, rOff]);
                    llSetLinkPrimitiveParamsFast(10, [PRIM_ROT_LOCAL, rOff]);
                    // Rotate page buttons = OFF
                    llSetLinkPrimitiveParamsFast(6, [PRIM_ROT_LOCAL, rOff]);
                    llSetLinkPrimitiveParamsFast(5, [PRIM_ROT_LOCAL, rOn]);
                    llSetLinkPrimitiveParamsFast(4, [PRIM_ROT_LOCAL, rOff]);
                    
                    //Set Display 01 background texture
                    llSetLinkPrimitiveParamsFast(3, [ PRIM_TEXTURE, ALL_SIDES, "20c83606-4207-3382-ef44-819077616fe0", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);
                }
            }   
        }
    }

    Ofcourse the "return llList2Integer(glSortNum2, cellIndex);" would be changed to llRegionSayTo once i start doing the communiction between the HUD & the Mesh

  2. 1 hour ago, arton Rotaru said:

    Making it work flawlessly, it is a rather advanced task indeed. Although the functions being used are rather basic. But that's easy to say if you have done this kind of stuff a couple of times already.

    The good thing is, the possibilities are countless. Being creative to how to solve one problem after the other is the fun part of scripting.

    true with a bit of knowledge on hwo stuff works though, because sometimes you look at the wiki but think "okay i understand this demo, but how would i implement it in my situation?

    i think im going with the DetectedTouchST (different outcomes on different tabs for example: when the decals tab is clicked clicking the touchst 1 will change the texture to tex1 of the decals etc.. and have the 3 extra buttons rotate 90 when not used, and the previewer like i said this would be basic but would work i suppose

  3. That might be a bit too advanced for me but ill try my best, although not every button is the same, for example the road decals has 2 pages but most of them are using the multiple texture faces so having these as you described up top and a few "extra" buttons shown/hidden by rotating isn't going to be a big problem i suppose

    as for the previewer, it's workign the same as this the only difference is it won't be 2 cubes but 2 meshes with different faces to controll what part on the mesh can be changed

    with the detectedtouchst i could do this which is 1 object:

    Screenshot_1.png

     

    and then put:

    integer numberOfRows    = 5;
    integer numberOfColumns = 2;

    if im not mistaking, and for the extra buttons just make a seperate object. (would be easier to accomplish because im not super familiar with lists and how to call them in later, let alone do all the functions on the list as you described above).

  4. Some questions appeared again:

    I've got the start of the hud done:

    HUD.png

     

    now my first question: how would i show/hide different tabs? (if you could create linksets inside linksets this wouldn't be an issue)
    because these would be the different tabs (more or less):

    tabs.png

    The title is the easiest part. Just 4 instances under each other in one image file, clicking on each tab menu button would change the texture position then.
    You could say put them all over each other (in different X values) but that would bring it up to so many meshes (not sure if this would become an issue. Example shown below)
    tabs2.png

     

    Question 2: previewer with selectable parts:
     

    Preview selectors.png

    I hope this makes sense, the selectors are constructed the same as the mesh (layers) as shown below:

    mesh layer.png

     

    For the selectors i was thinking this (any better ideas?)
    Coding wise let's say selector 1 is linknumber 8 & selector 2 is linknumber 9
    i could do an if statement on the texture changer like: (If linknumber 8 & face 1 (left side) is toggled put texture only to left face on the road mesh)
    using this solution given by arton Rotaru

     

    selectors.png

  5. Hello, i've made a visual example but im not sure how to code this. basically i have 2 main functions that are clueless to me.

    1. Minimizing UI/HUD
    2. Have different "tabs" appear and dissapear when clicked on the buttons (setting transparency or display wouldn't work i think, yes they would be invisible but still interactable with)
    Maybe havign one "Main" hud (the tab buttons) and attaching/detaching different objects based on what button is pressed? But wouldn't that ask for PERMISSION_ATTACH every single time?

    I've got an example of the background working although the resizing has a kind of a "ease out" thing happening and im not sure if this is the right way to do it.

    integer toggle;
    default
    {
        state_entry()
        {
        }
    
        touch_start(integer total_number)
        {
            toggle = !toggle;
            if(llDetectedLinkNumber(0) == 1)
            {
                if(toggle)
                {
                    llSetLinkPrimitiveParamsFast(2, [PRIM_SIZE, <0.5, 0.15, 0.999>]);
                    llSetLinkPrimitiveParamsFast(2, [PRIM_POSITION, <0.0, -0.888, 0.0>]);
                }
                else
                {
                    llSetLinkPrimitiveParamsFast(2, [PRIM_SIZE, <0.5, 0.5, 0.999>]);
                    llSetLinkPrimitiveParamsFast(2, [PRIM_POSITION, <0.0, -0.712, 0.0>]);
                }
            }
        }
    }

    Basically i have a root prim with a linked prim to the right of it (because when attaching to HUD Center the root will be centered and the actual "background" prim would be on the right side) this because the hud is going to be called from a item where you dont have an option "hud center right" so i'd still need to come up with a solution to hide the center cube & stop it from blocking clicks (maybe size it down to almost 0)

    Any help would be much apreciated!

    Pleae note these images are made in Photoshop and are not yet coded, they are a example of what i'm aiming for

    HUD1.png

     

    HUD2.png

  6. 7 hours ago, Innula Zenovka said:

    Rather than using 8 different textures, why not try using one single large texture, divided into 8, and moving it by changing the texture offset?   That way, it loads only once, when the visitor first arrives in the region and sees the road, no matter which part of the texture is displayed at the time.   

    I don't even know why when i thought about that i was thinking "how could i change uv positions like sprites" ut yeah texture offset is how,  thanks!

  7. Yes, it's probably going to be used once, so i thought a "empty" transparent texture would be better than to toggle the alpha in the script for each face, unless im wrong i thought that was havier on performance than a transparent texture

  8. Okay that made things clear, because i uploaded a png with "nothing" in it because else the face would be white (or whatever color it's set to) thats the reason of my question, a transparent texture or setting the "transparency" by script

  9. I understand, i just noticed that the "fatpack HUD" (texture changer) of Valekoer's Hoodie changed textures rather fast (even with multiple parts selected (sleeve, torso etc) but that might be because those textures were in my cache aready.

    well to make it simple, would it be best to hide the non-used faces with a empty png texture or just set the alpha to 0 (clicking  "None" would set all faces alpha to 0 untill a texture is applied to one of them then it will change it's alpha back to 1)

    i tested 2 exact same copies with the prim info tab open, the one with unused faces set to alpha 0 (no textures) had a slightly less Display value than the one with all faces set to alpha 1 and non used faces texture empty png

  10. Thank you, this works as i wanted (although when changign textures with "ALL" toggled there seem to be a little delay between them but i might aswell remove that function and just have the "none" (for my purpose)

    a little question about impact/memory/load, i have a little example here done in the beta grid, would it be smarter to have every face (the different 6 colored faces) be a empty texture or toggle the llSetAlpha between 1.0 and 0.0 ? The decal faces lay on top of the road so they are not part of the road texture (seperate mesh)

     

     

    Screenshot_3.png

    Screenshot_4.png

  11. Edit, i managed to fix it. for intersections and the Tsplit etc i used a 2nd UV map channel to bake the texture for (to make it seamless inside Photoshop)  and aparently the viewport material was using the 1st map channel but when exporting it used the 2nd channel. To fix use "UVW Mapping Clear" modifier and select channel to 2 to delete the 2nd map channel

  12. Sorry to be a pain, im running into a issue to a point where im totally clueless, things that make sense won't even work anymore. Unfortunately there isn't any information or documentation on these type of things but yet ther are everywhere in sl (Texture changer for clothing, meshbody HUDS etc)

    I started with 2 linksets

    1. Target: 2 objects of which textures will be changable
    2.  Sender: 6 objects with each a different function when clicked.

    The target is simple the catch is as follows:
    [5] [6]
    [3] [4]
    [2] [1]

    5 = All function (sets all target cubes to enable textures being changed). (Also changes buttons "Left" & "Right" to green = enabled)
    6 = None function (ets all target cubes to disable textures being changed). (Also changes buttons "Left" & "Right" to white = disabled)
    3 = Changes to texture #1.
    4 = Changes to texture #2.
    2 = Toggles left cube to enable textures being changed. (also toggles colors on button itself green = enabled, white = disabled)
    1 = Toggles right cube to enable textures being changed. (also toggles colors on button itself green = enabled white = disabled)

    i only got 2 cubes for now but it might be more.

    Receive Script:

    // Script for texture changer receiver
    integer channel = -50508;
    // Channel is the integer for reception (number mus the same as a transmission channel otherwise script will not work)
    
    default
    {
            state_entry()
            {
                llListen(channel, "", NULL_KEY, "");
            }
            
            listen(integer channel, string name, key id, string msg)
            {
                
                if (llGetOwner() == llGetOwnerKey(id))
                // Checks if the owner of the object who is sending a message its the same owner of the receiver
                {
                    // Front Face
                    if (msg == "tex1Left")
                    {
                            llSetLinkTexture(1, "2433879f-6116-1521-38c0-eb86f2ce607a", 4);
                    }
                    if (msg == "tex1Right")
                    {
                            llSetLinkTexture(2, "2433879f-6116-1521-38c0-eb86f2ce607a", 4);
                    }
                    if (msg == "tex2Left")
                    {
                            llSetLinkTexture(1, "df50ac59-b871-b00f-e3c5-2633c4f1cb6e", 4);
                    }
                    if (msg == "tex2Right")
                    {
                            llSetLinkTexture(2, "df50ac59-b871-b00f-e3c5-2633c4f1cb6e", 4);
                    }
                    // Else
                }
            }    
    }

    Transmit Script:

    // Choose any number up for 1024 as the channel for the transmission
    integer channel = -50508;
    
    integer toggle;
    
    integer Left;
    integer Right;
    
    default
    {
        on_rez(integer star_param)
        {
        }
        
         touch_start(integer tn)
        {
            toggle = !toggle; 
            if (llDetectedLinkNumber(0) == 3)
            {
                if(Left == toggle && Right != toggle)
                {
                    llOwnerSay("Left tex1");
                    llRegionSay(channel, "tex1Left");
                }
                else if(Right == toggle && Left != toggle)
                {
                    llOwnerSay("Right tex1");
                    llRegionSay(channel, "tex1Right");
                }
            }
            else if (llDetectedLinkNumber(0) == 4)
            {
                if(Left == toggle && Right != toggle)
                {
                    llOwnerSay("Left tex2");
                    llRegionSay(channel, "tex2Left");
                }
                if(Right == toggle && Left != toggle)
                {
                    llOwnerSay("Right tex2");
                    llRegionSay(channel, "tex2Right");
                }
            }
            else if (llDetectedLinkNumber(0) == 2)
            {
                if(toggle)
                {
                   llSetLinkColor(2, <0.0, 1.0, 0.0>, 4);
                }
                else
                {
                    llSetLinkColor(2, <1.0, 1.0, 1.0>, 4);
                }
            }
            else if (llDetectedLinkNumber(0) == 1)
            {
                if(toggle)
                {
                   llSetLinkColor(1, <0.0, 1.0, 0.0>, 4); 
                }
                else
                {
                    llSetLinkColor(1, <1.0, 1.0, 1.0>, 4);
                }
            }
            else if (llDetectedLinkNumber(0) == 5)
            {
                llSetLinkColor(2, <0.0, 1.0, 0.0>, 4);
                llSetLinkColor(1, <0.0, 1.0, 0.0>, 4);
            }
            else if (llDetectedLinkNumber(0) == 6)
            {
                llSetLinkColor(2, <1.0, 1.0, 1.0>, 4);
                llSetLinkColor(1, <1.0, 1.0, 1.0>, 4);
            }
        }
    }

    The llOwnerSay(Left tex1); etc is just for debugging to see if that part is working

    Right now im not too worried about making the scripts "validatable" my main concern is making it work and then perfecting it

    i've tried a list, string list2string but i can't seem to get it to work, i tink a list of objects available (specially for the "ALL" button) would be more effective and less code

     

    If it's too hard to understand what i want is:

    1. being able to change the textures of different linknumbers & faces (for now only linknumbers)
    2. toggle which linknumber a texture would be changed for (including a ALL & NONE button)

    Screenshot_1.png

    Screenshot_2.png

  13. 3 hours ago, arton Rotaru said:

     

    
     integer index = llGetInventoryNumber(INVENTORY_ALL);
            while(index--)
            {
                string sN = llGetInventoryName(INVENTORY_ALL, index);
                if (sN != llGetScriptName())
                {
                    llRemoveInventory(sN);
                }
            }
            llRemoveInventory(llGetScriptName());

     

    Ugh i had the above example but without deleting the script after it, i dont know why i forgot about that & thanks alot for the llSleep function! that makes things alot easier (i used llSleep(2.0)

  14. Hello, I'm making a kind of unusual script/system, i will explain.

    Intro:
    I have 2 items: Prim and a HUD

    Prim contains: HUD & script: "HUD_Receiver"
    HUD Contains: script: "HUD_transmittor" (the HUD also contains out of 5 prims, 4 with actions)

    Within the HUD i have a button to delete all objects out of the 1st prim (including the HUD & HUD_receiver script)

    The thought behind it is..

    I have a prim that i want to be able to change it's textures with a HUD so the main action will be changing textures. One button to detach the HUD but also a button to delete everything from the prim once satisfied (why? because this will be a modular prim, copied multiple times within a region)

    Issues:

    1. When clicking on the "delete" button it would detach the HUD before it would send the message to the prim
    Fix: Sending the  "Detach" function through a timer event to a 2nd state, the timer waits 2 seconds for the object to deliver the message then detach

    2. With issue 1 fixed it now won't delete the (object) "HUD" itself anymore.

    3. Changing the channels from -50504 to a random number, the script won't work anymore (that's why the random number is disabled) ie:
    // gChan = -1 * (integer)llFrand(1000000.0) - 345; (yes i know it says gChan instead of channel that's not the issue)

     

    Scripts:

    // Script for texture changer receiver
    integer channel = -50504;
    // Channel is the integer for reception (number mus the same as a transmission channel otherwise script will not work)
    
    delete_all_other_contents()
    {
        string thisScript = llGetScriptName();
        string inventoryItemName;
     
        integer index = llGetInventoryNumber(INVENTORY_ALL);
        while (index)
        {
            --index;        // (faster than index--;)
     
            inventoryItemName = llGetInventoryName(INVENTORY_ALL, index);
     
            if (index > 0)   
                llRemoveInventory(inventoryItemName);
                llRemoveInventory(thisScript);
                llOwnerSay("Everything removed.");
        }
    }
    
    default
    {
            state_entry()
            {
                llListen(channel, "", NULL_KEY, "");
            }
            
            touch_start(integer total_number)
            {
                llRezObject("HUD", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
            }
            
            listen(integer channel, string name, key id, string msg)
            {
                
                if (llGetOwner() == llGetOwnerKey(id))
                // Checks if the owner of the object who is sending a message its the same owner of the receiver
                {
                    // Front Face
                    if (msg == "tex1")  llSetTexture("2433879f-6116-1521-38c0-eb86f2ce607a", 4);
                    if (msg == "tex2")  llSetTexture("9fc13d27-47b6-1a0a-4262-7ab9e52ffc65", 4);
                    // Else
                    if (msg == "die")
                    {
                        delete_all_other_contents();
                    }
                }
            }    
    }

    Above script goes into the main prim (contents: HUD + above script)

     

    // Choose any number up for 1024 as the channel for the transmission
    integer channel = -50504;
    // Delay in seconds
    float delay = 2.0;
    
    default
    {
        on_rez(integer star_param)
        {
            llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
            llSetAlpha(0, ALL_SIDES);
            llSetLinkAlpha(LINK_SET, 0, ALL_SIDES);
            
            // gChan = -1 * (integer)llFrand(1000000.0) - 345;  // gChan is a global integer
        }
        
        run_time_permissions(integer perm)
        {
            if(PERMISSION_ATTACH & perm)
            {
                llAttachToAvatarTemp(ATTACH_HUD_CENTER_1);
                llOwnerSay("Attached.");
                llSetAlpha(1, ALL_SIDES);
                llSetLinkAlpha(LINK_SET, 1, ALL_SIDES);
            }
            else {
                llSay(0,"Not attached :(");
            }
                        
        }
        
         touch_end(integer tn)
        {
            if (llDetectedLinkNumber(0) == 3)
            {
                llRegionSay(channel, "tex1");
            }
            else if (llDetectedLinkNumber(0) == 2)
            {
                llRegionSay(channel, "tex2");
            }
            else if (llDetectedLinkNumber(0) == 5)
            {
                state two;
            }
            else if (llDetectedLinkNumber(0) == 4)
            {
                llRegionSay(channel, "die");
                llSetTimerEvent(delay);
            }
        }
        
        timer()
        {
            state two;
        }
    }
    
    state two
    {
        state_entry()
        {
           llDetachFromAvatar();
        }
    }

    Above script goes inside the "HUD" object

     

    I might be missing something and i need a break, any help would be more than helpfull!

    Please keep in mind that these are just placeholders, the finished product would be the Mesh item itself & a stylized HUD

    Object.png

    HUD.png

  15. Didn't work. i might make a copy of models in the future and keep the "quads" version just in case.
    I have litterally no idea what causes this

    Edit: I tried cutting the object into smaller pieces but that didn't fix it either. 

     

    PS: No i have no material tiling applied inside 3DS Max (i don't even use a image but colors)

    Screenshot_27.png

    Screenshot_28.png

×
×
  • Create New...