You too can sell a script to the most influential TV show in the world - if you know the formula.

Let's pretend it's your job to watch Star Trek.

You start on the morning of New Year's Day. You've got to sit through every episode ever created - the 80 produced for the original series, seven seasons of The Next Generation, and the latest episodes of Voyager and Deep Space Nine. You've also got to watch the seven movies, half a dozen specials, and 22 morning cartoon episodes.

Working 9 to 5, five days a week (holidays off), you'd be punching a clock for 10 weeks - until mid-March.

Still going strong with more than 400 hours in the can, Star Trek is an insatiable maw that devours scripts and eats story pitches like popcorn. From its first episode ("The Man Trap," aired September 8, 1966, on NBC) to the current run on the Paramount network, UPN, the franchise has produced a grand total of 16 seasons - surpassing the 14 of Ozzie and Harriet, the longest-running TV show in history. Unlike the all-American Nelsons, however, Star Trek's characters have an appeal that is universal. Two years ago, sailing on a ferry from Brindisi, Italy, to Piraeus, Greece, I caught Jean-Luc Picard on screen in the ship's rec room, dubbed in Greek. The same thing could have happened in Munich, Bombay, or Perth - the show is broadcast in more than 100 countries, worldwide.

What sets Star Trek apart from its classic TV counterparts is, of course, its otherworldly venue. Science fiction is a discipline demanding lateral thinking, techno-fluency, and a sense of the cosmic joke. It's tough to come up with fresh ideas, show after show, season after season. That's why in 1989 - the third season of The Next Generation - the producers decided to make Star Trek the only show on network television willing to consider unsolicited, or "spec," scripts.

What this means is that any of the program's far-flung fans - from Cyndi Lauper to the Dalai Lama - can pitch ideas to the producers and dream of seeing their name in lights.

That's the good news. The bad news is it's a hell of a lot harder than you think. Selling a story requires a working knowledge of where Star Trek fits into our collective consciousness: what it is, where it came from, what works, and what doesn't.

Stardate 49375.4: Making its way through the Delta Quadrant, the United Federation of Planets Starship Voyager encounters a grim situation. The denizens of a double-planet system, inexorably linked by the grip of gravity and millennia of conflict, are locked in a religious war. The population of the smaller world, lacking advanced technology, is about to be mercilessly crushed. Voyager can even the balance of power, but any interference, Captain Janeway insists, would violate the Prime Directive. First Officer Chakotay, recalling how his Native American ancestors were massacred five centuries ago, violently disagrees. The two struggle for control of the bridge, and Chakotay knocks Janeway out. He then races through the ship to enlist the help of his lover - the half-Klingon chief engineer, B'Elanna Torres - but finds her in the arms of Tuvok, the Vulcan security officer. As the two men face off we cut to sick bay, where Kes - the wily Ocampa medical intern - is reprogramming the holographic doctor to synthesize a stash of highly addictive Sikarian pollen....

What's wrong with this picture? To anyone familiar with the basic tenets of the Star Trek universe, the cognitive dissonance is as jarring as seeing Nancy Reagan with a nipple ring.

That this is so testifies to how completely Star Trek and its icons have gotten under our skin. More than a prime-time fantasy, it's our fin-de-millennium mythology: a vivid and indelible tattoo upon the modern American psyche.

"I can't think of a bigger phenomenon than Star Trek," says Lolita Fatjo, the spunky, gap-toothed preproduction and script coordinator whose desk serves as a receiving platform for the more than 1,000 spec scripts that flow into the Hart Building on Paramount Pictures's Hollywood lot every year. "Sitting in an airport, a hotel lobby, wherever, if someone sees that I have anything to do with Star Trek, it's instant recognition. There are a lot of avid fans out there, and some of them are completely extreme."

Is that a good thing?

She tilts her head. "If you're going to be fanatical about something, this is a positive thing to be fanatical about."

