You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allows you to decode _A Township Tale_'s save strings for analysing, and encode JS objects into ATT save strings for spawning.
6
6
7
-
## ⚡️ Quick Start
7
+
⚠️ Use this library primarily when creating bots for ATT, or when building your own ATT save string project. **If you just want to make string weapons, check out my [ATT String Workshop](https://github.com/mdingena/att-string-workshop) project.**
8
+
9
+
## Installation
8
10
9
11
Add this library to your project's dependencies:
10
12
11
13
```shell
12
14
npm install --save att-string-transcoder
13
15
```
14
16
15
-
Next, create an `encode.js` file in your project and add the following code:
Finally, execute this code by running this command in your terminal (while in your project's directory):
26
-
27
-
```shell
28
-
node encode.js
29
-
```
30
-
31
-
The string should appear in the terminal for you to copy and paste.
32
-
33
-
### User-friendly guide to `createPrefab`
34
-
35
-
Starting with the very basics, you can create a string for a handle using this code:
36
-
37
-
```
38
-
createPrefab(PrefabHash.Handle_Short).print();
39
-
```
40
-
41
-
Running this code will print the string you can use to spawn a weapon handle.
42
-
You'll include this string in a spawn command that looks like this:
43
-
44
-
```css
45
-
spawn string EthynWyrmbane [string]
46
-
```
47
-
48
-
But so far, this is just a really complicated way of spawning a handle. The point of strings is that you can spawn intricate contraptions that regular spawn commands can't.
That's getting kinda long, so we can write it across multiple lines to keep things readible:
57
-
58
-
```
59
-
createPrefab(PrefabHash.Handle_Short)
60
-
.setMaterial(PhysicalMaterialPartHash.Redwood)
61
-
.print();
62
-
```
63
-
64
-
Now let's add a guard to this handle (the green lines show what's new since last example):
65
-
66
-
```diff
67
-
createPrefab(PrefabHash.Handle_Short)
68
-
.setMaterial(PhysicalMaterialPartHash.Redwood)
69
-
+ .useSlot(
70
-
+ PrefabSlot.Handle_Short.Slot_Multi_1,
71
-
+ createPrefab(PrefabHash.Guard)
72
-
+ )
73
-
.print();
74
-
```
75
-
76
-
So, what's happening here? We're telling the program to use one of the handle's slots, and we insert another prefab into that. The program needs to know _which_ slot to use, since prefabs like this handle have more than one slot you can use.
77
-
78
-
The inserted prefab works the same way as the handle prefab we've been making so far. Let's change the guard's material as well:
There are also some other interesting things we can do with prefabs:
110
-
111
-
- Changing the integrity (repairing or damaging it).
112
-
- Giving the prefab a velocity to hurl it through the air (works on non-slotted prefabs only).
113
-
- Changing its position and orientation (works on non-slotted prefabs only).
114
-
- Making it "noclip" (kinematic).
115
-
- Setting it on fire.
116
-
117
-
In the end, the game server decides what is possible. For example, some prefabs simply don't have a material, such as the iron handles. But it's fun to experiment and trying to figure out all the crazy things you _can_ do.
You can also use the `createPrefab` helper function of this library. See the [ATT String Workshop](https://github.com/mdingena/att-string-workshop) project for documentation about this.
0 commit comments