Type in a number and your cube would be n x n x n units in volume. If you type a negative number, the cube would appear upside down (unintentional but cool). Hold G to see the grid. If you type a number higher than 479 or lower than -479, then the cube would appear offscreen. Made using simple math.
The Z Position is Usually in 3D things, like cubes, however of course there is no real version of z position in scratch because the z position can really be anything on a 2d scale. However, the way I did this is by using "z squares", which basically means that the x position is always the same as the y position, so if you were to draw a line from '0, 0' to z, then it will be diagonal, which can be easily used to make a cube. Formula used for approximating z pos: (sqrt(x*y)) or ((sqrt(x)*(sqrt(y))