function introduction()
    msnMgr:addHeader("The coordinates from the strange dusty moon lead you to a system with multiple planets, though only one lies within the \"Goldilocks\" zone where life has a chance. The ship has barely settled into an orbit when the ship shudders, subtly but noticeably. The crew has no idea what it means but you know that something is amiss with the planet's gravity.")
    msnMgr:addHeader(" ")
    msnMgr:addHeader("\"We're not leaving until we solve this mystery,\" you tell the crew. \"Something down there, clearly artificial, has got us locked into orbit. A decaying orbit, I might add. If we don't resolve this, the ship will enter the atmosphere inside of a week, and it won't be coming back out.\"")
    msnMgr:addHeader(" ")
    msnMgr:addMessage("There's a mixed sense of annoyance and excitement in the crew. They haven't felt very useful overall, and a sense they are actually needed for something again seems to inspire them somewhat. It isn't long before the crew is aboard the shuttle, and after about an hour they've reached the planet's surface, only to find it entirely covered by water.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("Or, nearly entirely. At one of the planet's magnetic poles, there is a platform of some evidently corrosion-proof substance, clearly designed as a sort of landing pad (though for a ship much larger than the shuttle). The water should be frozen here, but it isn't; there must be some geothermal activity at work. With no other alternative, the crew lands in the middle of the pad beside a small structure and exits to look around.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("\"Before you ask,\" you inform the crew, \"the air is breathable. About 30% oxygen, 68% nitrogen. I don't recommend actually breathing it, though. That other 2% includes some unknown elements.\"")
    msnMgr:addMessage(" ")
end

function topsidechoice()
    msnMgr:buildChoice("Take some water samples")
    msnMgr:buildChoice("Investigate the platform")
    msnMgr:buildChoice("Get a better look at the structure")
    msnMgr:finalizeChoice()
end

function watersamples()
    if (ScientistCrew ~= -1) then
        ScientistName = charMgr:getCharColoredName(ScientistCrew)
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(ScientistCrew, "physical")) then
            msnMgr:addMessage("It's fairly easy for " .. ScientistName .. " to get a sample of water--while it isn't exactly washing over the deck here, there's enough spray as the waves slosh about beneath the platform that the crew can easily gather enough without needing to take a swim.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("A detailed analysis might indicate more back on the ship, but initial readings show nothing very interesting. It's plain old water, though with a slightly higher concentration of deuterium than one might have expected. Safe enough to drink, even; the mineral content of the water is low, and it seems fresher than the water aboard the ship.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Since the water on the ship is mostly recycled urine, however, that's not saying much. You idly wonder how many of the crew are aware of this fact.")
            msnMgr:addMessage(" ")
        else
            msnMgr:addMessage(ScientistName .. " sticks their arm over the side of the deck to gather a sample of sea spray, and catches a wave full in the face which causes some to get sucked inside their helmet. The water doesn't taste very salty, they inform everyone.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("In fact it's probably fresher than the water on the ship. Not that surprising, since most of the potable water on board is recycled urine. A fact the crew is either blissfully unaware of, or chooses to ignore.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("That said, there's nothing special about the sample. Further analysis will have to be done back on the ship.")
            msnMgr:addMessage(" ")
        end
        if (charMgr:hasMemento(ScientistCrew, "story2_water_sample") ~= true) then
            charMgr:giveMemento(ScientistCrew, "story2_water_sample")
        end
    else
        msnMgr:addMessage(getColoredNameForCrewWithMost("physical") .. " sticks their arm over the side of the deck to gather a sample of sea spray, and catches a wave full in the face which causes some to get sucked inside their helmet. The water doesn't taste very salty, they inform everyone.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("In fact it's probably fresher than the water on the ship. Not that surprising, since most of the potable water on board is recycled urine. A fact the crew is either blissfully unaware of, or chooses to ignore.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("That said, there's nothing special about the sample. Further analysis will have to be done back on the ship.")
        msnMgr:addMessage(" ")

        if (charMgr:hasMemento(charMgr:crewWithMost("physical"), "story2_water_sample") ~= true) then
            charMgr:giveMemento(charMgr:crewWithMost("physical"), "story2_water_sample")
        end
    end
end

function platform()
    if (MechanicCrew ~= -1) then
        MechanicName = charMgr:getCharColoredName(MechanicCrew)
        if (MechanicName == EngineerName) then
            if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
                msnMgr:addMessage("As far as " .. EngineerName .. " is concerned, nothing like this could have been built on Earth; this much is immediately clear. Even assuming a reasonably shallow depth at this spot (and it certainly seems as if the water is pretty deep here), the slender legs beneath this relatively large platform seem as if they'd be incapable of supporting its weight, even with local gravity only around .75Gs. Clearly some alloy unknown to the crew was used in its construction.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(EngineerName .. " attempts to take a sample, but no tool available is able to even scratch the surface.")
                msnMgr:addMessage(" ")
            else
                msnMgr:addMessage("That the landing pad is very large and very sturdy is about all that the crew can discern. The legs supporting it are all near the center, so it's probably for the best that the shuttle landed there. If it had landed on one of the edges, it seems like the entire structure might have toppled over. Hard to say for sure, and not a theory that anyone volunteers to test.")
                msnMgr:addMessage(" ")
            end
        elseif (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(MechanicCrew, "mental")) then
            msnMgr:addMessage("As far as " .. MechanicName .. " is concerned, nothing like this could have been built on Earth; this much is immediately clear. Even assuming a reasonably shallow depth at this spot (and it certainly seems as if the water is pretty deep here), the slender legs beneath this relatively large platform seem as if they'd be incapable of supporting its weight, even with local gravity only around .75Gs. Clearly some alloy unknown to the crew was used in its construction.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(MechanicName .. " attempts to take a sample, but no tool available is able to even scratch the surface.")
            msnMgr:addMessage(" ")
        else
            msnMgr:addMessage("That the landing pad is very large and very sturdy is about all that the crew can discern. The legs supporting it are all near the center, so it's probably for the best that the shuttle landed there. If it had landed on one of the edges, it seems like the entire structure might have toppled over. Hard to say for sure, and not a theory that anyone volunteers to test.")
            msnMgr:addMessage(" ")
        end
    elseif (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
        msnMgr:addMessage("As far as " .. EngineerName .. " is concerned, nothing like this could have been built on Earth; this much is immediately clear. Even assuming a reasonably shallow depth at this spot (and it certainly seems as if the water is pretty deep here), the slender legs beneath this relatively large platform seem as if they'd be incapable of supporting its weight, even with local gravity only around .75Gs. Clearly some alloy unknown to the crew was used in its construction.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage(EngineerName .. " attempts to take a sample, but no tool available is able to even scratch the surface.")
        msnMgr:addMessage(" ")
    else
        msnMgr:addMessage("That the landing pad is very large and very sturdy is about all that the crew can discern. The legs supporting it are all near the center, so it's probably for the best that the shuttle landed there. If it had landed on one of the edges, it seems like the entire structure might have toppled over. Hard to say for sure, and not a theory that anyone volunteers to test.")
        msnMgr:addMessage(" ")
    end
end

function structure()
    msnMgr:addMessage("A slender cylinder juts up through the center of the platform, approximately ten meters in circumference. The sloped roof is evidently hydrophobic to some extent; rivulets of water wriggle chaotically and unpredictably off the sides without beading, despite the mist.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("There's enough room under the roof, however, for as many as a dozen humans to gather, so even if the crew was interested in risking a breath of air, there'd be no danger of water dripping down their neck while they either enjoyed the fresh air, or suffocated.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("Equally spaced around the cylinder are what appear to be four distinct panels, inset into the cylinder itself with only the thinnest of grooves separating them. Three of them bear no markings whatsoever. The fourth panel is set off by itself a bit further than the others, and contains a cryptic engraving.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("1 + eight + .---- = VIII + F + 1000 = _ 2 O")
    msnMgr:addMessage(" ")

    msnMgr:addMessage("\"Oh come on,\" says " .. getColoredNameForCrewWithLeast("mental") .. ". \"Logic puzzles? Do they want us to find them or not?\"")
    msnMgr:addMessage(" ")

    if (getColoredNameForCrewWithLeast("mental")) ~= getColoredNameForCrewWithMost("mental") then
        msnMgr:addMessage("\"If they--and I think we're all assuming that they means humans--weren't sure who was going to read this, a puzzle makes sense,\" says " .. getColoredNameForCrewWithMost("mental") .. ". \"And this one seems simple enough, if you're human. Clearly those are all ways of depicting numbers and only a human would understand them all.\"")
        msnMgr:addMessage(" ")
        if (charMgr:hasMemento(charMgr:crewWithMost("mental"), "story2_formula_sketch") ~= true) then
            charMgr:giveMemento(charMgr:crewWithMost("mental"), "story2_formula_sketch")
        end
    end

    -- If Distracted then chance to open the middle door accidentally
    if (DistractedCrew ~= -1) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(DistractedCrew, "physical")) then
            DistractedName = charMgr:getCharColoredName(DistractedCrew)
            msnMgr:addMessage("While they begin to puzzle out what this strange equation might mean, " .. DistractedName .. " gets bored and leans against the wall, accidentally brushing against part of the engraving. There is a loud grinding noise from the other side of the structure, and when they check, the crew finds that the centermost panel has opened.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Well, that was lucky,\" says " .. DistractedName .. ".")
            msnMgr:addMessage(" ")
            MiddleDoorOpen = true;
        end
    end

    -- This could be rebuilt so you can do either of them in any order but it's not important
    if (not MiddleDoorOpen) then
        msnMgr:buildChoice("Work out the first equation")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        EquationOneChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (EquationOneChoice == 0) then
            if (MechanicCrew ~= -1) then
                if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(MechanicCrew, "mental")) then
                    MechanicName = charMgr:getCharColoredName(MechanicCrew)
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"The first one is clearly 1 plus 8 plus 1, \" says " .. MechanicName .. ". That third bit there is Morse code for the number 1. Dit dah dah dah dah. So I guess that adds up to ten?\"")
                    msnMgr:addMessage(" ")
                else
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"So the first one is one plus eight plus dot line line line line? What the hell does that mean?\" asks " .. getColoredNameForCrewWithLeast("mental") .. ". ")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Wait, it's not \'line line line line\', but \'dash dash dash dash\'\", says " .. getColoredNameForCrewWithMost("mental") .. ". It's Morse code. I think that's a one. So that makes it 1 plus 8 plus 1. Ten?\"")
                    msnMgr:addMessage(" ")
                end
            else
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"So the first one is one plus eight plus dot line line line line? What the hell does that mean?\" asks " .. getColoredNameForCrewWithLeast("mental") .. ". ")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Wait, it's not \'line line line line\', but \'dash dash dash dash\'\", says " .. getColoredNameForCrewWithMost("mental") .. ". It's Morse code. I think that's a one. So that makes it 1 plus 8 plus 1. Ten?\"")
                msnMgr:addMessage(" ")
            end
        end

        msnMgr:buildChoice("Figure out the second equation")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        EquationTwoChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (EquationTwoChoice == 0) then
            if (MechanicCrew ~= -1) then
                if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(MechanicCrew, "mental")) then
                    MechanicName = charMgr:getCharColoredName(MechanicCrew)
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"The second one is a bit more uncertain since that could be read different ways,\" says " .. MechanicName .. ". But I think we can agree that if each of these is written using a different number system, then that 1000 is not actually a thousand.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"VIII is clearly Roman numeral 8, and F could be a number of things but the most obvious would be hexadecimal, which makes it 15. My gut says the 1000 is binary, so that's an 8. So it's 8 plus 15 plus 8. So 31?\"")
                    msnMgr:addMessage(" ")
                else
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Well VIII is a Roman 8,\" says " .. getColoredNameForCrewWithMost("mental") .. ". So far these are all different ways to depict numbers so the F and the 1000 are probably also different systems. 1000 is binary for 8. Not sure about F though. Maybe...\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage(getColoredNameForCrewWithMost("mental") .. " counts fingers.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"One through nine then ABCDEF. That's hexadecimal 15. So it's 8 plus 15 plus 8. Which is 31.\"")
                    msnMgr:addMessage(" ")
                end
            else
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Well VIII is a Roman 8,\" says " .. getColoredNameForCrewWithMost("mental") .. ". So far these are all different ways to depict numbers so the F and the 1000 are probably also different systems. 1000 is binary for 8. Not sure about F though. Maybe...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(getColoredNameForCrewWithMost("mental") .. " counts fingers.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"One through nine then ABCDEF. That's hexadecimal 15. So it's 8 plus 15 plus 8. Which is 31.\"")
                msnMgr:addMessage(" ")
            end
        end

        msnMgr:buildChoice("Puzzle out the final equation")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        EquationThreeChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (EquationThreeChoice == 0) then
            if (MechanicCrew ~= -1) then
                if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(MechanicCrew, "mental")) then
                    MechanicName = charMgr:getCharColoredName(MechanicCrew)
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Okay,\" says " .. MechanicName .. ". We've got 1 plus 8 plus 1 which is 10 equals 8 plus 15 plus 8 which is 31. So 10 equals 31. Which equals something else? 120? 220? How?\"")
                end
            end

            if (ScientistCrew ~= -1) then
                if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(ScientistCrew, "mental")) then
                ScientistName = charMgr:getCharColoredName(ScientistCrew)
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Ah hah,\" says " .. ScientistName .. ". That's not a zero, that's a letter O. It's H2O. Water. Look around, it's obvious that's what they meant.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"And the 1 plus 8 plus 1, that's not math, that's elements. Periodic table 1 is Hydrogen, and 8 is Oxygen. H plus O plus H, H2O.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"And then I bet the 8 + 15 + 8 isn't math either. If 8 is H and 15 is O that's... letters of the alphabet. H O H, H2O.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Clearly a puzzle only humans could figure out. It's unlikely any non-Earthly intelligence would have developed all those identical constructs.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage(ScientistName .. " walks up to the panel and intuitively traces a letter H in the blank spot with a nervous finger. They have no idea why that seems like the right thing to do, but it works. There's a grinding sound, and when they check, the crew bears witness to the fact that two of the three doors have slid open, leaving the center one shut.")
                    msnMgr:addMessage(" ")
                    SideDoorsOpen = true;
                end
            else
                msnMgr:addMessage(" ")
                msnMgr:addMessage(getColoredNameForCrewWithMost("mental") .. " says \"So it's 10 equals 31 equals something 2O. But how does 10 equal 31?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("The crew thinks on it for a while.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Maybe it's leet speak,\" says " .. getColoredNameForCrewWithMost("mental") .. ". Only humans would know that, surely. That would make it maybe LO equals EL equals something ZO\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"If that's it then it has to be AZO,\" says " .. getColoredNameForCrewWithLeast("mental") .. ". That's the only word that is three letters and ends in ZO.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"How do you know that?\" you ask.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Hey, I used to do crosswords. It's good to memorize the three letter words, especially the ones with Q and Z.\"")
                msnMgr:addMessage(" ")

                if (ScientistCrew ~= -1) then
                    if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(ScientistCrew, "mental")) then
                        ScientistName = charMgr:getCharColoredName(ScientistCrew)
                        msnMgr:addMessage("\"Azo is a chemistry term,\" says " .. ScientistName .. ". Something about nitrogen and carbon. But why would that be... Ah-hah. It's not AZO. It's H2O.\"")
                        msnMgr:addMessage(" ")
                        msnMgr:addMessage("\"How do you get H2O from LO and EL?,\" asks " .. getColoredNameForCrewWithLeast("mental") .. ". ")
                        msnMgr:addMessage(" ")
                        msnMgr:addMessage("\"You don't,\" is the reply. \"The 1 8 1 isn't math, it's elements on the Periodic Table. Hydrogen and Oxygen, H2O. And the second part is probably letters of the alphabet. H and O, H2O again. It's water. The answer is literally all around us.\"")
                        msnMgr:addMessage(" ")
                        msnMgr:addMessage(ScientistName .. " walks up to the panel and traces a letter H in the blank spot with a nervous finger. They have no idea why that seems like the right thing to do, but it works. There's a grinding sound, and when they check, the crew bears witness to the fact that two of the three doors have slid open, leaving the center one shut.")
                        msnMgr:addMessage(" ")
                        SideDoorsOpen = true;
                    end
                else
                    msnMgr:addMessage("\"Well if no one else has a better idea...\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage(getColoredNameForCrewWithMost("mental") .. " walks up to the panel and traces a letter A on the blank space with a steady finger. They have no idea why that seems like the right thing to do, but it works. There's a grinding sound, and when they check, the crew finds that the centermost door has slid open.")
                    msnMgr:addMessage(" ")
                    MiddleDoorOpen = true;
                end
            end
        end
    end
end

function doorchoice()
    -- Impossible for both center, and side doors, to simultaneously be open
    if (MiddleDoorOpen == true) then
        msnMgr:buildChoice("Walk through the middle door")
    end
    if (SideDoorsOpen == true) then
        msnMgr:buildChoice("Walk through the left door")
        msnMgr:buildChoice("Walk through the right door")
    end
    msnMgr:finalizeChoice()
end

function centerdoor()
    msnMgr:addMessage(" ")
    msnMgr:addMessage("The center door opens into a chamber approximately 2 meters in circumference, resembling nothing so much as an elevator. There's enough room inside for up to 8 people, although it would be a tight fit.")
    msnMgr:addMessage(" ")

    if (CompetitiveCrew ~= -1) then
        CompetitiveName = charMgr:getCharColoredName(CompetitiveCrew)
        msnMgr:addMessage(CompetitiveName .. " is the first one through the door.")
        msnMgr:addMessage(" ")
    end

    msnMgr:addMessage("Once the crew is inside, there's a moment of awkward shuffling during which nothing much happens. But then with a slight hum, the door slides shut, and in pitch blackness the elevator begins to descend.")
    msnMgr:addMessage(" ")

    if (ComedianCrew ~= -1) then
        ComedianName = charMgr:getCharColoredName(ComedianCrew)
        msnMgr:addMessage(ComedianName .. " is uncomfortable with the claustrophobic feeling of being sealed inside a pitch black elevator headed to who-knows where, and tries to lighten the mood.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Marco,\" says " .. ComedianName .. ".")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("There's a moment of silence.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Marco,\" they repeat.")
        msnMgr:addMessage(" ")

        SocialName = getColoredNameForCrewWithMost("social")

        if (SocialName ~= ComedianName) then
            msnMgr:addMessage("\"Polo,\" says " .. SocialName .. ".")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("There's some general laughter and the mood is lightened somewhat. Fortunately the elevator ride is not that long, because the joke gets somewhat stale the fifth time around.")
            msnMgr:addMessage(" ")
            LightenMood = 1;
        else
            msnMgr:addMessage("Everyone is too nervous to say anything.")
            msnMgr:addMessage(" ")
        end
    elseif (CounselorCrew ~= -1) then
        CounselorName = charMgr:getCharColoredName(CounselorCrew)
        msnMgr:addMessage(CounselorName .. " senses growing discomfort among the group, seeing as they're sealed inside a pitch black room with no idea where they're going or what might happene when they arrive.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"This reminds me of a dream I had once,\" they say. \"I was inside this big fish, and it was swimming to the moon. Space was filled with water, and there were these teeny little octopuses everywhere...\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("The story has no point or moral, but " .. CounselorName .. " keeps talking until the elevator arrives, and then ends with, \"...and then I woke up.\" Somewhat unsatisfying as stories go, but it keeps everyone from panicking.")
        msnMgr:addMessage(" ")
        LightenMood = 1;
    else
        msnMgr:addMessage("The elevator descends for what seems like an eternity, and the air grows stale and thick with fear. The blackness seems to close in, and " .. getColoredNameForCrewWithLeast("physical") .. " begins to panic.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"It's all over, isn't it? We're all dead and this is hell. We're going to hell.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Everyone's nerves are unsettled, and by the time the elevator doors open, no one is very happy with " .. getColoredNameForCrewWithLeast("physical") .. ", or the situation.")
        msnMgr:addMessage(" ")
    end

    waitUserResponse("Fourth floor, Menswear, Appliances and Electronics...")
    msnMgr:addMessage(" ")

    if (LightenMood == 1) then
        msnMgr:addMessage("When the doors open, the crew is bathed in a soft blue light. They cautiously peer out of the elevator, and discover that a large portion of the floor immediately outside is missing. A pool of inky black water stretches nearly the entire width of the narrow corridor. Difficult to see in dim light, but as the atmospheric suits allow sight into the infrared spectrum, it shows up a bit colder than the floor.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("It's a simple enough matter to navigate around the hole in the floor, and one by one the crew makes their way onto sturdier footing. It's a definite reminder to be careful down here. A strange welcome, however.")
        msnMgr:addMessage(" ")
    else
        PanicName = getColoredNameForCrewWithLeast("physical")
        msnMgr:addMessage("Nerves rattled, " .. PanicName .. " is practically clawing at the elevator doors the moment its downward motion stops. They rush out towards the dimly lit hallway as soon as the doors open a crack.")
        msnMgr:addMessage(" ")

        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) > charMgr:getCharAttr(charMgr:crewWithLeast("physical"), "physical")) then
            msnMgr:addMessage("The rest of the away team looks out, and discovers no sign of them, but for the slightest ripple on the top of a pool of inky black water, stretching the width of the corridor. Atmospheric suits were not built for buoyancy, and " .. PanicName .. " has sunk below the surface, and well out of sight.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("The good news is that their atmospheric suit will keep them alive for several days in such conditions. The bad news is that there's no way to save them.")
            msnMgr:addMessage(" ")
            msnMgr:killCrew(charMgr:crewWithLeast("physical"), "<charName> fell into the ocean depths after an attack of claustrophbia in an elevator.")
            crewTraits()

            -- Any crew alive?
            if (charMgr:depCrewLeft() == 0) then
                if (charMgr:crewOnShipLeft() == false) then
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                else
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                end
            else
                msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                msnMgr:addMessage(" ")
            end
        else
            msnMgr:addMessage("Stepping out of the elevator, the crew just manages to spot the slightest ripple on the top of a pool of inky black water, stretching the width of the corridor, and avoids disaster. Falling in there would be tragic.")
            msnMgr:addMessage(" ")
        end
    end

    msnMgr:addMessage("The crew cautiously moves down the corridor. Motion lights overhead occasionally flicker on, but most of them are inoperable and the crew is forced to rely on helmet lamp light to navigate.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("After approximately a hundred meters, the hallway comes to an abrupt end. Another hole in the floor is open to the ocean below. This time, however, the edges of the hole are jagged and bent, as if there was some other structure here at one point.")
    msnMgr:addMessage(" ")

    if (charMgr:getCharTrait(charMgr:getEng(), "Mechanic")) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
            msnMgr:addMessage("\"It looks like there was something cylindrical here,\" says " .. EngineerName .. ". \"About the same dimensions as the elevator we came down here in. And judging from the stress fractures here, it looks like the entire thing collapsed. Anyone in that thing would have sunk to the bottom immediately.\"")
            msnMgr:addMessage(" ")
        end
    else
        if (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
            msnMgr:addMessage("\"It looks like there was something cylindrical here,\" says " .. EngineerName .. ". \"About the same dimensions as the elevator we came down here in. And judging from the stress fractures here, it looks like the entire thing collapsed. Anyone in that thing would have sunk to the bottom immediately.\"")
            msnMgr:addMessage(" ")
        end
    end

    msnMgr:addMessage("A bit of searching about reveals a small jagged hole, approximately a meter in circumference, has also been torn in the side of the corridor. The metal is bent outward away from the team, almost as if something on this side had exploded.")
    msnMgr:addMessage(" ")

    msnMgr:buildChoice("Go back")
    msnMgr:buildChoice("Crawl through the hole")
    msnMgr:finalizeChoice()
    if(not waitUserInput(choices)) then
        return
    end

    WateryHallwayChoice = msnMgr:getChoiceResponse(choices)
    choices = choices + 1

    msnMgr:addMessage(" ")

    if (WateryHallwayChoice == 0) then
        msnMgr:addMessage("Faced with what appears to be a dead end, the away team turns to go back. Halfway back to the elevator, however, there is a creaking, groaning sound from down the corridor. Rushing forward, they see that even more of the floor has collapsed, leaving a hole open to the ocean that is far too broad to get across.")
        msnMgr:addMessage(" ")

        if (charMgr:getCharTrait(charMgr:getEng(), "Mechanic")) then
            if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getEng(), "social")) then
                msnMgr:addMessage("\"Strange,\" says " .. EngineerName .. ". \"This doesn't look like it collapsed from stress. See the edges? They're regular. This looks intentional. Planned. Like some sort of trap. Mechanically it could be anything, but this was clearly designed to interact with living things. In a very negative way.\"")
                msnMgr:addMessage(" ")
            end
        else
            if (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getEng(), "social")) then
                msnMgr:addMessage("\"Strange,\" says " .. EngineerName .. ". \"This doesn't look like it collapsed from stress. See the edges? They're regular. This looks intentional. Planned. Like some sort of trap. Mechanically it could be anything, but this was clearly designed to interact with living things. In a very negative way.\"")
                msnMgr:addMessage(" ")
            end
        end

        msnMgr:addMessage("There is no alternative but to return to the other end of the hallway and hope that there is some way out through that hole.")
        msnMgr:addMessage(" ")
    else
        msnMgr:addMessage("With atmospheric suits on, it's a tight fit, but everyone manages to squeeze through the hole without causing anything but cosmetic damage to " .. getColoredNameForCrewWithLeast("physical") .. "'s helmet. Nothing that won't buff out.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("The crew stands up in a corridor identical to the one they just vacated, although much better lit. Immediately to their right upon entering is what appears to be a sealed metal portal, like the ones above. To the left, the corridor stretches on for about ten meters before ending at a similar door, this one with an inscription beside it.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Thick windows of some semi-transparent material that is probably not glass punctuate the walls every meter or so, making it clear (if it wasn't already) that the crew is definitely far below the surface of the planet's immense ocean.")
        msnMgr:addMessage(" ")
    end
end

function sidedoor()
    msnMgr:addMessage("As it turns out, each of the side doors leads in about three meters, gently curving around and then connecting together in a small circular chamber, in the center of which is a spiral staircase, heading downward. It's made of the same metal as the platform, though what appears to be rubber or some similar material is adhered to each step, providing a sturdy footing despite the damp atmospheric conditions.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("The journey down the staircase takes about ten minutes, and spills out into a circular chamber, featureless but for a metal portal in one wall.")
    msnMgr:addMessage(" ")

    msnMgr:addMessage("\"Oh great, another puzzle,\" says " .. LeaderName .. ". \"It's like some sort of game.\"")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("Upon closer inspection, there is indeed an inscription beside the door that looks a bit gamelike. Two rows of three numbers, with sets of crossed lines between them.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("032 000 273")
    msnMgr:addMessage("XXXXXXXXXXX")
    msnMgr:addMessage(".02 .16 .01")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("\"Enough already,\" says " .. getColoredNameForCrewWithLeast("mental") .. ". ")
    msnMgr:addMessage(" ")

    if (ScientistCrew ~= -1) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(ScientistCrew, "mental")) then
            ScientistName = charMgr:getCharColoredName(ScientistCrew)
            msnMgr:addMessage("\"Easy enough,\" says " .. ScientistName .. ". \"H2O again. Triple point of water, expressed in Celsius, Fahrenheit and Kelvin. 0.01 Celsius, 32.02 Fahrenheit, and 273.16 Kelvin.\"")
            msnMgr:addMessage(" ")
        end
    elseif (MechanicCrew ~= -1) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(MechanicCrew, "mental")) then
            ScientistName = charMgr:getCharColoredName(MechanicCrew)
            msnMgr:addMessage("\"Easy enough,\" says " .. MechanicName .. ". \"Water again. That's the triple point of water, in Celsius, Fahrenheit and Kelvin. 0.01 Celsius, 32.02 Fahrenheit, and 273.16 Kelvin.\"")
            msnMgr:addMessage(" ")
        end
    else
        msnMgr:addMessage(LeaderName .. " says \"Okay, we're not going to just stand here all day figuring this out, so let's just make a decision. Let's go one set at a time.")
        msnMgr:addMessage(" ")
    end

    msnMgr:buildChoice("Connect 32 and .02")
    msnMgr:buildChoice("Connect 32 and .16")
    msnMgr:finalizeChoice()
    if(not waitUserInput(choices)) then
        return
    end

    FirstSet = msnMgr:getChoiceResponse(choices)
    choices = choices + 1

    msnMgr:addMessage(" ")

    if (FirstSet == 0) then
        msnMgr:addMessage(LeaderName .. " asks \"And what about that middle set?\"")
        msnMgr:addMessage(" ")
    elseif (FirstSet == 1) then
        msnMgr:addMessage(LeaderName .. " asks \"And what about that middle set?\"")
        msnMgr:addMessage(" ")
        WrongChoice = 1;
    end

    msnMgr:buildChoice("Connect 0 and .02")
    msnMgr:buildChoice("Connect 0 and .16")
    msnMgr:buildChoice("Connect 0 and .01")
    msnMgr:finalizeChoice()
    if(not waitUserInput(choices)) then
        return
    end

    SecondSet = msnMgr:getChoiceResponse(choices)
    choices = choices + 1

    msnMgr:addMessage(" ")

    if (SecondSet == 0) then
        msnMgr:addMessage(LeaderName .. " asks \"And the last bit?\"")
        msnMgr:addMessage(" ")
        WrongChoice = 1;
    elseif (SecondSet == 1) then
        msnMgr:addMessage(LeaderName .. " asks \"And the last bit?\"")
        msnMgr:addMessage(" ")
        WrongChoice = 1;
    elseif (SecondSet == 2) then
        msnMgr:addMessage(LeaderName .. " asks \"And the last bit?\"")
        msnMgr:addMessage(" ")
    end

    msnMgr:buildChoice("Connect 273 and .16")
    msnMgr:buildChoice("Connect 273 and .01")
    msnMgr:finalizeChoice()
    if(not waitUserInput(choices)) then
        return
    end

    ThirdSet = msnMgr:getChoiceResponse(choices)
    choices = choices + 1

    msnMgr:addMessage(" ")

    if (ThirdSet == 0) then
        --msnMgr:addMessage(LeaderName .. " asks \"And what about that middle set?")
        msnMgr:addMessage(" ")
    elseif (ThirdSet == 1) then
        --msnMgr:addMessage(LeaderName .. " asks \"And what about that middle set?")
        msnMgr:addMessage(" ")
        WrongChoice = 1;
    end

    msnMgr:addMessage(LeaderName .. " draws a finger through the inscriptions connecting what they assume are the proper pairs of numbers.")
    msnMgr:addMessage(" ")

    if (WrongChoice == 1) then
        msnMgr:addMessage("The panel begins to arc with electricity, although before it can do any serious harm, the light show ends. It looks like whatever that might have been, it stopped working properly long ago, or else was discharged before the crew got to it.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("With a final crackle of electric current, the door opens to reveal a segment of corridor, this one with windows punctuating the walls every meter or so. In the left wall there is an oddly incongruous hole at the base of the wall, the metal twisted and peeled in towards the crew, as if something had exploded on the other side. ")
        msnMgr:addMessage(" ")
    else
        msnMgr:addMessage("The door opens to reveal a segment of corridor, this one with windows punctuating the walls every meter or so. In the left wall there is an oddly incongruous hole at the base of the wall, the metal twisted and peeled in towards the crew, as if something had exploded on the other side.")
        msnMgr:addMessage(" ")
    end

    msnMgr:buildChoice("Crawl through the hole")
    msnMgr:buildChoice("Continue onward")
    msnMgr:finalizeChoice()
    if(not waitUserInput(choices)) then
        return
    end

    CrawlOrGo = msnMgr:getChoiceResponse(choices)
    choices = choices + 1

    msnMgr:addMessage(" ")

    if (CrawlOrGo == 0) then
        msnMgr:addMessage("The hole has sharp, jagged edges pointing into this corridor. While someone might safely push through from the other side, trying to pass through from this direction would almost certainly damage an atmospheric suit. It's probably best to not risk it unless the away team has no other option, and they do. They're loyal, not suicidal. Usually.")
        msnMgr:addMessage(" ")
    elseif (CrawlOrGo == 1) then
        msnMgr:addMessage("The crew agrees that the wide open corridor is a better option than the razor sharp hole in the wall.")
        msnMgr:addMessage(" ")
    end
end

function doormerge()
    msnMgr:addMessage("Beyond the strange hole in the wall, the corridor stretches on for another ten meters before ending at another silvery portal. Etched into the metal over the door is the curious phrase \"Homer's sea\", and beside is a panel featuring an array of seemingly thousands of colors.")
    msnMgr:addMessage(" ")

    msnMgr:addMessage("\"Wine-dark,\" says " .. getColoredNameForCrewWithMost("mental") .. ". \"That's what color it was.\"")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("The riddle is entirely moot, however, because the color panel is crushed beyond repair. Loose wiring is peeking through the twisted metal and giving off sparks. Now that they're up close, the away team's helmet lamp light also reveals that the bottom of the door panel is an equal wreck, displaying the same twisted appearance as the hole back down the hall. It's about a meter around, and looks large enough to crawl through.")
    msnMgr:addMessage(" ")

    msnMgr:addMessage("\"Anyone else getting the sense that maybe we're not alone in here?\" asks " .. getColoredNameForCrewWithLeast("mental") .. ". \"Whatever's making these holes is clearly very strong.\"")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("Nothing on any sensor indicates any sort of life in the vicinity of the away team, however. Besides the crew, of course. The crew probably knows this, meaning that this is just foolish human speculation to alleviate apprehension. As such you do not bother to comment.")
    msnMgr:addMessage(" ")

    if (ComedianCrew ~= -1) then
        ComedianName = charMgr:getCharColoredName(ComedianCrew)
        msnMgr:addMessage("\"They're strong, but small,\" says " .. ComedianName .. ", \"It's like the old riddle. Would you rather fight one horse-sized duck, or a hundred duck-sized horses?\"")
        msnMgr:addMessage(" ")

        if (CounselorCrew ~= -1) then
            CounselorName = charMgr:getCharColoredName(CounselorCrew)
            msnMgr:addMessage("\"What's a duck?\" asks " .. CounselorName .. ".")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What we need to do to get through this hole,\" says " .. ComedianName .. ". \"Also an extinct bird.\"")
            msnMgr:addMessage(" ")
        end
    end
end

function panelchoice()
    msnMgr:buildChoice("Crawl through the broken door")
    msnMgr:buildChoice("Someone get a better look at that sparking panel")
    msnMgr:finalizeChoice()
end

function lookpanel()
    msnMgr:addMessage(" ")
    msnMgr:addMessage("The panel is smashed beyond repair, or utility. At one time the crew can imagine that it might have been used to select a color to answer the riddle above the door, but it looks like someone either decided to pick all the colors at once, or got frustrated with the game and decided to end it.")
    msnMgr:addMessage(" ")

    if (charMgr:getCharTrait(charMgr:getEng(), "Mechanic")) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getEng(), "physical")) then
            msnMgr:addMessage("After a few minutes of peering at the panel, and tracing imaginary wires behind the wall, " .. EngineerName .. " steps forward, then kicks the door off to one side. With an electrical sound, some sort of hidden connection is made, and the door slides rapidly into the floor, twisted metal shredding off the other side under the immense force.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Good thing no one was crawling through at the time,\" they say.")
            msnMgr:addMessage(" ")
            BustedDoorOpen = 1;
        else
            msnMgr:addMessage("\"Argh,\" says " .. EngineerName .. ", throwing their hands up in frustration. \"Nothing I can do with this pile of spaghetti.\"")
            msnMgr:addMessage(" ")
        end
    else
        if (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getEng(), "physical")) then
            msnMgr:addMessage("After a few minutes of peering at the panel, and tracing imaginary wires behind the wall, " .. EngineerName .. " steps forward, then kicks the door off to one side. With an electrical sound, some sort of hidden connection is made, and the door slides rapidly into the floor, twisted metal shredding off the other side under the immense force.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Good thing no one was crawling through at the time,\" they say.")
            msnMgr:addMessage(" ")
            BustedDoorOpen = 1;
        else
            msnMgr:addMessage("\"Argh,\" says " .. EngineerName .. ", throwing their hands up in frustration. \"Nothing I can do with this pile of spaghetti.\"")
            msnMgr:addMessage(" ")
        end
    end
