How to tell a mesh from a sculpt from a prim

Creating scripts
Post Reply
User avatar
Tess Juel
Posts: 267
Joined: Sun Sep 11, 2016 4:24 pm
Has thanked: 249 times
Been thanked: 438 times

How to tell a mesh from a sculpt from a prim

Post 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");
        }
    }
}
These users thanked the author Tess Juel for the post (total 5):
Ilan TochnerJohn MelaSnoots DwagonShandon LoringMichael Timeless
User avatar
Snoots Dwagon
Posts: 422
Joined: Mon Jul 30, 2018 9:45 pm
Has thanked: 442 times
Been thanked: 779 times

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

Post 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.
Last edited by Snoots Dwagon on Sat Jul 31, 2021 8:14 pm, edited 1 time in total.
These users thanked the author Snoots Dwagon for the post (total 2):
Ilan TochnerTess Juel
~~~~~~~
I'm a dwagon in real life too. (Ask my sister, who totally agrees.)

~~~~~~~
User avatar
Tess Juel
Posts: 267
Joined: Sun Sep 11, 2016 4:24 pm
Has thanked: 249 times
Been thanked: 438 times

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

Post 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)
        }
    }
}
These users thanked the author Tess Juel for the post (total 2):
Ilan TochnerSnoots Dwagon
User avatar
Snoots Dwagon
Posts: 422
Joined: Mon Jul 30, 2018 9:45 pm
Has thanked: 442 times
Been thanked: 779 times

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

Post 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
~~~~~~~
I'm a dwagon in real life too. (Ask my sister, who totally agrees.)

~~~~~~~
Post Reply