It's an easy obsession to fall into. Touring The Next Generation stages a few years back - standing on the bridge, in Captain Jean-Luc Picard's "ready room," and behind the pulsing control panels of the transporter - I felt the giddy rush of awe and reverence that one experiences in the ruins of the Acropolis or on the corner of Haight and Ashbury: here was the spawning ground from which an entire mythos had sprung. But unlike the monuments of the Greeks or the Freaks, this one still flourishes. The Star Trek gestalt, with its credo and its characters, is infinitely more popular today than it was in 1969, when NBC - within weeks of Neil Armstrong's tentative stroll on the Moon - canceled the show after three lackluster seasons.

That strange bit of timing might hold a clue about why the original series withered - and why The Next Generation and Voyager (which premiered in 1987 and 1995, respectively) have flourished. In the 1960s, exploring the cosmic frontier was an integral part of America's destiny. We had the genuine article: from those breathless first steps at the Sea of Tranquility to the nail-biting heroics of Apollo 13 and the wacky lunar roadster rides of later missions. But the Apollo program ended in 1972, and the last dreams you and I might have nurtured of visiting outer space - at least the Moon, for chrissake - exploded with the Challenger in 1986.

One year later, Star Trek: The Next Generation - with its elegant new Enterprise, enlightened crew, and Congress-proof mission - became our surrogate manned space program.

Rick Berman, executive producer of various Star Trek shows since 1987, puts a populist spin on it. "Star Trek deals with a sense of awe. It deals with a hopeful future. And it deals with a family of people - whether they're on a space station or on one of the Enterprises or on Voyager - from all different races. Men and women who work together, who love each other, and who explore together." He nods toward his desk, a tip of the hat to the ironically blindfolded bust of Gene Roddenberry perched near its edge. "That's pretty cool stuff."

It was Gene Roddenberry, of course, who created the original Star Trek, and who ruled over The Next Generation franchise with a velvet fist. Roddenberry died in October of 1991. Today, he's spoken of with a dry reverence that indicates he might have been both a visionary and a total prick. (For 20,000 words on that theme, see the preface to sci-fi maverick Harlan Ellison's new book, The City on the Edge of Forever.) Berman ultimately received the Star Trek mantle from the man called Great Bird of the Galaxy - a moment he recalls well.

"It was a Thursday morning," Berman says, "and Gene knocked on my door carrying this huge mantle. I had no idea what he was doing in here; he just passed it to me and left."

The facts of the matter are only slightly less strange. Roddenberry took notice of Berman - then a fresh young vice president of development at Paramount - at their first formal meeting in 1987. Roddenberry liked him enough to ask him to lunch the following day. During that second encounter, Berman remarked that he'd done a lot of traveling. Roddenberry, an inveterate wanderer himself, smirked.

"Oh yeah? So what's the capital of Upper Volta?"

Berman smirked back. "Ouagadougou," he replied.

That did it. Twenty-four hours later, Roddenberry invited Berman to leave his post at Paramount and produce the new incarnation of Star Trek. It was a risk, since everything about the show (a syndicated, hour-long sequel to a failed science fiction show) spelled disaster. But Roddenberry had the last laugh - and he's laughing still.

"Gene's ghost is my greatest inspiration, and my greatest limitation," Berman admits.

"Star Trek is a formula. It's not my idea, it's not your idea, it's not Paramount's idea. It's Gene Roddenberry's idea of the 24th century, and it's very important for me to remember that. Not because I'm 'faithful to Gene's legacy,' as people love to write; it's because that's what Star Trek is. To change that is to not be doing Star Trek anymore."

Roddenberry's creation is a hopeful, idealistic, and arguably absurd view of the future: an era in which racism and poverty have been vanquished, and mankind combs the cosmos with a smile and a shoeshine. This vision is the genome that has defined Star Trek for three decades.

It's a DNA string with an infinite potential for variation - but an unwavering premise.

The "limitation" Berman alluded to isn't some theoretical conception. Everything about the formula - from the Prime Directive to the do-good chemistry among the officers - limits the arena of conflict. It's a frustration that everyone who's ever written for the show has had to wrestle with. "Gene," Berman remarks, "had incredibly harsh rules. He believed - at least when he created The Next Generation, though he didn't feel this way with the original series - that Starfleet officers didn't squabble, that they were above all that shit. That sounds great, but it's terrible for writing drama."

