diff --git a/src/Documentation/doc/en/help/getting_started.md b/src/Documentation/doc/en/help/getting_started.md index 503c7df065..2a2a94894f 100644 --- a/src/Documentation/doc/en/help/getting_started.md +++ b/src/Documentation/doc/en/help/getting_started.md @@ -19,11 +19,11 @@ Since this guide is written as a basic introduction to Bitburner, it will not ex ## First Steps I'm going to assume you followed the introductory tutorial when you first began the game. -In this introductory tutorial, you created a [Script](../basic/scripts.md) called `n00dles.js` and ran it on the `n00dles` server. +In this introductory tutorial, you created a [Script](../basic/scripts.md) called `hacking.js` and ran it on the `home` server. Now, we'll kill this [Script](../basic/scripts.md). There are two ways to do this: -- You can go to the Terminal and enter: `kill n00dles.js` -- You can go to the `Active Scripts` page (Alt + s) and press the `Kill Script` button for `n00dles.js`. +- You can go to the Terminal and enter: `kill hacking.js` +- You can go to the `Active Scripts` page (Alt + s) and press the `Kill Script` button for `hacking.js`. If you skipped the introductory tutorial, then ignore the part above. Instead, go to the `Hacknet Nodes` page (Alt + h) and purchase a [Hacknet Node](../basic/hacknet_nodes.md) to start generating some passive income. diff --git a/src/Documentation/ui/DocumentationRoot.tsx b/src/Documentation/ui/DocumentationRoot.tsx index 94767553ce..65c418e815 100644 --- a/src/Documentation/ui/DocumentationRoot.tsx +++ b/src/Documentation/ui/DocumentationRoot.tsx @@ -16,6 +16,7 @@ import { Settings } from "../../Settings/Settings"; import { Router } from "../../ui/GameRoot"; import { Page } from "../../ui/Router"; import { DocumentationAutocomplete } from "./DocumentationAutocomplete"; +import { iTutorialSteps, ITutorial } from "../../InteractiveTutorial"; export function DocumentationRoot({ docPage }: { docPage?: string }): React.ReactElement { const history = useHistory(); @@ -70,6 +71,20 @@ export function DocumentationRoot({ docPage }: { docPage?: string }): React.Reac }, 0); }); + /** + * During the tutorial, the player is given the link to the NS API page a few times. If they click one of the links, + * then when they come to the documentation step they'll still see the NS API docs. This ensures that when the player + * visits the documentation page for the Docs step, they see index.md / home. + */ + useEffect(() => { + if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.DocumentationInfo) { + history.home(); + } + + // Lint doesn't like empty dependencies. But this really should only run on the first render. So: + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + return ( <> Promise.resolve(); // this is duplicate code with saving later. - if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.ScriptEditorEditAndSave) { + if ( + ITutorial.isRunning && + (ITutorial.currStep === iTutorialSteps.ScriptEditorEditAndSave || + ITutorial.currStep === iTutorialSteps.ScriptEditorRam) + ) { //Make sure filename + code properly follow tutorial - if (currentScript.path !== "n00dles.js") { - dialogBoxCreate("Don't change the script name for now."); + if (currentScript.path !== tutorialScriptName) { + dialogBoxCreate("Don't change the script's name for now."); return; } const cleanCode = currentScript.code.replace(/\s/g, ""); const expectedCleanCode = `/**@param{NS}ns*/exportasyncfunctionmain(ns){while(true){awaitns.hack("n00dles");}}`; if (!cleanCode.includes(expectedCleanCode)) { - dialogBoxCreate("Please copy and paste the code from the tutorial!"); + dialogBoxCreate("Use the code from the tutorial panel. Don't change it for now."); return; } //Save the script await preSave(); saveScript(currentScript); - Router.toPage(Page.Terminal); - iTutorialNextStep(); return; diff --git a/src/ScriptEditor/ui/Toolbar.tsx b/src/ScriptEditor/ui/Toolbar.tsx index c7cd09a93f..8897223dff 100644 --- a/src/ScriptEditor/ui/Toolbar.tsx +++ b/src/ScriptEditor/ui/Toolbar.tsx @@ -26,6 +26,7 @@ import { DocumentationAutocomplete } from "../../Documentation/ui/DocumentationA import { openDocumentationPopUp } from "../../Documentation/root"; import { defaultNsApiPage, openDocExternally } from "../../ui/React/Documentation"; import { DocumentationLink } from "../../ui/React/DocumentationLink"; +import { iTutorialSteps, iTutorialNextStep, ITutorial } from "../../InteractiveTutorial"; type IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor; @@ -70,14 +71,27 @@ export function Toolbar({ editor, onSave, onRun, onBeautify }: IProps) { Beautify + + + + + + + {step + 1} / {Object.keys(iTutorialSteps).length / 2 - 1} + + + ); }