diff --git a/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx b/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx index 59cd45fc5..3f4c3c525 100644 --- a/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx +++ b/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx @@ -42,14 +42,29 @@ const useStyles = makeStyles()((theme: Theme) => ({ }, })); +function Example({ content }: { content: string }): React.ReactElement { + const { classes } = useStyles(); + return ( + <> +
+ + Example:{" "} + + {content} + + + + ); +} + export function InteractiveTutorialRoot(): React.ReactElement { const { classes } = useStyles(); const rerender = useRerender(); const tutorialScriptName = `n00dles.js`; - const contents: Record = { - [iTutorialSteps.Start as number]: { + const contents: Record = { + [iTutorialSteps.Start]: { content: ( <> @@ -69,7 +84,7 @@ export function InteractiveTutorialRoot(): React.ReactElement { ), canNext: true, }, - [iTutorialSteps.GoToCharacterPage as number]: { + [iTutorialSteps.GoToCharacterPage]: { content: ( <> Let's start by heading to the Stats page. Click @@ -83,7 +98,7 @@ export function InteractiveTutorialRoot(): React.ReactElement { ), canNext: false, }, - [iTutorialSteps.CharacterPage as number]: { + [iTutorialSteps.CharacterPage]: { content: ( <> @@ -97,7 +112,7 @@ export function InteractiveTutorialRoot(): React.ReactElement { ), canNext: true, }, - [iTutorialSteps.CharacterGoToTerminalPage as number]: { + [iTutorialSteps.CharacterGoToTerminalPage]: { content: ( <> Let's head to your computer's terminal by clicking @@ -110,7 +125,7 @@ export function InteractiveTutorialRoot(): React.ReactElement { ), canNext: false, }, - [iTutorialSteps.TerminalIntro as number]: { + [iTutorialSteps.TerminalIntro]: { content: ( <> @@ -120,113 +135,107 @@ export function InteractiveTutorialRoot(): React.ReactElement { is used to interface with your home computer as well as all of the other machines around the world. +
+ + In the next steps, the tutorial will show you how to use the most basic commands. In each step, we may show + you an example of how the terminal should look when you enter the command. + ), canNext: true, }, - [iTutorialSteps.TerminalHelp as number]: { + [iTutorialSteps.TerminalHelp]: { content: ( <> - Let's try it out. Start by entering - {"[home /]> help"} + Let's try it out. Start by entering "help" to the terminal (Don't forget to press Enter after typing the command) + ), canNext: false, }, - [iTutorialSteps.TerminalLs as number]: { + [iTutorialSteps.TerminalLs]: { content: ( <> - {"[home /]> help"} - displays a list of all available Terminal commands, how to use them, and a description of what they do.{" "} + The "help" command displays a list of all available Terminal commands, how to use them, and a description of + what they do.

-
- Let's try another command. Enter -
- - {"[home /]> ls"} - -
( "ls" is short for "list" ) + Let's try another command. Enter "ls" ("ls" is short for "list" ).
+ ), canNext: false, }, - [iTutorialSteps.TerminalScan as number]: { + [iTutorialSteps.TerminalScan]: { content: ( <> - {"[home /]> ls"} - {" "} - is a basic command that lists the files on the computer. Right now, it shows that you have a program called{" "} - NUKE.exe on your computer. We'll get to what this does later.
+ The "ls" command is a basic command that lists the files on the computer. Right now, it shows that you have + a program called NUKE.exe on your computer. We'll get to what this does later.

Using your home computer's terminal, you can connect to other machines throughout the world. Let's do that - now by first entering + now by first entering "scan".
- {"[home /]> scan"} + ), canNext: false, }, - [iTutorialSteps.TerminalScanAnalyze1 as number]: { + [iTutorialSteps.TerminalScanAnalyze1]: { content: ( <> - {"[home /]> scan"} - shows all available network connections. In other words, it displays a list of all servers that can be - connected to from your current machine. A server is identified by its hostname.
+ The "scan" command shows all available network connections. In other words, it displays a list of all + servers that can be connected to from your current machine. A server is identified by its hostname.

- That's great and all, but there's so many servers. Which one should you go to?{" "} + That's great and all, but there's so many servers. Which one should you go to?
- {"[home /]> scan-analyze"} - gives some more detailed information about servers on the network. Try it now! + + The "scan-analyze" command gives some more detailed information about servers on the network. Try it now! + + ), canNext: false, }, - [iTutorialSteps.TerminalScanAnalyze2 as number]: { + [iTutorialSteps.TerminalScanAnalyze2]: { content: ( <> - {"[home /]> scan-analyze"} - shows more detailed information about each server that you can connect to (servers that are a distance of - one node away).
+ The "scan-analyze" command shows more detailed information about each server that you can connect to + (servers that are a distance of one node away).

It is also possible to run scan-analyze with a higher depth. Let's try a depth of two with the - following command:{" "} + following command: "scan-analyze 2"
- {"[home /]> scan-analyze 2"} + ), canNext: false, }, - [iTutorialSteps.TerminalConnect as number]: { + [iTutorialSteps.TerminalConnect]: { content: ( <> Now you can see information about all servers that are up to two nodes away, as well as figure out how to navigate to those servers through the network. You can only connect to a server that is one node away. To - connect to a machine, use + connect to a machine, use the "connect" command. - {"[home /]> connect hostname"} - - From the results of - {"[home /]> scan-analyze 2"} - {" "} - we can see that the n00dles server is only one node away. Let's connect to it now using: + From the results of the "scan-analyze" command, we can see that the n00dles server is only one node away. + Let's connect to it now using "connect n00dles". - {"[home /]> connect n00dles"} + ), canNext: false, }, - [iTutorialSteps.TerminalAnalyze as number]: { + [iTutorialSteps.TerminalAnalyze]: { content: ( <> @@ -236,52 +245,44 @@ export function InteractiveTutorialRoot(): React.ReactElement { money on servers and computers. Using your hacking abilities, you can hack servers to steal money and gain experience.

- Before you try to hack a server, you should run diagnostics using{" "} + Before you try to hack a server, you should run diagnostics using the "analyze" command.
- {"[n00dles /]> analyze"} + ), canNext: false, }, - [iTutorialSteps.TerminalNuke as number]: { + [iTutorialSteps.TerminalNuke]: { content: ( <> - When - {"[n00dles /]> analyze"} - - finishes running it will show useful information about hacking the server.
-
For this server, the required hacking skill is only 1, which means you can hack it right now. - However, in order to hack a server you must first gain root access. The NUKE.exe program that we saw earlier - on your home computer is a virus that will grant you root access to a machine if there are enough open - ports. + When the "analyze" command finishes running, it will show useful information about hacking the server. +
+ For this server, the required hacking skill is only 1, which means you can hack it right now. However, in + order to hack a server you must first gain root access. The NUKE.exe program that we saw earlier on your + home computer is a virus that will grant you root access to a machine if there are enough open ports.
- {"[n00dles /]> analyze"} - +
- {" "} - shows that there do not need to be any open ports on this machine for the NUKE virus to work, so go ahead - and run the virus using{" "} + The "analyze" command shows that there do not need to be any open ports on this machine for the NUKE program + to work, so go ahead and run the NUKE program using "run NUKE.exe". - {"[n00dles /]> run NUKE.exe"} - - + ), canNext: false, }, - [iTutorialSteps.TerminalManualHack as number]: { + [iTutorialSteps.TerminalManualHack]: { content: ( <> - You now have root access! You can hack the server using - {"[n00dles /]> hack"} - + You now have root access! You can hack the server using the "hack" command. Try doing that now. + ), canNext: true, }, - [iTutorialSteps.TerminalHackingMechanics as number]: { + [iTutorialSteps.TerminalHackingMechanics]: { content: ( You are now attempting to hack the server. Performing a hack takes time and only has a certain percentage @@ -294,27 +295,27 @@ export function InteractiveTutorialRoot(): React.ReactElement {

The amount of money on a server is not limitless. So, if you constantly hack a server and deplete its money, - then you will encounter diminishing returns in your hacking. You will need to use{" "} - {"[n00dles /]> grow"} - which tricks the company into adding money to their server and{" "} - {"[n00dles /]> weaken"} - which increases the speed of hack and grow. + then you will encounter diminishing returns in your hacking. You will need to use the "grow" command which + tricks the company into adding money to their server and the "weaken" command which decreases the server's + security level. +
+ +
), canNext: true, }, - [iTutorialSteps.TerminalGoHome as number]: { + [iTutorialSteps.TerminalGoHome]: { content: ( <> - From any server you can get back home using - {"[n00dles /]> home"} - + From any server you can get back home using the "home" command. Let's head home before creating our first script! + ), canNext: false, }, - [iTutorialSteps.TerminalCreateScript as number]: { + [iTutorialSteps.TerminalCreateScript]: { content: ( <> @@ -322,19 +323,19 @@ export function InteractiveTutorialRoot(): React.ReactElement { hacking manually the entire time. You can automate your hacking by writing scripts!

- To create a new script or edit an existing one, you can use{" "} + To create a new script or edit an existing one, you can use the "nano" command.
- {"[home /]> nano"} - Scripts must end with a script extension (.js, .jsx, .ts, .tsx). Let's make a script now by entering + Scripts must end with a script extension (.js, .jsx, .ts, .tsx). Let's make a script now by entering " + {`nano ${tutorialScriptName}`}" - {`[home /]> nano ${tutorialScriptName}`} + nano ${tutorialScriptName}`} /> ), canNext: false, }, - [iTutorialSteps.TerminalEditScript as number]: { + [iTutorialSteps.TerminalEditScript]: { content: ( <> @@ -372,7 +373,7 @@ export async function main(ns) { ), canNext: false, }, - [iTutorialSteps.TerminalFree as number]: { + [iTutorialSteps.TerminalFree]: { content: ( <> @@ -381,25 +382,26 @@ export async function main(ns) { RAM for your home server.

- To check how much RAM is available on this machine, enter + To check how much RAM is available on this machine, use the "free" command.
- {"[home /]> free"} + ), canNext: false, }, - [iTutorialSteps.TerminalRunScript as number]: { + [iTutorialSteps.TerminalRunScript]: { content: ( <> - We have 8GB of free RAM on this machine, which is enough to run our script. Let's run our script using + We have 8GB of free RAM on this machine, which is enough to run our script. Let's run our script using " + {`run ${tutorialScriptName}`}" - {`[home /]> run ${tutorialScriptName}`} + run ${tutorialScriptName}`} /> ), canNext: false, }, - [iTutorialSteps.TerminalGoToActiveScriptsPage as number]: { + [iTutorialSteps.TerminalGoToActiveScriptsPage]: { content: ( <> @@ -419,7 +421,7 @@ export async function main(ns) { ), canNext: false, }, - [iTutorialSteps.ActiveScriptsPage as number]: { + [iTutorialSteps.ActiveScriptsPage]: { content: ( <> @@ -443,19 +445,20 @@ export async function main(ns) { ), canNext: false, }, - [iTutorialSteps.ActiveScriptsToTerminal as number]: { + [iTutorialSteps.ActiveScriptsToTerminal]: { content: ( <> One last thing about scripts, each active script contains logs that detail what it's doing. We can check - these logs using the tail command. Do that now for the script we just ran by typing{" "} + these logs using the "tail" command. Do that now for the script we just ran by typing " + {`tail ${tutorialScriptName}`}" - {`[home /]> tail ${tutorialScriptName}`} + tail ${tutorialScriptName}`} /> ), canNext: false, }, - [iTutorialSteps.TerminalTailScript as number]: { + [iTutorialSteps.TerminalTailScript]: { content: ( <> @@ -478,7 +481,7 @@ export async function main(ns) { ), canNext: true, }, - [iTutorialSteps.GoToHacknetNodesPage as number]: { + [iTutorialSteps.GoToHacknetNodesPage]: { content: ( <> @@ -494,7 +497,7 @@ export async function main(ns) { ), canNext: false, }, - [iTutorialSteps.HacknetNodesIntroduction as number]: { + [iTutorialSteps.HacknetNodesIntroduction]: { content: ( Here you can purchase new Hacknet Nodes and upgrade your existing ones. Let's purchase a new one now. @@ -502,7 +505,7 @@ export async function main(ns) { ), canNext: true, }, - [iTutorialSteps.HacknetNodesGoToWorldPage as number]: { + [iTutorialSteps.HacknetNodesGoToWorldPage]: { content: ( <> @@ -520,7 +523,7 @@ export async function main(ns) { ), canNext: false, }, - [iTutorialSteps.WorldDescription as number]: { + [iTutorialSteps.WorldDescription]: { content: ( <> @@ -538,7 +541,7 @@ export async function main(ns) { ), canNext: false, }, - [iTutorialSteps.DocumentationPageInfo as number]: { + [iTutorialSteps.DocumentationPageInfo]: { content: ( This page contains a lot of different documentation about the game's contents and mechanics. I know it's a @@ -571,7 +574,7 @@ export async function main(ns) { ), canNext: true, }, - [iTutorialSteps.End as number]: { + [iTutorialSteps.End]: { content: , canNext: true, },