After years of squeezing into Roddenberry's conceptual corset, something had to give. Star Trek: Deep Space Nine, the "evil twin" of the flagship show, provides a narrow escape valve for stories that don't fit the mold.

"When Michael Piller and I created Deep Space Nine, we said to ourselves, 'We gotta be able to generate some conflict from inside our cast.' We wanted that, but we didn't want to break Gene's rule. We decided that the conflict would come from within our characters - but not from the Starfleet humans. So we brought along Odo, a grouchy security officer, and we brought along Quark, a shifty Ferengi. And we put all these people on Deep Space Nine, which is an inhospitable environment.

"That was a way of bending Gene's rule without breaking it. And we do that every day. We do it with the language that's used, with the way stories are told, and with what stories we decide to tell. And if we find a story that's based on something Gene felt very strongly about, it becomes a big limitation." He sighs, glancing briefly at the Roddenberry bust. The blindfold is slipping.

"I don't know, maybe there is some loyalty to Gene in all this."

The Cliffs Notes version: writing for Star Trek, easy as it may seem, is one of the toughest gigs in television. Jeri Taylor, a Hollywood-tempered idealist who co-created Voyager with Berman and Piller and now inhabits Roddenberry's former office in the Hart Building, spells it out.

"Many, many writers and producers went through a revolving door here because they simply couldn't accept the limitations and kept trying to change the concept. And Gene wasn't about to have it changed. Finally, the group that became cohesive - that's still here now - worked within those limitations."

"When people show us that they can write this show," agrees Berman, "we embrace 'em, we pay 'em a lot of money, and we put 'em on staff. Because they're so hard to find. You have to know something about science, about astronomy and physics and all that shit. You have to write within the rules of Roddenberry. And you have to write in a style that's both modern and stylized at the same time. Star Trek's a period piece; you can't write in a contemporary fashion. If a person is capable of writing a 19th-century drama, that person is probably more able to do Star Trek than somebody who can write the greatest NYPD Blue."

So, will Star Trek's producers continue to look at unsolicited scripts?

"I would love to get rid of our freelance policy," Berman declares. "I would love to have enough quality staff writers who were bringing us great ideas and turning out scripts that were rewritable without major difficulty. But it's just not the case. So, if there are people out there who are interested in writing for the show, they should stay interested. Keep the cards and letters coming."

You wanna go to red alert in scene 68? OK, why don't we have Chakotay say, 'Red alert.' Shit, then we've got everyone saying, 'Red alert' ... from scene 73 through ... everything, it's just going to be 'red alert.' That's not a problem for you guys?"

Brannon Braga, a Voyager producer and much-decorated veteran of The Next Generation, is on the phone to the set. A huge fruit basket full of whiskey, gummy bears, and toy flying saucers - delivered that morning, when his Hugo Award for the final Next Generation episode was announced - rests on the floor.

There's no place to sit up straight in Braga's office, just a big fat sofa and the kind of chairs that swallow you whole. Disappearing into one seat is Kenny Kofax, a very nervous freelance writer waiting to deliver his pitches. Fifteen seconds later, Braga hangs up the phone and props his sneakered feet on his desk - waiting, dubiously, to be dazzled.

"OK, what've you got?"

Kofax begins talking. He's loud and he's fast. His first pitch is for an episode in which a bunch of vile Kazons infect Voyager with a computer virus that forces it to go faster and faster - much like the bus in Speed. Braga doodles space babes on a legal pad, nodding. He finally cuts Kofax off: too derivative. OK, no problem, the next idea is even better: Voyager stops at a planet for food supplies and comes across this weird object in a vegetable patch. It turns out to be the apparently lifeless carcass of Data's evil brother, Lore. The captain.... Braga shakes his head impatiently. How did Lore get out there in the first place? Impossible. Absurd.

Kofax is breathless and sweating now. Braga's leafing through his Handbook of Fish Diseases. One last chance. The warm up - the pitch.

"The crew of Voyager takes R&R on this M-class planet. Right? Really nice place. OK? Everyone has a blast. But as they're about to return to the ship, a native woman runs up and stops them, and it turns out that Lieutenant Tom Paris has gotten her pregnant...."

