Jump to content

How do I switch out smaller objects within a single object?


siennasprout
 Share

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

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

Recommended Posts

Hi there,

New scripter here. I got a full perm wedding cake from Aleymart on the MP, and I thought it would be great if I could mod it so if the user clicks on it, they can get a menu that lets them change the cake topper to have a bride and a groom, two brides, two grooms, different appearance options, etc. so that it would be a good cheap option for everyone. How would I go about scripting that? Ideally, the various options can be contained within the object so it doesn't take up prims/LI.  I would also like it if the appearance could be a submenu and one of the other options is to grab a piece of cake.

Additionally, I want to make a popsicle that gets "eaten" progressively with each click by switching out meshes. This will reveal a message on the popsicle stick, and clicking on it again will start the process all over again. How would I script that?

I know that two questions at once is probably a lot, but I figured they were similar enough to keep them together. Thanks in advance!

Link to comment
Share on other sites

Both these questions are, unfortunately, related to a fundamental limitation in how Mesh was implemented in SL, ostensibly to "protect" creators: You cannot alter a mesh object except by "animesh" which is absurdly complicated for what you're trying to achieve here: a simple swap of model in an existing mesh. There are ways to get what you want, but as you'll see, the practical solutions multiply the rendering complexity of the object.

In any case, the script will use something like llSetLinkPrimitiveParamsFast() on existing link(s) in the object.*

Had Mesh not been crippled as described above, you'd do exactly as you asked, as you can with every non-Mesh primitive type; in fact if you're willing to dump Mesh and switch back to sculpties, your script can simply change the PRIM_TYPE_SCULPT parameters to swap sculptmaps and change a groom or two to a bride or two or vice versa.

So instead, the most common way is to use a mesh with all the possible geometries represented, probably as different faces (aka "sides" or in modelling terms, "materials"). So the mesh would simply keep transparent all but the desired face, using PRIM_COLOR to set the alpha of the different faces. That is, you'd have a bride+groom mesh, or a popsicle with a series of eaten stages all represented by different faces. (Technically, this can be done representing all the alternatives in a single mesh face and swapping alternative textures that are full alpha except for alternate parts of that face.)

If you're already stuck with separate meshes, though, you'd just have to link them all together (thus duplicating the shared geometry - not great for download weight), and again use PRIM_COLOR but on ALL_SIDES of the alternate links (instead of specified sides of a single link).

_________________
*That's because it's tricky to add and remove links using llBreakLink() and llCreateLink() which require the owner to have granted PERMISSION_CHANGE_LINKS, interact with any seated avatars, and involve land permission to rez that new link.

  • Like 2
Link to comment
Share on other sites

10 hours ago, siennasprout said:

Additionally, I want to make a popsicle that gets "eaten" progressively with each click by switching out meshes. This will reveal a message on the popsicle stick, and clicking on it again will start the process all over again. How would I script that?

Make the popsicle from a prim. You can then change its length by using the prim properties to trim off the end under script control. To practice, rez a cylinder and go to the Object tab in edit. Try adjusting the prim properties and see what happens.

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1403 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
 Share

×
×
  • Create New...