I know Jens thinks that the create variables library and primitives shouldn't exist (among many other libraries & primitives) but I was bored and wanted to challenge myself. Like, a lot. So I took a crack at creating a block in vanilla Snap! that reports the value of a variable just by its name, similar to var_get(name).
I had many trials and failures until I realized the following code outputted something that should work.
This outputs
which is what I am looking for. When I call this, however, I get an error (even when z exists)- there's no error message or anything, the block just glows red.
Again- no error message. Just an angry red reporter. Oddly enough, when I do this,
and call x again, I get the expected output- 1, the value of the variable z.
Is there an error in my code? Why is this happening?
IN A SIMILAR VEIN:
This happened???
I was trying to drag the variable z into the "() input names: ()" block (as shown above), and the variable replaced the input name block. So I pressed CTRL+Z... and then this happened.
Running the block makes the variable x disappear- while the show box for x is still checked. Clicking on the show box makes the variable x reappear for an instant, then disappear again. The only way to get x to stay stable is to set x to a value other than... that... and then re-click the show box. Yeah.
EDIT: I forgot to include the project link!
Here's the project link in case anybody wants to look at all these weird occurences.