"Whoa, hold on." Braga swings his feet to the floor. "We didn't do a good job on Paris the first season. He came off looking like a sleaze; now we're trying to decreepify him."

"OK, say they were having, you know, a real relationship -"

"Sure, but how do we handle that? It makes Paris look awfully irresponsible if he gets an alien pregnant. He didn't use a condom?"

"Well, uh, she's an alien, maybe -"

"Of course. We could have him say, 'How was I to know that sticking my tongue in her anus would get her pregnant?'"

Ten minutes later, Kofax is out of there, older but wiser. His fate, Braga assures me, is not unusual. It's the rule rather than the exception for writers to slink out of pitch meetings with their tails between their legs. One problem, as Braga wryly puts it, is that "we've done everything." But the main stumbling block is that few writers intuit the ingredients of a great Star Trek story.

"The perfect Star Trek script," reveals Braga - who has authored or co-authored almost 30 episodes of The Next Generation and Voyager - "begins with a great science fiction concept that allows you to tell an exciting adventure, while at the same time serving as a metaphor for contemporary humanity. For instance: a Next Generation show called 'The Host.' Someone pitched a story about host bodies and worms, which was at first glance a repulsive idea. But it would turn out to be the best love story we ever did. Why? Because one of our characters is forced to confront the true nature of love. Is it the person? The body? Both? That's classic Star Trek, right there. The two-parter we did about the Borg - 'The Best of Both Worlds' - was another. A great villain, based on the concept of cyborgs with a collective mind. The Borg represent everything the future humans despise. Perfect. That's what we look for, what we strive to do week after week."

Jeri Taylor, whose Star Trek credits include such controversial, social-minded episodes as "The Outcast," expands on the theme. "Star Trek is very much a series about storytelling; at the heart of every episode, I think, is an intensely personal story. Something that shows character growth or development; some kind of emotional conflict for one or more of our people.

"Beyond that, we hope to have something that makes it uniquely 'Star Trekkian' - usually a presence or anomaly that gives it that science fiction spin. Finally, conflict being the art of drama, we need jeopardy of some sort. It's either bad guys, an anomaly that's threatening to crush us, or it can be, of course, inner jeopardy, emotional jeopardy. But I think our audience likes action, likes adventure, likes the idea of us out there against the unknown, the monsters, the evildoers.

"So, there are the elements that we look for. Not every show has all three. But when we listen to pitches, we're listening for one of those elements to emerge and knock our socks off."

The preproduction office has a sheaf of submission guidelines that are mailed to prospective writers of Voyager and Deep Space Nine. They're warned to steer clear of two-part scripts, avoid sequels, and never, ever use characters from the original series. But one thing that writers shouldn't shy away from is using the new characters in offbeat, imaginative ways.

"Contrary to popular belief, we have a pretty loose ship around here." Taylor waves her hand with a gesture that embraces all 15 decks of Voyager. "People think we know where we're going, that by the end of a season we'll have these character arcs, that this is going to happen, that's going to happen, et cetera. It's infinitely more haphazard. We sort of take a step and see where it takes us, and that leads us to another step. We let the characters evolve, we let the stories evolve, and I think it's much more exciting that way. It's a long journey - and we'll have to find the textures of that journey as we go."

"Chakotay out.... Fuck!"

At the Paramount studios on Melrose, the Star Trek: Voyager episode "Tattoo" is in production. Stage 16 has been transformed into a steamy alien jungle, and three members of the Voyager crew are scanning for humanoid life signs. But Robert Beltran, the actor who plays First Officer Chakotay, has dislodged his communicator pin. They set up the scene again - for the third time.

Production of each Star Trek episode takes seven to eight days, but the process starts with an idea that may take months to germinate. If the seed of the story is a spec script, it can take far longer. Lolita Fatjo has been in that loop for more than seven years.

"A few different things can happen with the scripts," Fatjo explains. "We have union readers who do a one- to two-page synopsis, or 'coverage,' for each script that comes in. When they return those to us, somebody on the writing staff reads them. From that a determination is made on whether or not we want to do anything with the script at all. Ninety-nine percent of the time nothing's gonna happen." She shuffles around her desk. "They're gonna get this letter back with my autograph, saying, 'Thanks, but no thanks. Please try again if you would like to.'"

