If you wanted to write down the script from KotoR, how would you do it? In more linear games it's easy, you'd just write down what happens and who says what. But with a game like this, with branching dialogue and planets you can go to in whatever order you want, how would you transcribe it?

One way I thought it might be possible is to give short codes after each choice, and the reader uses the search function of whatever program they're using to find where to continue, like in many of the faqs on GameFAQs.com. Here's what the prologue from the game would be like this way:

Show spoiler

(hidden content - requires Javascript to show)

[Above a greyish-green planet, a ship is under attack by a horde of small fighters. Green and red lazer blasts fly back and forth as the fighters swarm about the ship, which is hit by a volley of red lazers that explode on one of its wings. The fighters move to other targets as the ship leans awkwardly to one side, having apparently taken a very bad hit.]

[Meanwhile in a cabin within the ship, you are sleeping fitfully, tossing and turning before finally waking and sitting up. You aren't wearing much. The ship takes another hit and shakes violently, and you stand up. The battle can be heard raging outside the ship, tremors rack the vessel as sounds of explosions come from other parts of the ship, and warning alarms blare loudly. A uniformed man suddenly runs in and addresses you.]

Trask: We've been ambushed by a Sith battle fleet! The Endar Spire is under attack! Hurry up - we don't have much time!
1. Who are you? - {WHOY1}
2. The Endar Spire? - {SPIR1}

{SPIR1}
Trask: Did you fall out of your bunk and hit your head? The Endar Spire is the ship we're stationed on - this ship! You probably don't even know who I am, do you? - {WHOY1}

{WHOY1}
Trask: I'm Trask Ulgo, ensign with the Republic Fleet. I'm your bunk mate here on the Endar Spire. We work opposite shifts; I guess that's why you haven't seen me before.
Trask: Now hurry up, we have to find Bastila! We have to make sure she makes it off the ship alive!
1. Who's Bastila? - {WHOB1}
2. Forget it - I'm looking after my own skin! - {CWRD1}

{WHOB1}
Trask: Bastila's the commanding officer on the Endar Spire. Well, not an officer really. But she's the one in charge of this mission.
Trask: One of our primary duties is to guarantee her survival in the event of enemy attack! You swore an oath just like everyone else on this mission. Now it's time to make good on that oath! - {YOU01}

{CWRD1}
Trask: You swore an oath to protect Bastila when you signed up with this mission, just like everyone else in the crew! Now's the time to make good on that oath.
Trask: I know she may not have an official rank in the fleet, but she's the one in charge of this mission and it's our duty to protect her! - {YOU01}

{YOU01}
1. (If you are a soldier-class character - {YOU02}
2. (If you are a scout-class character - {YOU03}
3. (If you are a scoundrel-class character - {YOU04}

{YOU02}
Trask: I've heard all about your reputation: elite combat training, tops in your class. It's no wonder you were hand picked for this mission.
Trask: Word is the officers haven't seen a recruit with your kind of potential in twenty years. But all that potential doesn't mean a thing if you can't deliver when it counts!
Trask: We're soldiers, we're trained for combat. Bastila's going to need men and women like us at her side during this attack! - {HELP1}

{YOU03}
Trask: I heard what everyone's saying about you: you've explored the farthest reaches of the galaxy, you've visited planets I've never even heard of.
Trask: People with your skills and abilities are hard to find; it's no wonder the Republic recruited you for this mission. But now's the time to prove yourself!
Trask: I know you're a scout and not a soldier, but Bastila needs all troops at her side during the attack! - {HELP1}

{YOU04}
Trask: I know all about your reputation, how you used to smuggle spice and blasters along the Corellian Run. I guess the Republic figured since they couldn't catch you, they might as well hire you.
Trask: And I'll admit, the Republic is in desperate need of someone with your kind of skills. Desperate enough to overlook your shady past.
Trask: But now that you've signed on for this mision you're part of the Republic fleet. And Bastila needs all troops at her side during this attack! - {HELP1}

{CWRD2}
Trask: Don't be stupid! You won't stand a chance against the Sith by yourself. We've got to stick together if we want to make it out of this alive. - {OKAY1}

{OKAY1}
Trask: So hurry up and grab your gear. You need to suit up so we can get out of here.
You: Okay.

(If you wait around
Trask: Come on, we have to hurry! The Sith might already be boarding the ship to try and capture Bastila.
Trask: Put your equipment on so we can get out of here.
You: Okay.

[You put your clothes on and pick up your weapon (you have a choice between a blaster pistol and a short sword).]

Trask: Okay, let's move out.
Trask: We should stick together; you'll have more success with a party than on your own.
Trask: Because of the attack this room is in lockdown, but don't worry - I've got the override codes. You'll have to let me unlock the door.

[Trask unlocks the door, then turns back to you. The door slides open, revealing a white corridor. Part of one wall has been damaged, and a utility droid is working on it.]

Trask: Now that the door's open, you better take the lead again.

[You start down the hall and Trask follows. Suddenly a man's voice is heard.]

Carth: This is Carth Onasi - the Sith are threatening to overrun our position! We can't hold out long against their firepower! All hands to the bridge!
Trask: That was Carth contacting us on our portable communicators. He's one of the Republic's best pilots! He's seen more combat than the rest of the Endar Spire's crew put together.
Trask: If he says things are bad, you better believe it. We have to get to the bridge to help defend Bastila!
Trask: There's a map of the Endar Spire and a copy of Carth's message in your electronic journal, just in case we get seperated.
You: Let's move out.

[As you near the door at the other end of the corridor, Trask speaks up again.]
1. (If you are a scoundrel-class character - {TSPK1}
2. (If you are a scout- or soldier-class character - {TSPK2}

{TSPK1}
Trask: That door's locked, and I don't have the codes to open it. You'll have to try to unlock it if we want to get past.
You: Okay. - {UNLK1}

{TSPK2}
Trask: That door's locked. I don't have the codes to open it, but I'll use my security skills to slice into the access panel and open the door.
You: Okay.- {UNLK1}

{UNLK1}
[The door is unlocked and starts to slide open. On the other side of the door, a man wearing the same uniform as Trask shoots at two helmeted figures in shiny metal armor. They shoot back at him and kill him, and he joins a fallen comrade on the ground.]

Trask: These Sith must be the advance boarding party!
Trask: For the Republic!

[With Trask's help, you defeat the Sith soldiers.]

Trask: I've got a feeling that won't be our last battle with the Sith. Good thing we have medpacs to heal our wounds. It might be a good idea to use one now before our next battle.
You: Okay.

[After passing two corridors that are blocked by debris and filled with smoke, you go through another door into a room where more Sith soldiers await you. The bodies of several men wearing Republic uniforms are strewn about the floor. You fight the Sith and move on. The next corridor leads to an intersection where a heated battle is taking place. The Sith take out the Republic fighters with a few well-placed grenades, however, before you can do anything. You fight them and find that all except one of the doors leading to the intersection are damaged and can't be opened. Through that door a man and woman are fighting fiercely with lightsabers. The man wears Sith armor (but doesn't wear a helmet) and wields a red lightsaber, while the woman wields a blue one and wears a light-colored tunic.]

Trask: It's a dark Jedi! This fight is too much for us - we better stay back. All we'd do is get in the way.

[The woman eventually kills the Sith man, but a moment later an explosion kills her too. Suddenly, more Sith soldiers appear.]

Trask: That was one of the Jedi accompanying Bastila. Damn, we could have used her help!

[You defeat these Sith and proceed to another door.]
1. (If you equipped the blaster pistol - {EQIP1}
2. (If you equipped the short sword - {EQIP2}

{EQIP1}
Trask: The bridge is just beyond that door. You better equip your melee weapon. There isn't much room on the bridge, and it's suicide to use a blaster in close quarters.
Trask: I should equip a melee weapon, too. Either that, or I'll have to stay back and use my blaster.
1. Okay. - {EQIP2}
2. What if they have lightsabers? - {WTIF1}

{WTIF1}
Trask: Your melee weapon is made using a cortosis weave. It's strong enough to stand up against anything, even a lightsaber.
[You put away your blaster and take out your short sword instead.] - {EQIP2}

{EQIP2}
[You have arrived at the bridge. A group of Sith soldiers is fighting a few last Republic fighters, and bodies litter the floor. After killing the Sith and looking around to find all the other Republic soldiers dead, Trask speaks.]

Trask: Bastila's not here on the bridge - they must have retreated to the escape pods! We better head that way too.
Trask: The Sith want Bastila alive, but once she's off the ship there's nothing stopping them from blasting the Endar Spire into galactic dust!

[After following a door that leads into another corridor, Trask notices something through another door and stops.]

Trask: Damn - another Dark Jedi! I'll try to hold him off, you get to the escape pods! Go!

[Trask darts through the door to fight him, and a sudden explosion closes the door behind him, obscuring both of them from view. Trask has bought you the time you need to escape, and you make your way to the starboard section of the ship. You hear Carth speak again.]

Carth: This is Carth Onasi on your personal communicator. I'm tracking your position through the Endar Spire's life support systems.
Carth: Bastila's escape pod is away - you're the last surviving crew member of the Endar Spire! I can't wait for you much longer; you have to get to the escape pods!
1. (If you are a scoundrel-class character - {CLAS1}
2. (If you are a scout- or soldier-class character - {CLAS2}

{CLAS1}
Carth: But be careful. There's a Sith patrol just down the corridor. You'll have to sneak past him.
1. Okay. - {OKAY2}
2. How can I sneak past him? - {SNEK1}

{SNEK1}
Carth: First, make sure you have a stealth field generator equipped on your belt. You can't sneak properly without one.
Carth: The generator will wrap you in a cloaking effect so you can sneak past the Sith. Just be careful you don't get too close or he might notice someone's there.
You: Okay. - {OKAY2}

{OKAY2}
[You sneak past the guard (an explosion further down the corridor draws the soldier away, making it easier to sneak by him) and enter a room with a couple Sith soldiers. On the other side of the room is a closed door beside a computer terminal and an unactivated silver droid that looks to be in disrepair. You can't sneak past the Sith here, so you engage them in combat instead. When they have been killed, Carth contacts you again.] - {CRTH0}

{CLAS2}
[You find a Sith trooper down a corridor and kill him, then enter a room with two more Sith soldiers. On the other side of the room is a closed door beside a computer terminal and an unactivated silver droid that looks to be in disrepair. When you have killed the Sith here, Carth contacts you again.] - {CRTH0}

{CRTH0}
Carth: Be careful! There's a whole squad of Sith Troopers on the other side of that door! You need to find some way to thin their numbers.
Carth: You could reprogram the damaged assault droid to help you, if you have enough repair parts.
Carth: Or you could use computer spikes to slice into the terminal and use the Endar Spires's security systems against the Sith.

[However you choose to proceed (you can even do both), the Sith in the next room are killed and you move on to the next room. On the left are a row of entrances to escape pods, while on the right a man in an orange and blue uniform is waiting beside a computer terminal. As he speaks, you recognize his voice.]

Carth: You made it just in time! There's only one active escape pod left. Come on, we can hide out on the planet below!
1. Who are you? - {CRTH1}
2. How do I know I can trust you? - {CRTH1}

{CRTH1}
Carth: I'm a soldier with the Republic, like you. We're the last two crew members left on the Endar Spire.
Carth: Bastila's escape pod's already gone, so there's no reason for us to stick around here and get shot by the Sith. Now come on - there'll be time for questions later!

[The last escape pod leaves the ship, hurtling towards the planet below. As the pod enters the atmosphere, the Endar Spire blows up behind it. The escape pod falls through the air and lands somewhere amidst the tall buildings of a large city.]

What do you think? Would this work for a script of the rest of the game, too?

There are tons of fics along the lines of what you're describing, including mine. Warning to the wise: female Revans outnumber male ones five to one. Female Exiles "only" outnumber male ones three to one.