Partial TUI support. Errors on phase 1.

Ported error() to detecting if it's TUI or GUI. Also several variable
fixes for the new $options.