Draw Pattern block

I made this a little while (well, it feels like a little while, even though I've only been a Snap! member for like a month) ago. It takes a list with a specific set of commands and then draws according to them, and it certainly could be improved upon, but I'm pretty happy with it.

Clicky-click here to check out my project!

Personally, I'm slightly dumb, how do you use the list part of the block? o-o

You put a list reporter (list [_]) there. The list can contain the commands and specified in the comment:
\nl - Moves the pen up 10 steps
/nl - Moves the pen down 10 steps
_ - Jump forward 5 steps
(Any #) - Moves the pen forward so-and-so many steps

For example, (list [5] [_] [/nl] [5]) would first draw forward 5 steps, then jump forward 5 steps, then start a new line downwards and draw forward 5 steps.
Really, the best way to figure it out is to experiment with it, but did that make sense? I included a draw-heart block, (made with the draw pattern block obvs) looking at the code for that might be helpful for you.

Ohhhhh.. I was looking at the code and didn't see the _ and assumed it was a blank space.. Haha.

Personally, it is a bit tedious to work with the block with the system... it could be better, like maybe incorporating 2d lists to repeat certain things? Like...

Pen Draw Block script pic

This would work as if it were just a single list reporter, it becoming identical to:

Pen Draw Block script pic (1)

I'm not sure how to implement that. Possibly an if (var that takes list) contains (list) to sense it, but I have no idea what the next step would be.

I found a solution:

untitled script pic (1)

This simple thing combines it all into a single 1 dimensional script :smiley:

Note: Each item has to include a space before it begins now so that it can actually split it by word.

I just can't figure out how to implement this and have it work flexibly, as I can't map spaces over a multiple-input list in a custom block without knowing the length of each nested list, which I can't figure out.

I'm working on a block... Don't worry...

Or: do you have a length-of-each-item-in-list block? Because if I had that it would be super easy, I just can't find one.

Nope. Trying to figure that out.

EDIT: Turns out I don't need to go. The search continues...

Is there a reason you read the list right to left? If not, you should just say
Pen Draw Block script pic

Hmm. I hadn't thought of that, and no, there isn't a reason it reads right-to-left.

EDIT: Just for backwards compatibility and I don't want to change the draw-heart block because I'm too lazy right now, I kept in the old block (the one that has code that makes it always read right-to-left) but labelled it as deprecated.

Is my solution not what you are looking for?

@pajamaclaws21 I figured it out!

:link: 3D List To 2D List :link:

Please read the comments as they contain important information.

Oh wait, I see what joecooldoo has done, nice.

Oh, wait... Found a problem. It converts it to every letter, not every item. Im going to fix that.

I fixed it now.

(this post originally was me asking if I could use the 3d-to-2d block in my pattern project. then I saw the flatten block)

EDIT: ASFKLSKJASAK FLATTEN IS A LIST OPTION IT WAS LITERALLY RIGHT THERE IN MY TOOLBOX JAHKJFHSDJAKS