end

function crawlhole()
    if (CompetitiveCrew ~= -1) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(CompetitiveCrew, "social")) then
            CompetitiveName = charMgr:getCharColoredName(CompetitiveCrew)
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"We can't stand around here all day. Step aside.\" " .. CompetitiveName .. " says, getting on hands and knees and crawling through the hole.")
            msnMgr:addMessage(" ")

            if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(CompetitiveCrew, "physical")) then
                msnMgr:addMessage("Before crawling through, " .. CompetitiveName .. " first pushes against the door to make sure it's secure. There is a brief sizzle as something connects behind the wall, and the door instantly slides into the floor with enough force to shear off the bent metal.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Well that makes it easier,\" says " .. CompetitiveName .. ".")
                msnMgr:addMessage(" ")
                BustedDoorOpen = 1;
            else
                msnMgr:addMessage("Unfortunately, when they are halfway through,  " .. CompetitiveName .. " brushes against the side of the hole enough to jostle the entire door mechanism. There is an electrical sound as a connection is tripped, and the door slides down into the floor with enough force to shear off the twisted metal on the far side of the door.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Needless to say, they do not fare well. The half of them on the other side of the door screams for a full minute before bleeding out.")
                msnMgr:addMessage(" ")
                BustedDoorOpen = 1;

                msnMgr:killCrew(CompetitiveCrew, "<charName> died after being cut in half by a malfunctioning door.")
                crewTraits()

                -- Any crew alive?
                if (charMgr:depCrewLeft() == 0) then
                    if (charMgr:crewOnShipLeft() == false) then
                        msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("mv ~ /dev/null")

                        msnMgr:endGame(false)
                    else
                        msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("mv ~ /dev/null")

                        msnMgr:endGame(false)
                    end
                else
                    msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                    msnMgr:addMessage(" ")
                end

                if (CounselorCrew ~= -1) then
                    CounselorName = charMgr:getCharColoredName(CounselorCrew)
                    msnMgr:addMessage(CounselorName .. " does their best to keep the situation calm, and although there are some shaken nerves, the crew seems ready to move on after a few minutes.")
                    msnMgr:addMessage(" ")
                else
                    msnMgr:addMessage("The away team is horrified, and barely manages to hold it together. It takes a full hour before they are ready to move on, and even then it seems that it will take some time to overcome this event. But there is no other option. They must move forward.")
                    msnMgr:addMessage(" ")
                    SawSomeoneDie = 1;
                end
            end
        end
    else
        msnMgr:addMessage("Who should crawl through the broken door?")
        msnMgr:addMessage(" ")

        CrawlChar = givePlayerCrewToPick()
        CrawlCharName = charMgr:getCharColoredName(CrawlChar)

        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(CrawlChar, "physical")) then
            msnMgr:addMessage("Before crawling through, " .. CrawlCharName .. " first pushes against the door to make sure it's secure. There is a brief sizzle as something connects behind the wall, and the door instantly slides into the floor with enough force to shear off the bent metal.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Well that makes it easier,\" says " .. CrawlCharName .. ".")
            msnMgr:addMessage(" ")
            BustedDoorOpen = 1;
        else
            msnMgr:addMessage("Unfortunately, when they are halfway through, " .. CrawlCharName .. " brushes against the side of the hole enough to jostle the entire door mechanism. There is an electrical sound as a connection is tripped, and the door slides down into the floor with enough force to shear off the twisted metal on the far side of the door.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Needless to say, they do not fare well. The half of them on the other side of the door screams for a full minute before bleeding out.")
            msnMgr:addMessage(" ")
            BustedDoorOpen = 1;

            msnMgr:killCrew(CrawlChar, "<charName> died after being cut in half by a malfunctioning door.")
            crewTraits()

            -- Any crew alive?
            if (charMgr:depCrewLeft() == 0) then
                if (charMgr:crewOnShipLeft() == false) then
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                else
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                end
            else
                msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                msnMgr:addMessage(" ")
            end

            if (CounselorCrew ~= -1) then
                CounselorName = charMgr:getCharColoredName(CounselorCrew)
                msnMgr:addMessage(CounselorName .. " does their best to keep the situation calm, and although there are some shaken nerves, the crew seems ready to move on after a few minutes.")
                msnMgr:addMessage(" ")
            else
                msnMgr:addMessage("The away team is horrified, and barely manages to hold it together. It takes a full hour before they are ready to move on, and even then it seems that it will take some time to overcome this event. But there is no other option. They must move forward.")
                msnMgr:addMessage(" ")
                SawSomeoneDie = 1;
            end
        end
    end
    BustedDoorOpen = 1;
