Based on characters created in the 1969 pilot for an unproduced series entitled "Sheriff Who?", so called because every week there would be a new sheriff (played by a guest star), who would be killed by Evil Roy Slade.
Although the year is never explicitly given, a calendar is shown during a time passage montage late in the film, going from November into January. The calendar has the right dates for the movie to be set in the Western-appropriate years 1873/74, 1879/80 and 1890/91.
At one point, Evil Roy Slade considers changing his name. He runs through three possibilities, but they all begin with the word "Evil". The third one, "Evil Lee Rich", is an inside joke: writer/producer Garry Marshall co-produced a sitcom called Hey, Landlord (1966) with Lee Rich.