Skip to content

Commit 4ed85a0

Browse files
authored
Merge pull request bitburner-official#6 from MSivonen/readme_for_dummies
Guide for dummies
2 parents ca1c313 + eae78ce commit 4ed85a0

File tree

2 files changed

+87
-7
lines changed

2 files changed

+87
-7
lines changed

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
1-
## Dependencies
1+
# Typescript template for Bitburner's Remote File API
22

3-
[Node.js](https://nodejs.org/en/download/) required for compiling typescript and installing dependencies
3+
The official template for synchronizing Typescript/Javascript from your computer to the game.
44

5-
## Installation
5+
[Step by step install](https://github.com/bitburner-official/typescript-template/guide_for_dummies.md)
66

7+
[Learn more about Typescript](https://www.typescriptlang.org/docs/)
8+
9+
## About
10+
11+
This template uses the Typescript compiler and the Remote File API system to synchronize Typescript to your game.
12+
Due to the usage of the RFA system, it works with Web and Electron versions of the game.
13+
14+
## Prerequisites
15+
16+
[Node.js](https://nodejs.org/en/download/) is needed for compiling typescript and installing dependencies
17+
18+
[See here for step by step installation](https://github.com/bitburner-official/typescript-template/guide_for_dummies.md) if you'd like help with installing Node and/or connecting to the game.
19+
20+
## Quick start
21+
22+
Download the template to your computer and install everything it requires:
723
```
824
git clone https://github.com/bitburner-official/typescript-template
25+
cd typescript-template
926
npm i
1027
```
1128

12-
## How to use this template
29+
### How to use this template
1330

1431
Write all your typescript source code in the `/src` directory
1532

@@ -20,15 +37,18 @@ Have them both running simultaneously so that it all happens automatically.
2037
For Bitburner to receive any files, you need to enter the port `npm run watch` logs to the terminal
2138
in the Remote API section of the game settings, and press the connect button.
2239

23-
## Imports
40+
[See here for step by step installation](https://github.com/bitburner-official/typescript-template/guide_for_dummies.md) if you'd like help with installing Node and/or connecting to the game.
41+
42+
## Advanced
43+
### Imports
2444

2545
To ensure both the game and typescript have no issues with import paths, your import statements should follow a few formatting rules:
2646

2747
- Paths must be absolute from the root of `src/`, which will be equivalent to the root directory of your home drive
2848
- Paths must contain no leading slash
2949
- Paths must end with no file extension
3050

31-
### Examples:
51+
#### Examples:
3252

3353
To import `helperFunction` from the file `helpers.ts` located in the directory `src/lib/`:
3454

@@ -48,6 +68,6 @@ To import `someFunction` from the file `main.ts` located in the `src/` directory
4868
import { someFunction } from "main";
4969
```
5070

51-
## Debugging
71+
### Debugging
5272

5373
For debugging bitburner on Steam you will need to enable a remote debugging port. This can be done by rightclicking bitburner in your Steam library and selecting properties. There you need to add `--remote-debugging-port=9222` [Thanks @DarkMio]

guide_for_dummies.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Step by step guide to setting up the Typescript template from scratch
2+
This guide is mostly focused on Windows users (Mac instructions are given at some places).
3+
If you're a Linux/Mac/Other user, there's an expectancy that you know your system and it's peculiarities compared to Windows.
4+
If you need help with your particular system, feel free to ask for help in the Official Bitburner Discord.
5+
6+
### 1. Backup your savegame (just in case)
7+
- Augmentations -> Backup save
8+
9+
### 2. Install Node.js
10+
- Go to https://nodejs.org/en/
11+
- Download the version that's recommended for most users.
12+
- Install it. Just click next, next, next, next, finish.
13+
14+
### 3. Download this:
15+
- Go to https://github.com/bitburner-official/typescript-template
16+
- Click the green 'Code' button
17+
- If you're unfamiliar with Git and have no intention to use it:
18+
- Press the Download Zip button
19+
- Extract the zip anywhere, for example `C:\Users\yourusername\Workspace\BitburnerScripts` on Windows or `~/Workspace/BitburnerScripts` on Other
20+
21+
### 4. Start the Remote File API server
22+
- Open command prompt / terminal
23+
- Windows: Open start menu and type `cmd` (enter)
24+
- Mac: Click the Launchpad icon in the Dock, type `Terminal` in the search field, then click Terminal.
25+
- To go to the directory you just created:
26+
- Windows: Type `cd ` and drag the folder you created to the cmd window, or type `cd C:\Users\yourusername\Workspace\BitburnerScripts` or whatever folder you chose previously.
27+
- Mac: Type `cd ` drag the folder you created to the terminal window, or type `cd ~/Workspace/BitburnerScripts` or whatever folder you chose previously.
28+
29+
- type `npm install`
30+
- type `npm run watch`
31+
- If NPM asks if you want to install something it needs, answer `y` for yes.
32+
- Your firewall may yell at you; allow the connection.
33+
34+
### 5. Go back to Bitburner.
35+
- Options -> Remote API -> type in the port: `12525` -> click connect. The icon should turn green and say it's online.
36+
- Your firewall may yell at you again; allow the connection.
37+
38+
### 6. Starting the Typescript transpiler
39+
- DON'T SKIP EVEN WHEN USING JS ONLY
40+
- Open another cmd/terminal window just like you did in step 4.
41+
- This time run the command `npm run transpile` in your folder.
42+
Yes, you need them both to be running at the same time.
43+
- Put your .ts files to the `src\` directory.
44+
45+
### 7. Test that the connection works
46+
- You should see a file `template.js` in the root of your `home` server in Bitburner.
47+
- You should see a NetscriptDefinitions.d.ts automatically appear in the folder on your computer (ex. `C:\Users\yourusername\Workspace\BitburnerScripts\NetscriptDefinitions.d.ts`).
48+
49+
### 8. Try some other files too!
50+
- Copy/create a .js to the `src` folder on your computer and check Bitburner. The file should be transferred!
51+
- Sadly, at the time of writing, Typescript doesn't support 'compiling' text files. So copy/create a .txt in the `dist` folder and check Bitburner. This file should be transferred as well.
52+
53+
54+
### 9. Thats it!
55+
- You can now make and edit the files in the `src` directory to your liking, and have them be changed in Bitburner automatically.
56+
<br />
57+
<br />
58+
59+
### For more information
60+
Read the readme of this https://github.com/bitburner-official/typescript-template and feel free to ask in Bitburner Discord channel `#external-editors:` https://discord.com/channels/415207508303544321/923428435618058311

0 commit comments

Comments
 (0)