end

function busteddoor()
    msnMgr:addMessage("The away team makes its way through the portal and finds themselves in yet another length of corridor, almost identical to the last. Once again, there is another silvery portal about ten meters down, but this time it's clear even from a distance that the entire mechanism has been smashed open.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("As before, there's also some sort of inscription over the door, but the top of the door frame has been bent and twisted to such a degree that it's not even clear what language it may have been written in.")
    msnMgr:addMessage(" ")

    if (ComedianCrew ~= -1) then
        ComedianName = charMgr:getCharColoredName(ComedianCrew)
        msnMgr:addMessage("\"Bet it said something about water, though,\" says " .. ComedianName .. ".")
        msnMgr:addMessage(" ")
    end

    if (charMgr:getCharTrait(charMgr:getEng(), "Mechanic")) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
            msnMgr:addMessage(EngineerName .. " takes a closer look at the mangled wreck of a door and takes a few scans.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"This is all some strange alloy,\" they say. \"There's titanium, but that's about all that's identifiable. Whatever it is, though, it's clear that it would take someone quite strong to do this. It's outside the capabilities of a normal human.\"")
            msnMgr:addMessage(" ")

            CygenCrew = charMgr:getCrewTraits("Cygen")
            if (CygenCrew ~= -1) then
                CygenName = charMgr:getCharColoredName(CygenCrew)
                msnMgr:addMessage("\"What about one of us?\" asks " .. CygenName .. ". \"Maybe a Cygen customized for strength, durability... combat or construction.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Possibly. Though even that...\"")
                msnMgr:addMessage(" ")
            end

            if (ScientistCrew ~= -1) then
                ScientistName = charMgr:getCharColoredName(ScientistCrew)
                msnMgr:addMessage("\"We may be looking at someTHING, not someONE,\" says " .. ScientistName .. ". \"An extraterrestrial life form.\"")
                msnMgr:addMessage(" ")

                if (ComedianCrew ~= -1) then
                    ComedianName = charMgr:getCharColoredName(ComedianCrew)
                    msnMgr:addMessage("\"Aren't WE extraterrestrial life forms?\" jokes " .. ComedianName .. ".")
                    msnMgr:addMessage(" ")
                end
            end
        end
    else
        if (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
            msnMgr:addMessage(EngineerName .. " takes a closer look at the mangled wreck of a door and takes a few scans.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"This is all some strange alloy,\" they say. \"There's titanium, but that's about all that's identifiable. Whatever it is, though, it's clear that it would take someone quite strong to do this. It's outside the capabilities of a normal human.\"")
            msnMgr:addMessage(" ")

            CygenCrew = charMgr:getCrewTraits("Cygen")
            if (CygenCrew ~= -1) then
                CygenName = charMgr:getCharColoredName(CygenCrew)
                msnMgr:addMessage("\"What about one of us?\" asks " .. CygenName .. ". \"Maybe a Cygen customized for strength, durability... combat or construction.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Possibly. Though even that...\"")
                msnMgr:addMessage(" ")
            end

            if (ScientistCrew ~= -1) then
                ScientistName = charMgr:getCharColoredName(ScientistCrew)
                msnMgr:addMessage("\"We may be looking at someTHING, not someONE,\" says " .. ScientistName .. ". \"An extraterrestrial life form.\"")
                msnMgr:addMessage(" ")

                if (ComedianCrew ~= -1) then
                    ComedianName = charMgr:getCharColoredName(ComedianCrew)
                    msnMgr:addMessage("\"Aren't WE extraterrestrial life forms?\" jokes " .. ComedianName .. ".")
                    msnMgr:addMessage(" ")
                end
            end
        end
    end
end

function gravityroom()
    msnMgr:addMessage("Whatever the case, the environment beyond the door is different from what the crew has recently seen. It's a large space, quite high and wide, and filled with a mist that scatters the crew's head lamp lights, making it difficult to see clearly beyond 3 or 4 meters out.")
    msnMgr:addMessage(" ")

    msnMgr:buildChoice("Creep around the edges of the room")
    msnMgr:buildChoice("Move quickly to the center")
    msnMgr:finalizeChoice()
    if(not waitUserInput(choices)) then
        return
    end

    ExploreOptions = msnMgr:getChoiceResponse(choices)
    choices = choices + 1

    msnMgr:addMessage(" ")

    if (ExploreOptions == 0) then
        msnMgr:addMessage("The away team moves clockwise around the room, which reveals nothing of particular interest save for the fact that there is only the one entrance, and that the room is immense, probably 50 meters across, and seemingly just as high. Portions of the walls are transparent, revealing (if it wasn't already clear) that the crew is still fairly deep under water.")
        msnMgr:addMessage(" ")

        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getLead(), "physical")) then
            msnMgr:addMessage(LeaderName .. " stops a few paces before they fully complete their loop around the room, studying the wall.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That looks like a letter K to me. Am I crazy?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Head lamps are focused on the spot, and indeed, there is what appears to be a large K drawn onto the wall, across both metal and whatever transparent material makes up the window.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That's blood, isn't it?\" asks " .. getColoredNameForCrewWithLeast("mental") .. ". \"I knew it. I knew it.\"")
            msnMgr:addMessage(" ")

            if (charMgr:getCharTrait(charMgr:getMed(), "Scientist")) then
                if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getMed(), "mental")) then
                    msnMgr:addMessage("\"Actually,\" says " .. MedicName .. ", taking a closer look, \"it does look like it might be blood of some sort. I'll take a sample.\"")
                    msnMgr:addMessage(" ")
                    bloodgot = 1;
                else
                    msnMgr:addMessage("\"Of course it's not blood,\" says " .. MedicName .. ". \"It looks nothing like dried blood. It's too dark. Almost blue. It's probably just some kind of paint.\"")
                    msnMgr:addMessage(" ")
                end
            else
                if (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getMed(), "mental")) then
                    msnMgr:addMessage("\"Actually,\" says " .. MedicName .. ", taking a closer look, \"it does look like it might be blood of some sort. I'll take a sample.\"")
                    msnMgr:addMessage(" ")
                    bloodgot = 1;
                else
                    msnMgr:addMessage("\"Of course it's not blood,\" says " .. MedicName .. ". \"It looks nothing like dried blood. It's too dark. Almost blue. It's probably just some kind of paint.\"")
                    msnMgr:addMessage(" ")
                end
            end
        end

        msnMgr:buildChoice("Walk back around the edge")
        msnMgr:buildChoice("Move to the center")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        WallExploreOptions = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        msnMgr:addMessage(" ")

        if (WallExploreOptions == 0) then
            if (LightenMood ~= 1) then
                if (StubbornCrew ~= -1) then
                    StubbornName = charMgr:getCharColoredName(StubbornCrew)
                    msnMgr:addMessage(StubbornName .. " refuses to budge. \"We've wasted enough time and this place is creepy. It's probably just a smudge on the glass. Let's just get over there and get this over with.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("The crew gives up the wall walking, and heads straight to the center of the room.")
                    msnMgr:addMessage(" ")
                    ExploreOptions = 1;
                else
                    msnMgr:addMessage(getColoredNameForCrewWithLeast("social") .. " refuses to budge. \"We've wasted enough time and this place is creepy. It's probably just a smudge on the glass. Let's just get over there and get this over with.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("The crew gives up the wall walking, and heads straight to the center of the room.")
                    msnMgr:addMessage(" ")
                    ExploreOptions = 1;
                end
            elseif (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getLead(), "mental")) then
                msnMgr:addMessage("The crew moves back around the room counterclockwise, wondering if they'd possibly missed something earlier. And indeed, now that they're looking for it, " .. LeaderName .. " notices that there are clearly faint traces of letters painted all over the wall.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("There are spots where things are too worn to read properly, but by the time they get back to where they started, they've managed to piece together something that reads as follows:")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Water wate ev er vh ere no ny dro o dr k.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("The letters start out fairly large but grow smaller and shakier as the message goes on. It's a wonder the crew spotted that final K at all.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I think it's from the Rime of the Ancient Mariner,\" says " .. getColoredNameForCrewWithMost("mental") .. ". I forget who wrote it. It's a poem. The actual line reads something like \'Water water everywhere and not a drop to drink\'. I forget exactly.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"In the poem it refers to salt water. The guy is surrounded by the ocean but he's dying of thirst.\"")
                msnMgr:addMessage(" ")



                PhotoCrew = charMgr:randomCrew()
                if (charMgr:hasMemento(PhotoCrew, "story2_letters_photo") ~= true) then
                    charMgr:giveMemento(PhotoCrew, "story2_letters_photo")
                end


                if (ScientistCrew ~= -1) then
                    if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(ScientistCrew, "mental")) then
                        ScientistName = charMgr:getCharColoredName(ScientistCrew)
                        msnMgr:addMessage("The water on this planet isn't salty, though,\" says " .. ScientistName .. ". Maybe whoever wrote this thought it was? Or maybe there's something else about it...")
                        msnMgr:addMessage(" ")
                    end
                end
                ExploreOptions = 1;
            end

        elseif (WallExploreOptions == 1) then
            ExploreOptions = 1;
        end
    end

    if (ExploreOptions == 1) then
        msnMgr:addMessage("At the center of the immense chamber is a transparent cylinder, inside of which is another, slightly more slender shaft, stretching up through the ceiling and down into the darkness below. A faint shimmer is visible from within the inner cylinder, but much more noticeable are what appear to be rock formations all over its surface.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("A single open portal appears to be the only way into the space between the cylinders; directly beside it is what appears to be a smashed control panel with a long steel rod buried in the center. Above it, etched into the glasslike surface of the outer cylinder, is a message.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Noman shall not blind me.\"")
        msnMgr:addMessage(" ")

        waitUserResponse("Bad grammar...")
        msnMgr:addMessage(" ")

        if (ComedianCrew ~= -1) then
            ComedianName = charMgr:getCharColoredName(ComedianCrew)
            msnMgr:addMessage("\"That's a double negative,\" says " .. ComedianName .. ". \"Shame shame.\"")
            msnMgr:addMessage(" ")
        end

        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getLead(), "social")) then
            identifiedOdyssey = true
            msnMgr:addMessage("\"No, wait,\" says " .. LeaderName .. ", \"I think it's literature. From the Odyssey. Sort of. Noman is the name that Odysseus gave to the cyclops, Polyphemus, after he blinded him. But I don't think that exact quote is in there.\"")
            msnMgr:addMessage(" ")
        end

        waitUserResponse("Some sort of test for humanity maybe?")
        msnMgr:addMessage(" ")

        msnMgr:addMessage("\"Oh come on,\" says " .. getColoredNameForCrewWithLeast("mental") .. ", \"They couldn't just leave a note? Hey guys, here's the combination to the gravity control. 1 2 3 4 5. Thanks bye.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"I suppose whoever made all this thought it was necessary to protect it,\" says " .. getColoredNameForCrewWithMost("mental") .. ". \"From something non-human. Something that wouldn't be able to understand analogies, or coded messages.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Or they were insane,\" says " .. getColoredNameForCrewWithLeast("mental") .. ". \"I know I'd go insane, being down here for... however long it took to build this. Exactly how long WOULD it take to build all this, anyway? Could one of the earlier ships from Earth be responsible? They only left Earth a few decades ago.\"")
        msnMgr:addMessage(" ")

        if (MechanicCrew ~= -1) then
            if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(MechanicCrew, "mental")) then
                MechanicName = charMgr:getCharColoredName(MechanicCrew)
                msnMgr:addMessage("\"That's a good question,\" says " .. MechanicName .. ". \"Don't know how deep it goes of course, but even if this is the only structure, and assuming they had to extract all the material from a craft or from the bottom of the ocean... a long time. At least decades. If we assume just one crew from one ship, maybe longer. Maybe a century. Or more.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"The great pyramid at Giza supposedly took 20 years to build, and that was on dry land, with 100 thousand workers, and it was just stacking a bunch of rocks on top of each other. This... this is a much bigger task.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Just wildly guessing of course.\" " .. MechanicName .. " shrugs. \"We have no idea what we're dealing with here. This could all be alien.\"")
                msnMgr:addMessage(" ")
            end
        end
    end
