Can't name The Sidewinder "The Orgymobile"

AlotMaster

New Member
May 21, 2022
1
0
21
I figured out a suitable name for my new ship, but when I talked with Olympia to name it, the game crashed. Also crashed the second time with the same message. It isn't about two words, I tried naming it 'Test Test' and it worked fine.
1653161297474.png
 

OrangeBurner

Well-Known Member
Mar 13, 2022
305
72
I think it just has problem with the word "The".

The code has a section for removing the "The " part of the name. (So just call your ship "Orgymobile")
JavaScript:
function nameTheSidewinder()
{
    clearOutput();
    showOlympia();
    author("Savin");

    let txt = getInputText();

    if (txt.length <= 0 || txt.toLowerCase() == pc_ship.a) // Also should it be a better idea to do this string check after we've split the string?
    {
        output("<b>You must enter <i>something</i>.</b>");
        displayInput(pc_ship.short);
        return;
    }

    // Smartly crop out double articles, if possible
    if(pc_ship.a != "" && (txt.toLowerCase()).indexOf(pc_ship.a) == 0)
    {
        txt.splice(pc_ship.a.length, txt.length); // You can't splice a string.
    }

    pc_ship.short = txt;

The problem is that they used .splice when they should've used .split.
JavaScript:
function nameTheSidewinder()
{
    clearOutput();
    showOlympia();
    author("Savin");

    let txt = getInputText();
    txt = txt.trim(); // Makes "    " into ""
    let bannedNames = ["the", pc_ship.a, ""]; // Add more later

    if (txt.toLowerCase() in bannedNames)
    {
        output("<b>You must enter <i>something</i>.</b>");
        displayInput(pc_ship.short);
        return;
    }

    // Smartly crop out double articles, if possible
    if(pc_ship.a != "" && (txt.toLowerCase()).indexOf(pc_ship.a) == 0)
    {
        // EDIT 2: removes all instances of "the "
        // let txt2 = txt.split(pc_ship.a); // Should split it into the array ["", "Ship Name"]
        // txt = txt2.join("");
       
        // EDIT 3 Allows ship names with 'the' in them like: "The Ship of the Great Steele" goes into "Ship of the Great Steele".
        let txt2 = txt.split(" "); // Should be an array of ["The", "Ship", "of", "the", "Great", "Steele"]
       
        if(txt2[0].toLowerCase() == "the") // if only the first word is "The" (Don't use pc_ship.a since this won't have a space (or change pc_ship.a to just "the")
        {
            txt2.splice(0, 1);
        }
        txt = txt2.join(" ");

    }

    pc_ship.short = txt;
EDIT 3: This code does leave out the possibly of someone naming their ship something like the "the the the" though (as it only removes the first one).
But then again you can also just call your ship the " " if you want in the current version

(Ok, theres meant to be about 10 spaces inbetween those quotation marks but the formatting won't let me do it so here's a picture.)
The.png
The.png
I like to imagine that whenever someone asks what the ship is called all of the crew stops what they're doing to blankly stare at them in silence for a few seconds and then just continues the conversation like nothing ever happened.

EDIT: I forgot that .substring() is an thing and it works pretty much the same as splice.

EDIT 2: Relooking at the code you could just call the ship "The" if you want (as long as you don't put a space afterwards because pc_ship.a equals "The "):
The.png
EDIT 3: Update code a bit
 
Last edited: