Thanks for your elaborate answer, @KIKIvsIT! It both expands the perspective on the problem and provides a nice solution and teaching concept which is relevant for this thread.
I, at about the same time as you published, found out a similar workaround, where I make custom function blocks which returns the values from or do other operations with or on the variable.
I will post that later as a share of an alternative attempt at teaching material for selection logic which I am working on now.
But this is quite restrictive for practical use, and a little confusing with different blocks for the plain standard blocks when teaching.
Maybe there is a way to forward the predefined variables as true variable blocks in custom.ts and I just don´t know about it. But that seems unnecessary, when variables are already fully supported natively, and should turn up in the variable menu when defined in the global scope.In any case, not as a grey block.
I also attempted “export default” for the variable, since it is defined in another file, but then I am told that this is not necessary, since it is already globally available. So there is something strange/incoherent with the ways blocks are picked up from text-based code only in the main.ts file. You can also define new real block variables with the same name without conflict in main.ts, even though they supposedly are in the same scope already, if I remember correctly.
I’ll cross post our common issues here on @jacqueline.russell’s Common errors?, since these apparantly are common for us at the moment, and see if this gets picked up…