What does this block do

untitled script pic 3 from the metaprogramming library

What is the predicate slot and drop-down for, and why are the slots in the top c shape instead of reporter so you can use all types of blocks?

Your script pic link isn't displaying at my end
[edit]Working now :slight_smile:

Where does this block come from?

I had a play and got it to do this - not sure if it answers your question though

untitled script pic (36)

I mean, the last slot is supposed to be a predicate. But it looks like Jens is replying so let’s see what he has to say

Maybe try to see the source? If devs don't know what the software does, they read the source if it's available. :wink:

(yeah, it's probably just a [scratchblocks]primitive <> :: grey[/scratchblocks] block)

yes, playing around with this block lets you discover what it can do. We use it to write libraries that, e.g. need to log positions after each movement. You can also use it to debug things on the fly:

The ring at the bottom does, indeed, accept any kind of block. In the above example it inserts the payload after each instance of the provided command block. You can also specify a predicate:

which is what we usually need the block for.

Um the source is snap code that I am confused about, not JavaScript.

I mean to click that Edit... thing in the right-click menu to view the defintion (I'm used to calling it the source) of the block

Is there a way to specify which occurrence of the block in the last slot you want? So you are not adding a block after EVERY motion block, but instead the 2nd one or something.

Which ones?

sure, just carefully craft your predicate.

Oh that makes sense. But are the libraries this is used in planned for the future, or to they exist already?

The source is available and is not a primitive block. Good to know. (try it yourself to see full code)
image

first thing that reminded me of is the way mixins in fabric (a minecraft mod loader) work, because it's the exact same idea. and that makes me want it to be able to replace blocks and inputs, like
untitled script pic

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.