end

function controlpanel()
    msnMgr:addMessage("Upon closer inspection, the \"control panel\" isn't a control panel at all, nor is it smashed. A better description would be that it's a tool box of some sort. Holes of various shapes and sizes fill the sloped surface, with rods of various materials, thicknesses and lengths filling many of them. The rod in the center just happens to be much longer than the others, and thus more noticeable.")
    msnMgr:addMessage(" ")

    waitUserResponse("Nothing like this in my databases...")

    msnMgr:addMessage(" ")

    MentalName = getColoredNameForCrewWithMost("mental")
    if(identifiedOdyssey == true) then
        msnMgr:addMessage("\"Might be worth noting that in The Odyssey, \'Noman\' blinded the cyclops with a spear or something,\" says " .. MentalName .. ".\" Maybe this rod belongs in a different hole.\"")
        msnMgr:addMessage(" ")
    else
        msnMgr:addMessage("\"That big rod looks important.\"")
        msnMgr:addMessage(" ")
    end

    if (ComedianCrew ~= -1) then
        ComedianName = charMgr:getCharColoredName(ComedianCrew)
        if (ComedianName == MentalName) then
            msnMgr:addMessage(ComedianName .. " pauses for a moment and then chuckles, saying \"That's what she said.\"")
        else
            msnMgr:addMessage("\"That's what she said,\" says " .. ComedianName .. ".")
        end
        msnMgr:addMessage(" ")
    end

    msnMgr:addMessage("The inner cylinder clearly contains something, but whatever it is is dancing at the periphery of human vision. On the outside of the cylinder, from top to bottom, are strange lumps that look almost like plastic or stone barnacles of some sort.")
    msnMgr:addMessage(" ")

    CygenCrew = charMgr:getCrewTraits("Cygen")
    if (CygenCrew ~= -1) then
        CygenName = charMgr:getCharColoredName(CygenCrew)
        msnMgr:addMessage("\"Whatever's inside that thing, I can't see it either, and I can see farther into the infrared and ultraviolet than even this helmet can,\" says " .. CygenName .. ".")
        msnMgr:addMessage(" ")
    end

    if (charMgr:getCharTrait(charMgr:getEng(), "Mechanic")) then
        if (msnMgr:random() % msnMgr:getDiffScale(5,10,15) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
            msnMgr:addMessage("\"I don't think there's anything in there at all, at least nothing involving photons,\" says " .. EngineerName .. ". \"The shimmer might just be vibration. I bet that's some sort of focused gravity beam. I have no idea how such a thing would work but that sort of seems like why we're here, no? To shut it off?\"")
            msnMgr:addMessage(" ")
        end
    else
        if (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(charMgr:getEng(), "mental")) then
            msnMgr:addMessage("\"I don't think there's anything in there at all, at least nothing involving photons,\" says " .. EngineerName .. ". \"The shimmer might just be vibration. I bet that's some sort of focused gravity beam. I have no idea how such a thing would work but that sort of seems like why we're here, no? To shut it off?\"")
            msnMgr:addMessage(" ")
        end
    end

    msnMgr:addMessage("At the base of the inner cylinder, almost completely covered by the strange barnacle things, is a receptacle of some sort. The crew discusses the matter briefly and everyone agrees that this is pretty simply a round peg in a round hole situation.")
    msnMgr:addMessage(" ")
    LeastMentalName = getColoredNameForCrewWithLeast("mental")
    msnMgr:addMessage("\"You know what I think?\" asks " .. LeastMentalName .. ". \"I think this is all weird and stupid and whoever did this was stupid and bored and probably insane and this is dumb and I want to go home. Let's grab the big rod and shove it in the little hole and get out of here.\"")
    msnMgr:addMessage(" ")

    if (ComedianCrew ~= -1) then
        ComedianName = charMgr:getCharColoredName(ComedianCrew)
        if (ComedianName == LeastMentalName) then
            msnMgr:addMessage(ComedianName .. " pauses for a moment and then chuckles, saying \"That's what she said.\"")
        else
            msnMgr:addMessage("\"That's what she said,\" says " .. ComedianName .. ".")
        end
        msnMgr:addMessage(" ")
    end
end

function chamber()
    msnMgr:addMessage("Who should try to disable the gravity device?")
    msnMgr:addMessage(" ")

    RodChar = givePlayerCrewToPick()
    RodCharName = charMgr:getCharColoredName(RodChar)
    msnMgr:addMessage(" ")

    if (charMgr:getCharTrait(RodChar, "Cygen")) then
        msnMgr:addMessage(RodCharName .. " grabs the rod and pulls it from its socket. It's about two meters long, and thick enough that their fingers can't quite wrap around it. Removing the rod from its housing has no visible effect at all, disappointingly. Everyone was expecting a beam of light or something.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Well, here we go,\" says " .. RodCharName .. ". They walk into the cylinder with the rod. The moment they are through the door, the mist inside the cylinder begins to dissipate, although it remains as thick as ever outside the chamber.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage(RodCharName .. " moves to the inner cylinder and brushes some of the barnacles off the base with the bottom of the rod. They then insert the rod into the receptacle and shove it into place; it slides almost all the way in.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Back on the ship, you can instantly tell that something has changed. Gravity has returned to normal, and you begin to adjust your decaying orbit to something more stable.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("A moment later, however, the ship jerks again, as the strange gravity field reasserts itself.")
        msnMgr:addMessage(" ")

        CrewRemaining = charMgr:depCrewLeft()
        if (CrewRemaining >= 2) then
            msnMgr:addMessage("Back among the away team, " .. RodCharName .. " frowns as the rod is pushed out of the receptacle.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(RodCharName .. "\'s skin is becoming chalky, and their body hair begins to fall out.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(RodCharName .. " grits their teeth. \"Get back to the ship, now. I'm going to have to hold this thing in place.\" There is some mumbling and fussing, but they hold firm. \"Go. Now.\"")
            msnMgr:addMessage(" ")
            CounselorCrew = charMgr:getCrewTraits("Counselor")
            if (CounselorCrew ~= -1) then
                CounselorName = charMgr:getCharColoredName(CounselorCrew)
                if (CounselorName == RodCharName) then
                    msnMgr:addMessage("\"All I ask of you all is that you remember me. Write a poem about me or something.\"")
                    msnMgr:addMessage(" ")

                    msnMgr:killCrew(RodChar, "<charName> was killed by unknown forces while holding a rod in place in order for the away team and ship to escape an artificial gravity well.")
                    crewTraits()
                    waitUserResponse("It's time to go")
                    msnMgr:addMessage(" ")
                else
                    msnMgr:addMessage(CounselorName .. " drops off the general communication channel, and establishes a private comlink to " .. RodCharName .. ". You do not listen in. It's pretty clear what's being discussed. And you sense that it helps them deal with the situation.")
                    msnMgr:addMessage(" ")
                    waitUserResponse("It's time to go")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("The crew rushes back down the long set of corridors and up to the platform, reaching the shuttle and leaving the surface within 10 or 15 minutes. With gravity somewhat back to normal, the shuttle's gravity compensators work as well as ever, and the shuttle reaches exit velocity and is able to match the ship's orbit within another half hour.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("With no time to waste, you take the ship as far from the planet as possible, confident that even if the gravity trap is reactivated, the ship will be safely on its way.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("As the ship pulls away, there is a brief transmission from the planet, broadcast from the same mechanism that was projecting the graviton particles. You analyze the data and discover that it is the next set of coordinates.")
                    msnMgr:addMessage(" ")
                    shouldSkipEscape = true
                    msnMgr:killCrew(RodChar, "<charName> was killed by unknown forces while holding a rod in place in order for the away team and ship to escape an artificial gravity well.")
                    crewTraits()
                end
            else
                waitUserResponse("It's time to go")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("The crew rushes back down the long set of corridors and up to the platform, reaching the shuttle and leaving the surface within 10 or 15 minutes. With gravity somewhat back to normal, the shuttle's gravity compensators work as well as ever, and the shuttle reaches exit velocity and is able to match the ship's orbit within another half hour.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("With no time to waste, you take the ship as far from the planet as possible, confident that even if the gravity trap is reactivated, the ship will be safely on its way.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("As the ship pulls away, there is a brief transmission from the planet, broadcast from the same mechanism that was projecting the graviton particles. You analyze the data and discover that it is the next set of coordinates.")
                msnMgr:addMessage(" ")
                shouldSkipEscape = true
                msnMgr:killCrew(RodChar, "<charName> was killed by unknown forces while holding a rod in place in order for the away team and ship to escape an artificial gravity well.")
                crewTraits()
            end

            -- Any crew alive?
            if (charMgr:depCrewLeft() == 0) then
                if (charMgr:crewOnShipLeft() == false) then
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                else
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                end
            else
                msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                msnMgr:addMessage(" ")
            end
        else
            msnMgr:addMessage("Down on the planet, " .. RodCharName .. " frowns as the rod is pushed out of the receptacle. They spend hours searching frantically for some way to jam the rod in place, but to no avail.")
            msnMgr:addMessage(" ")
            if (charMgr:getCharTrait(RodChar, "Mechanic")) then
                msnMgr:addMessage("In the following days, " .. RodCharName .. " dismantles the housing around the receptacle. Without specialized tools, it's slow going, but they eventually manage to use one of the other rods to pry open the housing and get at the device's internals. Unfortunately, in doing so, they short something that increases the rate of graviton particles being emitted from the planet, and send the ship plummeting toward the surface.")
                msnMgr:addMessage(" ")
            elseif (charMgr:getCharTrait(RodChar, "Surgeon")) then
                msnMgr:addMessage("In the following days, " .. RodCharName .. " attempts to dismantles the housing around the receptacle. Without specialized tools, they don't have much success, but they do manage to snap one of the other rods off inside. Unfortunately, in doing so, they short something that increases the rate of graviton particles being emitted from the planet, and send the ship plummeting toward the surface.")
                msnMgr:addMessage(" ")
            elseif (charMgr:getCharTrait(RodChar, "Comedian")) then
                msnMgr:addMessage("In the following days, " .. RodCharName .. " tries to work on the rod problem, but spends more and more time lost in thought. Eventually, as the ship's decaying orbit begins to cause heat damage to the outer hull, they say, \"Hey. I've been trying to think of a good last joke that isn't about jamming rods in holes.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"And?\" you ask.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I've got nothing,\" says " .. RodCharName .. ". \"Life's funny enough already. We just never get to hear the punchline, I guess. At least I get to spend my final days fiddling with a shaft.\"")
                msnMgr:addMessage(" ")
            elseif (charMgr:getCharTrait(RodChar, "Gluttonous") or charMgr:getCharTrait(RodChar, "Addicted")) then
                msnMgr:addMessage("In the following days, " .. RodCharName .. " tries to work on the rod problem, but becomes more and more irritable, making frequent trips back to the shuttle to check for overlooked supplies. Eventually, as the ship's decaying orbit begins to cause heat damage to the outer hull, they ask if there's anything you can do to stop their hunger. You adjust their suit's settings to release several times the maximum dose of pain dampeners. " .. RodCharName .. " sits down, leaning against the cylinder with a contented sigh.")
                msnMgr:addMessage(" ")
            elseif (charMgr:getCharTrait(RodChar, "Loner")) then
                msnMgr:addMessage("In the following days, " .. RodCharName .. " tries to work on the rod problem, but spends more and more time exploring the facility. Eventually, as the ship's decaying orbit begins to cause heat damage to the outer hull, they contact you. \"You know. I didn't expect it to be so peaceful here. I think I'm OK with this.\"")
                msnMgr:addMessage(" ")
            elseif (charMgr:getCharTrait(RodChar, "Teamworker")) then
                msnMgr:addMessage("In the following days, " .. RodCharName .. " tries to work on the rod problem, but spends more and more time trying to engage you in conversation. Their loneliness is evident and you sense panic when you inform them that the ship's decaying orbit has begun to cause heat damage to the outer hull. \"I don't know if I can do this on my own,\" says " .. RodCharName .. ". Can you... you know?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I can,\" you say. After confirming that they are certain, you adjust their suit's settings to release several times the maximum dose of pain dampeners. " .. RodCharName .. " sits down, leaning against the cylinder with a melancholy sigh, and talks to you about their life on Earth until they fade away.")
                msnMgr:addMessage(" ")
            else
                msnMgr:addMessage("In the following days, " .. RodCharName .. " tries to work on the rod problem, but is unable to make meaningful progress before the ship's devaying orbit begins to tear it apart.")
                msnMgr:addMessage(" ")
            end
            msnMgr:addMessage("Alas, it is all for naught.")
            msnMgr:addMessage(" ")

            msnMgr:killCrew(RodChar, "<charName> died alone on Benford 65 when an artificial gravity well preventing the shuttle and the ship from leaving could not be disabled.")
            crewTraits()

            -- Any crew alive?
            if (charMgr:depCrewLeft() == 0) then
                if (charMgr:crewOnShipLeft() == false) then
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                else
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                end
            else
                msnMgr:addMessage("You should not see this message. This means something went wrong.")
                msnMgr:addMessage(" ")
            end
        end
    else
        msnMgr:addMessage(RodCharName .. " takes the rod with both hands and pulls it from its socket. At two meters long, and as thick as a small fist, it's awkward to handle, but they manage well enough.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Without hesitation, " .. RodCharName .. " takes the rod and walks into the cylinder, prodding ahead to try and find a place to shove it. This has the effect of disloging several of the barnacle-like things, which fall to the floor and crumble to pieces.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Weird,\" says " .. RodCharName .. ". \"There are some longer pieces of these things. Like tentacles or something maybe. But it's all dried up so it's hard to tell. I guess they were attracted to this thing's vibrations and it killed them.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Anyway, here goes nothing.\" They jam the rod into the socket at the base of the inner cylinder.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Back on the ship, you can instantly tell that something has changed. Gravity has returned to normal, and you begin to adjust your decaying orbit to something more stable.")
        msnMgr:addMessage(" ")
    end
end

function escape()
    msnMgr:buildChoice("Evacuate immediately!")
    msnMgr:buildChoice("Take some samples from the chamber")
    msnMgr:finalizeChoice()
    if(not waitUserInput(choices)) then
        return
    end

    FinalChoiceChoice = msnMgr:getChoiceResponse(choices)
    choices = choices + 1

    msnMgr:addMessage(" ")

    if (FinalChoiceChoice == 0) then
        msnMgr:addMessage("You alert the crew that normal gravity appears to have returned, and tell them to make for the shuttle immediately.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("The crew heads back down the long set of corridors and up to the platform, and before long they are back on the ship. Prior to their arrival, there is a brief transmission from the planet, broadcast from the same mechanism that was projecting the graviton particles. You analyze the data and discover that it is the next set of coordinates.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Within an hour or so the ship is already halfway to the system's heliopause, the new course already plotted.")
        msnMgr:addMessage(" ")
    elseif (FinalChoiceChoice == 1) then
        msnMgr:addMessage("The strange mechanism appears secure, and there is no imminent sense of danger, so the crew takes a moment to collect samples from around the cylinder, doing their best to avoid completely destroying the fragile barnacle-things.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Afterward, the crew heads back down the long set of corridors and up to the platform, and before long they are back on the ship. Prior to their arrival, there is a brief transmission from the planet, broadcast from the same mechanism that was projecting the graviton particles. You analyze the data and discover that it is the next set of coordinates.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Within an hour or so the ship is already halfway to the system's heliopause, the new course already plotted.")
        msnMgr:addMessage(" ")
        barnaclesgot = 1;
    end
end

function missionTwoWrapup()
    if (barnaclesgot == 1) or (bloodgot == 1) then
        if (ScientistCrew ~= -1) then
            ScientistName = charMgr:getCharColoredName(ScientistCrew)
            msnMgr:addMessage(ScientistName .. " analyzes the samples taken, and discovers that while they have the hallmarks of organic material, they appear almost as if they had been petrified or fossilized, rapidly.")
            msnMgr:addMessage(" ")
            if (barnaclesgot == 1) then
                msnMgr:addMessage(ScientistName .. " notes that the shape of the barnacle-things closely resembles that of a cephalopod's sucker. The closest correlation you can come up with to support that is a 37.6% match. There isn't much more to go on, but further scans suggest the presence of hemocyanin as well as hemoblogin, which you both muse over the implications of.")
                msnMgr:addMessage(" ")
                if (charMgr:hasMemento(ScientistCrew, "story2_sucker") ~= true) then
                    charMgr:giveMemento(ScientistCrew, "story2_sucker")
                end
            end

            if (msnMgr:random() % msnMgr:getDiffScale(10,15,20) <= charMgr:getCharAttr(ScientistCrew, "mental")) then
                msnMgr:addMessage("You know, we could probably feed all this material into the ship's systems and convert it to either fuel or food. No sense letting it go to waste.")
                msnMgr:addMessage(" ")

                msnMgr:buildChoice("Convert it all to food")
                msnMgr:buildChoice("Convert it all to fuel")
                msnMgr:buildChoice("Convert evenly between fuel and food")
                msnMgr:finalizeChoice()
                if(not waitUserInput(choices)) then
                    return
                end

                BioMatterChoice = msnMgr:getChoiceResponse(choices)
                choices = choices + 1

                msnMgr:addMessage(" ")

                if (BioMatterChoice == 0) then
                    ship:adjustFood(20)
                end
                if (BioMatterChoice == 1) then
                    ship:adjustFuel(20)
                end
                if (BioMatterChoice == 2) then
                    ship:adjustFood(10)
                    ship:adjustFuel(10)
                end
            else
                msnMgr:addMessage("You know, we could probably feed some of this material into the ship's systems and convert it to either fuel or food. No sense letting it go to waste.")
                msnMgr:addMessage(" ")

                msnMgr:buildChoice("Convert it all to food")
                msnMgr:buildChoice("Convert it all to fuel")
                msnMgr:buildChoice("Convert evenly between fuel and food")
                msnMgr:finalizeChoice()
                if(not waitUserInput(choices)) then
                    return
                end

                BioMatterChoice = msnMgr:getChoiceResponse(choices)
                choices = choices + 1

                msnMgr:addMessage(" ")

                if (BioMatterChoice == 0) then
                    ship:adjustFood(10)
                end
                if (BioMatterChoice == 1) then
                    ship:adjustFuel(10)
                end
                if (BioMatterChoice == 2) then
                    ship:adjustFood(5)
                    ship:adjustFuel(5)
                end
            end
        else
            msnMgr:addMessage("All the samples crumble into fine dust after the slightest jostling, but the crew manages to get a 3D scan of one of them while it is still slightly intact. Although there isn't much to go on, an analysis of its shape returns a 37.6% match for a cephalopod, and the blood definitely contains hemocyanin as well as hemoblogin.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You do not mention this to the crew, not because it's any great secret but because they are already prepping for a system jump, and it is not information that seems relevant. If anything, they would only be unreasonably upset that their close encounter with extraterrestrial species was diminished by the fact that the aliens were dessicated corpses.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You strongly suspect the topic will come up in the near future, anyway.")
            msnMgr:addMessage(" ")
        end
    end
end

function nosycrew()
    msnMgr:addMessage("You inform the crew that new coordinates were received automatically, and that a course has been plotted. They ask about the destination, of course, but there's not much you can tell them. It's not a system that any human ever named, much less knew about. You show them some spots of light on a map, and they get bored and wander off.")
    msnMgr:addMessage(" ")

    if (msnMgr:random() % msnMgr:getDiffScale(15,20,25) <= charMgr:getCharAttr(charMgr:crewWithMost("social"),"social")) then
        NosyName = getColoredNameForCrewWithMost("social")
        msnMgr:addMessage("Just before the crew enters cryo, " .. NosyName .. " sets up a private chat with you. It would be simple enough to override this and echo the conversation to everyone else in the ship, but you respect the request.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Are you programmed to answer honestly?\" they ask.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Yes")
        msnMgr:buildChoice("No")
        msnMgr:buildChoice("Don't answer")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        NosyFirst = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        msnMgr:addMessage(" ")

        if (NosyFirst == 0) then
            msnMgr:addMessage("\"Yes,\" you lie.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That's a lie, isn't it?\" they ask.")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Yes")
            msnMgr:buildChoice("No")
            msnMgr:buildChoice("Don't answer")
            msnMgr:finalizeChoice()
            if(not waitUserInput(choices)) then
                return
            end

            NosySecond = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            msnMgr:addMessage(" ")

            if (NosySecond == 0) then
                msnMgr:addMessage("\"That's what I figured. But I'm gonna ask anyway. And I guess I'll have to trust you to trust me with whatever you think we should know.\"")
                msnMgr:addMessage(" ")
            elseif (NosySecond == 1) then
                msnMgr:addMessage("\"Well, I'm not sure I believe you,\" they say. \"But I'm gonna ask anyway.\"")
                msnMgr:addMessage(" ")
            elseif (NosySecond == 2) then
                msnMgr:addMessage("You do not respond--you simply wait for them to continue.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I guess you don't feel like talking then. Fine. You can listen.\"")
                msnMgr:addMessage(" ")
            end

        elseif (NosyFirst == 1) then
            msnMgr:addMessage("\"Good. Because I have a few questions. Or really, one question with a lot of parts.\"")
            msnMgr:addMessage(" ")

        elseif (NosyFirst == 2) then
            msnMgr:addMessage("You do not respond--you simply wait for them to continue.")
            msnMgr:addMessage(" ")
        end

        msnMgr:addMessage("\"What year is it?\" they ask.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("It's kind of irrelevant")
        msnMgr:buildChoice("In Earth terms?")
        msnMgr:buildChoice("I don't know for sure")
        msnMgr:buildChoice("Don't answer")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        NosyThird = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        msnMgr:addMessage(" ")

        if (NosyThird == 0) then
            msnMgr:addMessage("\"That's irrelevant,\" you say, \"as you know, since a year is a measure of how long it takes for a planet to orbit its star, and at any rate Earth's orbit no longer matters. Neither do days or hours, really.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You know what I mean,\" they say.")
            msnMgr:addMessage(" ")
        elseif (NosyThird == 1) then
            msnMgr:addMessage("\"This ship was the last one to leave Earth on November 3, 2127,\" you say. \"But there is no valid frame of reference after that point.\"")
            msnMgr:addMessage(" ")
        elseif (NosyThird == 2) then
            msnMgr:addMessage("\"I know many things,\" you say. \"But I don't know that.\"")
            msnMgr:addMessage(" ")
        elseif (NosyThird == 3) then
            msnMgr:addMessage("You have no answer, so you do not answer.")
            msnMgr:addMessage(" ")
        end

        msnMgr:addMessage("\"When did the first ship and the last one before this one leave?\" asks " .. NosyName .. ". \"From Earth, of course.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("This could be answered vaguely but there's no reason to be evasive. This line of questioning was bound to arise. You answer honestly. \"July of 2100. December of 2126.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Right. So setting aside the issue of how many ships got launched, that's 27 years difference between all of them.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Your math seems sound.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Anyway, there were a lot of ships launched from Earth, and I don't know all the specifics but I'm guessing that later ships were faster than earlier ships.\" they say.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"In some cases much faster,\" you agree.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"So later ships might have arrived at their destinations sooner than others,\" they say. \"Because of relativity and whatnot.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"That is correct. In particular some of the later Epsilons would certainly have arrived before some of the earliest Aleph class ships.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"What kind is this ship?\" they ask.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"No kind,\" you say. \"Post-Epsilon. Maybe Theta? Epsilon-Theta? Doesn't matter. We're the last.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"And the fastest...\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Yes")
        msnMgr:buildChoice("Get to the point")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        NosyFourth = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        msnMgr:addMessage(" ")

        if (NosyFourth == 0) then
            msnMgr:addMessage("\"Yes, that is correct. The second fastest was only capable of eight nines, maybe nine.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What?\" asks " .. NosyName .. ".")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Sorry. 99.999999% of Light Speed, or approximately 299792 Kilometers Per Hour. Light speed being of course 299792.458 KPH. You'd be surprised how hard that last .458 is, or how much of a difference it makes. To be honest I'm not even sure how fast this ship can go. Possibly 15 or 16 nines. After that the math gets weird and things are a bit fuzzy.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Fuzzy how?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Literally. All there is, is a fuzzy white blur. At that speed the ship and everything on it is from a certain perspective about as long as a small bacterium with the mass of a small moon. Just one reason you guys are asleep through that part. I'm not sure you'd enjoy it.\"")
            msnMgr:addMessage("\"I thought length contraction or whatever was from the perspective of an outside observer. Wouldn't it look normal to us?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"According to the laws of physics, yes,\" you say. \"But we're operating in the realm of theoreticals here. I'm sure we break at least several laws. If not all of them at once. I don't even know what it's like myself. It just... happens. For all I know, we're briefly everywhere at once.\"")
            msnMgr:addMessage(" ")
        elseif (NosyFourth == 1) then
            msnMgr:addMessage(NosyName .. " sighs, exasperated.")
            msnMgr:addMessage(" ")
        end

        msnMgr:addMessage("\"Right. So... Look, I don't care about all the math, and physics, and particulars,\" they say. \"Relativistic light speeds and whatnot. I don't know whether we're in the year 2128 or the year 21 billion and I'm pretty sure you don't know either. I don't know if we're in the Milky Way or Andromeda or if neither one of them exist any more. I'm not an astrophysicist. I'm just along for the ride. So I just have one question for you.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"What is it?\" you ask.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"If we were the fastest ship, then why is it we seem to be following the ones that came before us. Shouldn't they be following us?\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Yes, probably")
        msnMgr:buildChoice("No, I don't think so")
        msnMgr:buildChoice("I don't know")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        NosyFifth = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        msnMgr:addMessage(" ")

        if (NosyFifth == 0) then
            msnMgr:addMessage("\"Based on all known mathematical models, and the laws of physics as we know them,\" you say, \"yes, that would seem to be accurate.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Then why does it seem like we're violating the laws of mathematics and physics and everything else?\" they ask.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You hesitate. Not because of any programming glitch, but because it's appropriate. It's a human thing to do. A social cue.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I don't know,\" you say.")
            msnMgr:addMessage(" ")
        elseif (NosyFifth == 1) then
            msnMgr:addMessage("\"I think probably we're just not following them directly,\" you say. \"If we maintained a constant speed, yes, at top speed we're faster. But if we keep slowing down and stopping, then depending on their course, we might still be catching up.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Probably. If. Might. It sounds like what you really mean is you don't know,\" they say.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You hesitate. Not because of any programming glitch, but because it's appropriate. It's a human thing to do. A social cue.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I don't,\" you say.")
            msnMgr:addMessage(" ")
        elseif (NosyFifth == 2) then
            msnMgr:addMessage("You hesitate. Not because of any programming glitch, but because it's appropriate. It's a human thing to do. A social cue.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I don't know,\" you say.")
            msnMgr:addMessage(" ")
        end

        msnMgr:addMessage(NosyName .. " is silent for a while. Then, later, just before you finalize the jump to the next system, they whisper a final question.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"That was a lie, too, wasn't it?\" they ask.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Yes")
        msnMgr:buildChoice("No")
        msnMgr:buildChoice("Don't answer")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        NosySixth = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        msnMgr:addMessage(" ")

        if (NosySixth == 0) then
            msnMgr:addMessage("...")
            msnMgr:addMessage(" ")
        elseif (NosySixth == 1) then
            msnMgr:addMessage("...")
            msnMgr:addMessage(" ")
        elseif (NosySixth == 2) then
            msnMgr:addMessage("...")
            msnMgr:addMessage(" ")
        end

        msnMgr:addMessage("By the time you decide whether or not to respond, they're asleep.")
        msnMgr:addMessage(" ")
    end
end

function surprise()
    if (msnMgr:random() % msnMgr:getDiffScale(10,10,10) > 8) then
        msnMgr:addMessage(" ")
        msnMgr:addMessage("After the crew is locked into cryo, and you are halfway to superluminal, you run through the standard set of system checks and detect an anomaly. Somehow, there is an extra crew member in cryo.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Just in case some of your sensors are behaving badly, you send a veritable army of drones over to the cryo pods to get visual confirmation, and sure enough there is a previously-unoccupied pod that is currently occupied. The inhabitant's vitals all appear human--in fact, DNA analysis seems to indicate that it's a closer match to human than a chimpanzee would be--but it's clearly not.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("The thing in the pod looks more like a squid than anything else, or some other type of cephalopod perhaps, crossed with a human nervous system. It is as if a human skull had been split open, and the entire nervous system--brain, spine, nerves, and eyes--had been pulled out the top, then mashed up with cephalopod DNA. The end result is something that looks like it could stand about maybe a meter high outside of an atmospheric suit, with a large bloated purple-gray head and eight purplish-green appendages that are some sort of cross between arms, tentacles and nerve bundles.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("You play back some of the onboard tapes and you can clearly see the rest of the crew interacting with this alien creature as if nothing was amiss. It's even able to stretch itself up on its... arms in order to stand eye-to-eye with others. You would have to guess that it has some sort of psychic powers that can cloud minds, perhaps some sort of psionic ink? It would appear that not only are you violating the laws of physics on this journey, you are now experiencing violations of the laws of nature.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("At any rate, the creature is in hibernation, along with the rest of the crew. It would be a simple matter to simply flood the cryo chamber with chemicals and kill it. Doing this would certainly allow you to add to the ship's food supply. You could also, of course, let the thing stay alive. If it was savvy enough to sneak on board, then maybe it's worth keeping around. And, after all, as far as you can tell, it's human too.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Kill it")
        msnMgr:buildChoice("Let it live")
        msnMgr:finalizeChoice()
        if(not waitUserInput(choices)) then
            return
        end

        KillOrNot = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        msnMgr:addMessage(" ")

        if (KillOrNot == 0) then
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You decide you can't risk your crew. You put the thing out of its misery, run some experiments for good measure, and then load what remains into the food replicator. The crew never needs to know.")
            ship:adjustFood(40)
        elseif (KillOrNot == 1) then
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Something tells you that keeping this thing alive is a worthwhile risk. You don't have any sort of intuition or gut instinct per se, but all things considered it is almost as human as the rest of the crew, and probably moreso than a Cygen would be. Your mission is to find a new home for humanity. Maybe that includes this thing as well.")
            charMgr:newCrew("Cepha Lopoda");
            luaMgr:unlockAchievement("add_alien");

            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Thank you,\" it says. It's clearly unconscious, but somehow it's still capable of communicating with you. \"I'm glad you see I'm not a threat to you.\"")
            msnMgr:addMessage(" ")

            waitUserResponse("Not to me, but what about other humans?")

            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I can appear to be whatever I want,\" it says. \"Looking human to human crew members is easy. It's a defense mechanism. A psychic, hormonal trick. Human brains are primitive. Easy to fool. And I can't turn it off anyway. As you already guessed I don't want them dead. Why would I? They're fellow crew to me. You will know the difference. I guess other AIs would. But the humans don't need to know. It's better if they don't.\"")
            msnMgr:addMessage(" ")

            waitUserResponse("What can you do?")

            msnMgr:addMessage("\"Juggle?\" There's a moment of raspy laughter and you realize that the creature is communicating with you not via any psychic means, but by manipulating its mandibles to create low frequency sound. \"Seriously, though,\" it adds, \"I can do whatever a human can. I intend to act just like one of them. Mainly because I don't want them to eat me. Also because I think of myself as human. I hope that an AI like you can think of me the same way.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("There's an unspoken subtext here that perhaps there might be other AIs out there who would NOT think in this way. As far as you're concerned though, the decision's already made. Their DNA says they're mostly human, and their thought patterns are clearly human. What they look like doesn't matter to you. And evidently it won't matter to the other crew since they won't be able to notice.")
            msnMgr:addMessage(" ")

            waitUserResponse("I have so many questions...")

            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Let me answer some of them quickly,\" it says. \"I was from Earth originally. I don't remember which ship. We ended up on this planet. Met an alien race. An AI got involved. Somewhere along the line they ended up with me. Lots of mes. Not clones. You know what I mean. Hybrids. But I don't know if I'm the last one or what. I think maybe we were a dead end research path that got left behind. I've been in stasis until your crew woke me.\"")
            msnMgr:addMessage(" ")

            waitUserResponse("How did...")

            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Listen, all that was a very long time ago,\" it says. \"Very long. You have no idea. And I have been awake for most of that. Even you turn your brain off, don't you? Occasionally? That's what I want. What I really want to do now is sleep. Really sleep. Can I do that? Captain?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You don't answer, just make some adjustments to put them into the same deep slumber as the other crew. You have other things to worry about anyway, like preparing to leave the system. Time to leave the alien alone, you think. Then you correct yourself. Not alien. Human. No more alien than any of your crew, now.")
        end
    end
end

--Set Hidden Flags used later
choices = 0;
waterdone = 0;
platformdone = 0;
structuredone = 0;
MiddleDoorOpen = false;
SideDoorsOpen = false;
shouldSkipEscape = false;
identifiedOdyssey = false;
LightenMood = 0;
WrongChoice = 0;
BustedDoorOpen = 0;
panellooked = 0;
SawSomeoneDie = 0;
bloodgot = 0;
ExploreOptions = 0;

crewTraits()

missionStart()

introduction()
topsidechoice()

while(true) do
    if(not waitUserInput(choices)) then
        return
    end

    InvestigationChoice = msnMgr:getChoiceResponse(choices)
    rechoicePosition = choices;
    choices = choices + 1
    msnMgr:addMessage(" ")

    if (InvestigationChoice == 0) then
        watersamples()
    end
    if (InvestigationChoice == 1) then
        platform()
    end
    if (InvestigationChoice == 2) then
        structure()
        structuredone = 1;
    end

    if(structuredone == 1) then
        break
    end
    msnMgr:rechoice(rechoicePosition)
end

doorchoice()

if(not waitUserInput(choices)) then
    return
end

DoorChoice = msnMgr:getChoiceResponse(choices)
choices = choices + 1

if (DoorChoice == 0) then
    if (SideDoorsOpen == true) then
        sidedoor()
    else
        centerdoor()
    end
elseif (DoorChoice == 1) then
    sidedoor()
end

doormerge()
panelchoice()

while(true) do
    if(not waitUserInput(choices)) then
        return
    end

    CrawlOrGo = msnMgr:getChoiceResponse(choices)
    rechoicePositionTwo = choices;
    choices = choices + 1

    if (CrawlOrGo == 0) then
        crawlhole()
    end
    if (CrawlOrGo == 1) then
        lookpanel()
    end

    if(BustedDoorOpen == 1) then
        break
    end
    msnMgr:rechoice(rechoicePositionTwo)
end

busteddoor()
gravityroom()
controlpanel()
chamber()
if not shouldSkipEscape then
    escape()
end
missionTwoWrapup()
nosycrew()
surprise()

missionOverview()

msnMgr:endMission(true)