Just five writers over the past eight years - Ron Moore ("The Bonding"), Melinda Snodgrass ("Measure of a Man"), Rene Echevarria ("The Offspring"), and Dennis Bailey and David Bischoff ("Tin Man") - have had their freelance teleplays bought and produced. (Three of whom, true to Rick Berman's claim, have at one time been on staff.) Somewhat more likely (a 1 in 100 chance) is that the producers will decide to extract a script's basic idea and rework it.

"We'll bring the person in," Fatjo explains, "and they'll get the chance to write the story outline. For that we pay anywhere from US$6,000 to $9,000 - and their name appears on the credits."

So why ask for scripts rather than story ideas?

"Because we'd be overwhelmed. We're already overwhelmed with scripts - and it's much harder for someone to sit down and write a 55-page script than it is to beat out a 6-page story outline."

One scenario seems to occur fairly often: A writer sends in a script and, though it misses the mark, the producers like the way he or she thinks. At that point, the writer will be called back in - a la Kenny Kofax - to pitch some new ideas. It's an oral process, and notoriously nerve-racking.

"All we're interested in hearing," claims Ron Moore, "is the beginning, middle, and end. We have so many things in development and so many things we've decided not to do that we can quickly tell you what is and isn't going to work. Once people have given us a quick, salable idea, we can then say, 'OK, tell us more.' But when they're pitching, we like them to be succinct."

Eric Stillwell was the freelance writer who dreamed up the story, but not the script, for "Yesterday's Enterprise," considered by fans and staff alike to be one of the best episodes of The Next Generation ever produced. He also pitched "Prime Factors," one of the better episodes from Voyager's first season. He and Fatjo now travel the world organizing Star Trek conventions and conducting writing workshops, where they offer their wisdom to the masses.

"The best thing in pitching," Stillwell advises, sitting on the corner of Fatjo's desk, "is if you can take your entire story down to one sentence - like something you'd read in TV Guide."

The summary of "Prime Factors"?

"Members of the crew mutiny in order to obtain a technology that can send them home. There it is; and that's the element that Michael Piller pulled out of the rubble."

But is it really that easy?

Stillwell, a beefy guy, shrugs. "We created the workshops because thousands of spec scripts come into this office every year. Most of them are awful because people don't follow the guidelines. A lot of times people approach writing for Star Trek with the idea that there's something they don't like, so they're going to 'fix' it. The bottom line is that it's not broken, and nobody needs to fix it."

That's one common mistake. Another is focusing stories on alien races to the exclusion of the principal cast. To work as an episode, every story has to challenge one or more of the main characters on a personal level. Putting their lives in danger isn't enough, Stillwell explains - that happens every week.

Back at Stage 16, the crew is breaking for lunch. Brownies and bowls of M&M's sit on a table near the electrical boards. Roxann Biggs-Dawson, Voyager's half-Klingon chief engineer, slices a bagel. Off by the makeup station, Tim Russ - aka Tuvok, the starship's Vulcan security officer - leafs through next week's script.

Russ, 39, is unusual among the cast in that he was a Star Trek and sci-fi fanatic since childhood. He accepts a peach, cuts into it, and offers some advice for would-be writers.

"Watch the show. See how it flows. If you can, transcribe an episode and follow that format. Also, keep in mind how much it costs to produce a show. The budget is an element some writers might not think of, but it's important. If you can come up with a good episode that doesn't cost a lot of money, it gives you a much better chance. An interesting story that takes place on the ship itself, for example, is something they'll snap up in a minute - if it hasn't been done before."

"Many of our choices do come down to money," Jeri Taylor later confirms. "Everybody in the audience is hoping, 'Wow, we're going to the Delta Quadrant! We're gonna see really weird aliens! There'll be cabbage people, and beast people!' The problem is, making those things believable is extremely expensive. We do not have a feature film budget; we cannot do the kinds of things that happen in Jurassic Park. Because of this, we end up with humanoids with bumps on their foreheads. That's not a limitation we ourselves have set; it's one we strive to get around and usually can't."

One thing to bear in mind, as you start in on draft number 47, is that even the old-timers have written their share of duds.

"My best episodes are highly complex, ambitious science fiction mysteries like

'Projections,' 'Phantasms,' and 'All Good Things,'" notes Brannon Braga. "My worst episodes are highly complex, ambitious science fiction mysteries that are poorly written. When that happens, they are incomprehensible." He emits a snorting laugh. "There's a Next Generation episode I wrote with Ron Moore: 'Aquiel.' A technical murder mystery combined with a lukewarm romance. At the end you find out the dog did it. It was terrible."

"It was a disaster," agrees Moore, now supervising producer of Deep Space Nine.

"I also did a rewrite on a Next Generation episode called 'Rascals.' It was an absurd premise. An away team comes back to the Enterprise, and they all turn into children.

I never liked the idea, I never thought it was going to work, and of course I was the guy who had to make it work. I still look back on it and cringe."

Brannon Braga grew up with his hippie mother alongside the canals in Venice, California, and his dark, hyperactive imagination has produced the show's most macabre episodes. Tales of his libidinous exploits circulate through the Paramount corridors like deuterium gas, creating a sort of mythos within the mythos.

"I'm very different from the people who created Star Trek," he states, stalking into his office at 9:15 a.m. and groping, red-eyed, for a mug. "I consider myself a profoundly flawed human being with deep-seated perversions. I think Star Trek allows me to explore what I wish I was like."

He gulps his coffee and orders breakfast. In 15 minutes, he's got to be sharp as a razor, ready to leap into the heart and soul of Star Trek's scripting machine: the biweekly "break" meeting.

It works like this. Let's say you pitch a script, and the producers bite. They call you in, knock the idea around for a while, and send you home to write up a new story outline. That's a quick study - focusing on the characters and action and not worrying too much about technobabble, or what the Space Anomaly of the Week is going to look like.

What comes next is the break - a fast-paced brainstorming session in which the pitcher, the producers, and the writing staff assemble in Taylor's office with a dry erase board. This is where the muscle work of the creative process gets done - where an episode is jackhammered into its component scenes.

"The break we'll be watching is for an episode called 'Prototype,'" says Braga as he walks down the hall. "It was written by a freelancer named Nicholas Corea. Eight days ago, Corea pitched the idea of robot wars; based on that concept Michael Piller gave him the assignment. After a couple of shots at an outline, he came up with something we could sink our teeth into."

The break begins at 9:30. Within 15 minutes, Corea's basic premise has been eviscerated, and a completely different opening, or "teaser," is up on the board. But Corea isn't phased; a veteran of Tinseltown, he takes inspiration-by-committee in stride.

What's most amazing is how democratic the process is. Everyone has his or her own point of view and, though Taylor drives the process, no one dominates.

"I have this image," Braga muses. "Act One. It's late at night, engineering, and the crew is standing around in pajamas -"

"It's $2,000 for a pair of pajamas," scoffs executive story editor Ken Biller. "So we'll get to the big space battle in Act Five and they'll say, 'Sorry, can't afford it; we blew the budget on pajamas.'"

"Well, Janeway and Torres could be in pajamas -"

"Why don't I want Janeway in on this?" Piller interjects. "It's a gut reaction; I just don't want her in the scene -"

Corea says little during this free-for-all. He's taking notes at warp speed. The whole thing is an education, a lesson in the kind of detachment a writer needs to survive the many-headed monster called Star Trek.

Late in the afternoon, when the break has ended, Braga returns to his office. He pulls a bottle of 12-year-old scotch out of his gift basket, leans back, and extracts a dog-eared biography of the Marquis de Sade from the shelf behind him.

Braga has been at Paramount for five years and has worked on more than 150 episodes, seeing his ideas shot down and reworked by half a dozen people. If he could write one show entirely on his own - total freedom, no one else involved - what would he do?

"That's easy." Braga grins, and slides the hefty tome into his satchel. "I've always wondered what people really do on the Holodeck."