Adding % to custom reporter causes issue


is fine but if I start adding in % it goes wrong

Note: Any existing reporter out in the scripting area keeps looking OK but the one in the category pane goes wrong

yeah if you add ' it goes more wrong

That's because % is a reserved string for inputs in most block-based-languages. So if you add a % into somewhere, it is treated as an input, even though % doesn't seem to look like an input. This is why it may mess up options and read-only inputs. You may try using this string below instead of the standard % character:

⁰∕₀

Though it may be a little weird if your font doesn't support subscript or superscript zeroes, or a division slash, as it is a mixture of 3 characters, superscript zero, division slash, and subscript zero.

This may help you:

⁰∕₀

yeah it makes an input with no input name so it messes up things

no dividing 0 by 0 >:C

i mean really dividing anything by zero isn't that great??? But seriously, ⁰∕₀ is probably your best bet.

haha lol
have you tried to use l'hopital's rule,from the limit that caused 0/0?
loool

That's not division by zero, I say ⁰∕₀ because it looks very similar to a percent (%) symbol. I know that division by zero is undefined, but you could now that this is 0/0.

I was just joking,to show how nerdy i am when im not doing math

Thanks for your efforts - it did look a bit strange - looked more like 0 / 0 (e.g 3 chars wide) so I've done this instead for the moment

As long as the % is attached to some other text it doesn't upset things

We know about these problems; they're in the When Things Slow Down™ list. (As all telephone hackers know, in-band signaling is a bad idea.)

I think the %varname thing was originally a bug, but it turned into a feature because it turned out users like it as a shortcut. But I seem to remember we had added a special case so that % as a word all by itself would work as the user intended. But apparently there has to be some text before it to work! You learn something every day...

I can't reproduce this. I can add single percent signs to any custom reporters, just make sure they're not the first letter of a word.

untitled script pic (3) and in the palette: Screenshot 2022-11-09 at 23.49.53

untitled script pic - 2022-11-09T235839.468 => untitled script pic - 2022-11-09T235852.310

So what @jens says is that he can add percent signs to any custom blocks, as long as it isn't the first letter of a word. It's better to just place percent signs at the end, so things don't mess up.

I found a solution! Use an invisible character (e.g. zero width space) in front of the percent sign, so that the percent sign won't be the first letter of the word. It prevents things from messing up. So copy and paste this string below and use it in the block editor:

​%

You see that it looks like a normal percent sign, right? But when copied and pasted, it doesn't break and mess up the block, right? This is because the percent sign is put at the second character as the zero-width space is already the first letter. They're only treated as inputs if the first letter is a percent sign. This is why when you copy-paste the text above it doesn't mess up the block.

Hope this helps! :slight_smile:

That strange - both me and @dardoro get the same effect
But your example is a bit simpler than ours
Could you try one with a menu dropdown as a second slot and see what happens?

That works :slight_smile:


I'd tried doing things like that but my attempts failed - what is the unicode of the char that you used?

U+200B (Zero Width Space) and U+0025 (Percent Sign)

You could also try % (fullwidth percent sign, U+FF05).

To clear up some confusion, here's an explanation of what the bug is.

Let's take this block,
untitled script pic (5)

As you can see, there is a menu in the second input, and a read-only menu in the third input. The type doesn't really matter.

When you add a %, it moves the menus to the input to the left
untitled script pic (6)

But when you stick a % after an input, a menu is moved to that non-existent, input
untitled script pic (7)

What's really happening is, the menus are mapped out like, menu 1 goes to input 2, and menu 2 goes to input 3. How it finds the inputs is not the way you'd think. It just finds the % signs in the block spec, which, in this case, is test %n % y %n %s. Basically, it's just menu 1 goes to second %, and menu 2 goes to third %.

Now If the % isn't the first letter of a word, or by itself, meaning, there's text in front of it, it skips that.

tldr
The menus are mapped to the block spec, using % signs, not the actual inputs.