Help with costume stiching

in this project, I made a block that takes a chunk, and outputs a stitched costume for it. the chunk is an 18x24 table, where each item in the table is either nothing, a zero, or a dictionary list where one of the keys is "texture". the value of that key is a 20x20 pixel costume. the block should report all of the costumes stitched together according to their order in the table, with the non-lists replaced by a transparent 20x20 costume. unfortunately, the block is too slow, and it slows down everything else. can it be made faster? also, how could this be implemented in a JS function?
Thank you!

examples

an example of a chunk:


one of the blocks in the chunk:
(these are what the sublists in the above table are, although they may have different data)
Screen Shot 2023-04-26 at 4.10.10 PM
a visualization of the costumes in the chunk:
(this is not a piece of data that the program can actually access, it is just for visualization purposes)

the result costume when given the above example chunk as input:
block game stiched costumes script pic-3

(the example chunk is stored in the variable "debug var" in the project)

current code

I haven't read this carefully, but one little thing is that instead of RESHAPE (LIST (LIST 0 0 0 0))... you can just say RESHAPE 0 .... The reported shape is determined entirely by the dimension numbers, not by the structure of the input data.

ok. that makes sense



Why do stacked compiled HOFs break?

Could you give an example?

this works:


but:

and

Oh. Only certain first-input functions can be compiled in the HOFs. But if it can't be compiled it should just work as a non-compiled HOF, not error out. Thanks for reporting this.

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