Is there a way to create overlapping textboxes?

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Is there a way to create overlapping textboxes?

Post by sheamkennedy »

I want to create overlapping textboxes so that I can make an "interruption" from one textbox to the next.

An example of what I mean:

Code: Select all

  |‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
  |Hello, my name is John. Welcome to our  |
  |peaceful town. Nothing bad ever seems   |
  |to happen he|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|         |
  |____________|   GODZILLA!     |_________|
               |_________________|

... I hope this displays right for everyone as I'm not sure if the font is monospaced. Also there is no Godzilla in my game. This is purely an example for the sake of getting my point across.

EDIT: Turns out it's not monospaced... took a lot of trial and error to get this to display right on my screen.

Essentially I want to display textbox #1, then after a few seconds of giving the player a chance to read it, textbox #2 will pop up and overlay #1. Currently when I attempted this with my script, #1 vanishes the instant that #2 appears.

Another thing I want is for the textbox #2 to have a smaller width than #1. Is there any way of doing so? I couldn't figure out anything like this in the editor.
Last edited by sheamkennedy on Fri Jun 06, 2014 3:02 pm, edited 2 times in total.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

You need to use scripts.

Doing this with scripts involving slices is a cake walk.
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Post by sheamkennedy »

Spoonweaver wrote:You need to use scripts.

Doing this with scripts involving slices is a cake walk.
So I'd basically have to have textbox slice which would be set to appear at a certain screen (x,y). Do you know if there's any tutorials of this?
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

This sounds like a job for slice collections.

Since by default, slices appear underneath text boxes, probably the easiest way to do this is with two slice collections, and no text boxes at all.

Making a slice collection that looks like a text box is pretty easy. You want a rectangle slice with a wrapping text slice as child. Set the text slice to "Fill Parent: YES" and adjust the padding on the rectangle to add a little space between the edges of the rectangle and the text slice inside.

Then you can display them like this:

Code: Select all

plotscript, fake interrupting text boxes, begin
  variable(b1, b2)
  b1 := load slice collection(6)
  wait for key(usekey)
  b2 := load slice collection(7)
  wait for key(usekey)
  free slice(b2)
  free slice(b1)
end
This will *almost* look just like a textbox being interrupted by another.

The only visible difference is going to be that the lines of the textbox will appear all at once, rather than quickly line-by-line like a real textbox.

if you want that effect, it can be scripted too, but it won't be such a tiny simple script anymore :)
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

Well, the easier way to do this would be to set up a script that displays the first textbox. Then runs a short wait command. Then displays another textbox. This seconds textbox would actually be blank, but would have a backdrop that displays the old textbox with the new textbox on top, using backdrop transparency to still show the on screen character action. You would also likely need to suspend the player's textbox advance for a bit, so they don't skip ahead of the effect.


EDIT: or bob's way I suppose.
Last edited by Spoonweaver on Fri Jun 06, 2014 4:33 pm, edited 1 time in total.
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Post by sheamkennedy »

Both ways sound good to me. I'll give them a try later on. I may go with Spoons way just so I can retain the text-scrolling effect, then interrupt it with the backdrop.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
User avatar
sotrain515
Red Slime
Posts: 59
Joined: Wed Dec 26, 2012 3:23 pm

Post by sotrain515 »

Wouldn't be easiest of all to just make the "Godzilla" slice collection, load it up and then parent it to the "text box box" after a tick or two's wait time?

Code: Select all

lookup slice(sl:textbox box)
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Post by sheamkennedy »

sotrain515 wrote:Wouldn't be easiest of all to just make the "Godzilla" slice collection, load it up and then parent it to the "text box box" after a tick or two's wait time?

Code: Select all

lookup slice(sl:textbox box)
Sounds like a legitimate solution and easiest as far as slices go. Thanks.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

You can parent the slice to a number of different textbox slices. Attaching it to the box means that it will be positioned relative to the box, of course. You can also attach it to the outermost container of the textbox (sl:textbox root) or to the "textbox layer" slice (sl: textbox layer) if you want to give it an absolute position on the screen. Not: if you parent it the textbox layer then it will not be automatically deleted when the textbox is closed, and will appear under textboxes opened later. If you attach it to any other textbox slice then it will be automatically deleted, and you shouldn't call freeslice if it's already delete.
Post Reply