I remember an episode of a TV series, I guess late 60s/early 70s. The protagonist (I think a writer) seems to have spells where he becomes some kind of SF/Fantasy warrior in an alien or future world. I vaguely remember plastic armour and a sword or ray pistol. It could be that the setting is from one of his own books. If I remember correctly the point was whether it was real or an hallucination.
Anybody know the name, series, and whether it was based on a book?