Merge pull request #3866 from ilkecan/parameterize-script-extension

TUTORIAL: Remove the hardcoded script extension
This commit is contained in:
hydroflame 2022-07-06 14:26:40 -04:00 committed by GitHub
commit ee9cdee512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,11 +58,12 @@ export function InteractiveTutorialRoot(): React.ReactElement {
const [language, setLanguage] = useState(Language.None); const [language, setLanguage] = useState(Language.None);
const classes = useStyles(); const classes = useStyles();
const tutorialScriptName = { const tutorialScriptExtension = {
[Language.None]: "n00dles.script", [Language.None]: ".script",
[Language.NS1]: "n00dles.script", [Language.NS1]: ".script",
[Language.NS2]: "n00dles.js", [Language.NS2]: ".js",
}[language]; }[language];
const tutorialScriptName = `n00dles${tutorialScriptExtension}`;
const contents: { [number: string]: IContent | undefined } = { const contents: { [number: string]: IContent | undefined } = {
[iTutorialSteps.Start as number]: { [iTutorialSteps.Start as number]: {
@ -377,7 +378,9 @@ export function InteractiveTutorialRoot(): React.ReactElement {
</Typography> </Typography>
<Typography classes={{ root: classes.textfield }}>{"[home ~/]> nano"}</Typography> <Typography classes={{ root: classes.textfield }}>{"[home ~/]> nano"}</Typography>
<Typography>Scripts must end with the .script extension. Let's make a script now by entering </Typography> <Typography>
Scripts must end with the {tutorialScriptExtension} extension. Let's make a script now by entering{" "}
</Typography>
<Typography classes={{ root: classes.textfield }}>{`[home ~/]> nano ${tutorialScriptName}`}</Typography> <Typography classes={{ root: classes.textfield }}>{`[home ~/]> nano ${tutorialScriptName}`}</Typography>
<Typography> <Typography>
@ -457,7 +460,7 @@ export function InteractiveTutorialRoot(): React.ReactElement {
<> <>
<Typography> <Typography>
Your script is now running! It will continuously run in the background and will automatically stop if the Your script is now running! It will continuously run in the background and will automatically stop if the
code ever completes (the n00dles.script will never complete because it runs an infinite loop). <br /> code ever completes (the {tutorialScriptName} will never complete because it runs an infinite loop). <br />
<br /> <br />
These scripts can passively earn you income and hacking experience. Your scripts will also earn money and These scripts can passively earn you income and hacking experience. Your scripts will also earn money and
experience while you are offline, although at a slightly slower rate. <br /> experience while you are offline, although at a slightly slower rate. <br />