Question about slice lookup codes

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Question about slice lookup codes

Post by Foxley »

Something I'd like to know is: what happens when you run a command on a slice handle that comes from a sl: or sli: lookup code, but there are multiple slices that exist with that same lookup code?

Does it only do the command to the first copy of that slice, does it do it to all of them, or does it throw an error and/or freak out?
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

The "lookup slice" command finds the first slice that has that code, and returns a handle to it.

If you want to do an action on all the slices that have a specific lookup code, there are other ways to do it.

Do all the slices you care about have the same parent?

If so then you can loop through them and check each one with "get slice lookup"

Is this something you only need to do once on all the lookup codes in a slice collection after you load it? If so, you can use "lookup slice", manipulate the first slice, then clear its lookup code with "set slice lookup" and repeat until no more are found.

if it is something else, let me know.
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

I'll admit I didn't have any specific use cases in mind. I more just wanted to know how it would behave, in case I end up using slice lookups more frequently or define them with scripts instead of just the slice collection editor. Thanks!
Post Reply