Regain control of the ship by escaping with your life and seducing the general. Then pull off the heist of the century by cracking the code and then singing and dancing your way out. Foil your foes with plot twists and betrayals, while bolstering your protagonist with companions and gear.
The winner's story ends happily. The rest... well, that's up to you.