I've read that rubbing your hands together could help you maintain lucidity. Also, things like looking at objects and environments and appreciating how real they look could help.

When the zombies came, you could have perhaps made an effort to become lucid again, allowing you to kill the zombies with fireballs or something similar.