How do I give a text input that supports line breaks

I don’t know what else to say

Does the multiline block from the Strings, Multi-line Library do what you need?


at the bottom right of the create input dialog, there's a little gear that lets you make various complex inputs. a multiline input is in SPECIAL > MULTILINE. SPECIAL > CODE is the same, but with a monospace font.

I want to make it so that once you click a sprite then you can enter in a thing with line breaks

Could you post an example of what your after that doesn't accept line breaks and then we can see exactly what your asking for and come up with a solution?

I tried using the prompt thing via JavaScript and the ask block but it doesn’t seems to support line breaks because I keep getting errors when giving a input via those methods which don’t appear when I give the input via testing reporter

so like an ASK block but with multiple lines? the easiest way to do that would probably be to ask multiple times, maybe showing a list so the user can see what they previously typed. this by itself wouldn't allow editing previous things or saying where it ends, so to deal with those you have some options:

  1. no editing, set number of lines (for example, the user only types 10 lines, no more, no less)
  2. no editing, specific input to end (maybe "", "end", "done", etc)
  3. the user writes line numbers to create or replace lines, like commodore basic (could be confusing)
  4. a custom text editor using pen (kinda complex, but you can probably take one that someone else made)

there's probably some other things you can do too but those are the main ones that come to mind for me

I'm sorry but I'm not understanding what it is your trying to do

If you could provide an example script that doesn't handle line breaks (but works otherwise) then maybe we can come up with a solution for you :slight_smile:

Well the number of lines are gonna change

I can’t really think of a example script, if I were to give you a example script I would literally just give you a ask block, like @sarpnt said, I essentially want a ask block with the ability to input line breaks

I can’t actually type in it I’m on mobile

a little quarter of a gear. I'm posting this not out of pedantry or one-up-ness, but because when Jens added that feature it took me a few months to realize what the picture meant!

There's no easy way.

I'd be inclined to tell the user to use \ or something to mean newline, and then once having the user's answer, say

which means "split the answer into individual letters, turn \ into newline, and rejoin the string.

I like your answer, but you’ll have to paste it in and that’s a lot of line breaks

Paste what in, the code in the picture? Just save the picture from your browser to your disk and then drag it into Snap!.

I wanna Paste in json

Then you don't even need lind breaks. And also, if you're pasting in text, it doesn't remove line breaks.


you mean a text prompt that you can enter multiple lines in?

Really? I was getting a error that didn’t appear in testing and I thought it was that