How to iterate tile painting in PulpScript

How can I elegantly paint multiple tiles to display the same frame?

This test room has two turbines, each with tiles that have 0fps animation frames. They are synced so all the animation frames will always be the same frame.

ezgif-5-1486f7f8de

It's a lot of code to paint those frames... there has to be a more elegant way. Any ideas?

Check out the room code for the "iteration" room. I don't want to post all 240 lines of repetitive manual iteration, but I suspect if better developers than me look at it they might have ideas.

// here are two clumsy ideas on how to affect multiple tiles, if a feature request handled these
// but I think there's a chance that I'm missing some existing way to iterate like this

// option 1 - pass a big array of tile coordinates
// tell 16,6,18,4,18,5,18,7,18,8,16,6,17,6,19,6,20,6,14,3,14,4,14,5,14,6,14,6,14,7 to
// frame 0
// end

// option 2 - pass several tile coordinates
// tell 16,6 18,4 18,5 18,7 18,8 16,6 17,6 19,6 20,6 14,3 1, 4 14,5 14,6 14,6 14,7 to
// frame 0
// end

I'm probably missing something. Mimic? Let me know if you have any ideas.

WUC-Basic Iteration.json.zip (9.0 KB)

As promised @jestelle I created a separate post for my iteration woes. Any thoughts would be appreciated!

I was able to make the code quite a bit smaller. Unfortunately, I couldn't think of a good way to make the tells more efficient (I first thought of the emit function, but I think it would only make things worse in terms of performance and clarity).

What did I change: The up,right,left and down events now only store the frame number, that every tile has to be changed to, in turbineFrame. Then changeTurbineOrientation is called, executing all the tells and using turbineFrame to determine, which frame to set all tiles to.

You’ll probably understand it better by looking at the changes yourself. Hope this helps :slight_smile:
WUC-Basic Interation optimized.zip (8.6 KB)

This is great, it's a bit like passing a variable into a function in other scripting languages.

If anyone else has any ideas for iteration, go ahead and post, but I'll mark this as the answer.