Microsoft MakeCode

Hide the while loop block?

I would like to hide the while loop in my PXT as ItCanOnlyLeadToTrouble … any chance of just hiding one block in the loops category?

JFo
https://makecode.buildbee.com

I can’t think of an easy way to do this for any of the builtin non-function blocks at the moment (e.g. while loops, comparisons, math operators) - for functions you can typically override the block by adding a d.ts file and adding //% blockHidden=1 to the definition, but some of those built in ones aren’t added in the same way (e.g. for reference while is defined here and here)

If you do end up updating the version of pxt you’re using, it could pick up this change https://github.com/microsoft/pxt/pull/7278 which makes while slightly less dangerous (as in, dragging the block out into the wrong location won’t instantly lock the program)

(Also wanted to say that’s a really cool editor, I’ll have to try it out with my ender 3!)

Oh that bug is hilarious! Love it. I’ve got an ender3 sitting on my desk at the office, too!

…and thanks about the target! We are so excited over here about it because we’ve wanted a good way to show how to make 3D stuff - and go beyond “making shapes” into “making stuff”. There have been other block coding attempts to wrap JSCad before but this is the first time you can hop back and forth between blocks and code, have your lessons walk you through step by step. And all the makecode blocks are neat because we can kinda hide away some of the more complicated bits of JSCad and just let you play. I nearly fell on the floor when I realised you could set a breakpoint and watch your shapes build up.


Now that I think about it, protecting against while() is only part of the battle. Kids are just as likely to type in 99999999999999 in a repeat block …because they can.

I better just internally cap the number of shapes you can make (I think the sprite clone count in Scratch is capped for a similar reason). And then let you have your browser back :slight_smile:

Thanks again!

JFo