Prevent creating a global variable with the same name as a local one

This also adds a dialog box explaining why the variable could not be created.

Fixes #119.
Fixes #349.
Fixed.