Textbox slice visibility control

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

Moderators: marionline, SDHawk

Post Reply
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Textbox slice visibility control

Post by kylekrack »

I'm using a slice collection for text box visuals for better or for worse, but I'm loading actual textboxes and then hiding them to handle the mechanics of them. This works fine when I use the show textbox command, but there's a frame of delay with automatic textbox advancing.

For example,

Code: Select all

showTextbox(n)
setSliceVisible(lookupSlice(sl:textboxroot), false)
this works fine. However, in my main game loop, when I call setSliceVisible(lookupSlice(sl:textboxroot), false), it shows the textbox for a frame before hiding it. How do I intercept the draw call for a textbox before it shows up? Right now, I'm working around it by setting "show box" to false on all textboxes, but I'd like to use a scripted solution if it's possible.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Re: Textbox slice visibility control

Post by TMC »

Set sl:textbox layer invisible rather than sl:textbox root. The root is the container slice for a single textbox, so it's created and deleted as textboxes appear. The layer is permanent.

When you use the "show textbox" command (or "use npc") the textbox is created immediately so you can manipulate its slices (note: there is a backcompat bit that disables this), while textboxes opened any other way (from outside the script interpreter) will already be visible for a tick before any script can modify them. This is a problem that needs to be improved. I want to add a script trigger run whenever a textbox is opened.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Re: Textbox slice visibility control

Post by kylekrack »

That's what I assumed. Didn't see the textbox layer slice. That's much easier to access.
My pronouns are they/them
Ps. I love my wife
Post Reply