Page 1 of 1

How to tell a mesh from a sculpt from a prim

Posted: Thu Jul 29, 2021 12:15 pm
by Tess Juel
I thought this little script could be useful for others too.
Obvioulsy, if you want to integrate it into a bigger script, replace the llOwnerSay() lines with whatever code you want to run for each type of object.

Code: Select all

default
{
    state_entry()
    {
        list CheckType=(llGetPrimitiveParams([PRIM_TYPE]));

        if((string) llList2List(CheckType,0,0)=="7"){
            if((string) llList2List(CheckType,2,2)=="5"){
                llOwnerSay("This is a mesh");
            }
            else{
                llOwnerSay("This is a sculpt");
            }
        }
        else {
            llOwnerSay("This is a prim");
        }
    }
}

Re: How to tell a mesh from a sculpt from a prim

Posted: Thu Jul 29, 2021 3:47 pm
by Snoots Dwagon
EDIT: Check Tess's answer to this post below to see why this script is valuable. : )

Appreciate the script. Actually there's an easier way to tell if a prim is prim, mesh, or sculpt. Look at the OBJECT tab. It displays different results for all three items.

Prims will have full descriptive stats on all figures.

Sculpts will have a sculpt texture box for sculpt definition.

Mesh will have mesh formation information.

The three screens are significantly different. One can tell at a glance which is the case. The only exception might be a no-mod item which won't show any particulars, but in such case a script couldn't be added to the item anyway. Usually there are still clues in the Object tab that, while not providing specifics, will still inidicate the type of object.

Re: How to tell a mesh from a sculpt from a prim

Posted: Fri Jul 30, 2021 4:14 am
by Tess Juel
Snoots Dwagon wrote:
Thu Jul 29, 2021 3:47 pm
Appreciate the script. Actually there's an easier way to tell if a prim is prim, mesh, or sculpt. Look at the OBJECT tab.
Oh yes, if all you want to know is what kind of object it is, this script is just a gimmick. But this is a snippet to use when you need a script to execute different code depending on what kind of object it's in. Maybe I should have posted it this way instead to make that clear:

Code: Select all

default
{
    state_entry()
    {
        list CheckType=(llGetPrimitiveParams([PRIM_TYPE]));

        if((string) llList2List(CheckType,0,0)=="7"){
            if((string) llList2List(CheckType,2,2)=="5"){
                //(insert code to run for meshes)
            }
            else{
                //(insert code to run for sculpts)
            }
        }
        else {
            //(insert code to run for prims)
        }
    }
}

Re: How to tell a mesh from a sculpt from a prim

Posted: Sat Jul 31, 2021 8:12 pm
by Snoots Dwagon
Ohhh... good point! I never thought of that need, but yeah, that script would come in real handy if it had to be internal detection. Thanks. :D