duplicating a slice?

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

Moderators: marionline, SDHawk

Post Reply
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

duplicating a slice?

Post by SwordPlay »

Is there a plotscript command to duplicate a slice?
User avatar
kylekrack
Liquid Metal Slime
Posts: 1242
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

There is a command called "clone sprite(handle)", but I can't find anything that does the same with general slices. The only thing I can think of is creating a plotscript named "duplicate slice" or something that takes a slice handle as an argument. Then you could use commands like "slice is container()", etc. in a huge list of else-ifs or a switch statement, and then get the slice info and copy it into a new slice. Might also want to add a parent slice as an argument, or just get the parent of the slice you're duplicating.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

There's an internal function for cloning slice trees, so I could just add a new script command to access that function.
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

Post by SwordPlay »

Thanks you guys.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I added it. Wasn't as straightforward as I thought... Wait a day. plotdict entry
Last edited by TMC on Mon Sep 18, 2017 7:37 am, edited 1 time in total.
Post Reply