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
Copy file name to clipboardExpand all lines: docs/guides/new_players/macros.mdx
+65Lines changed: 65 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,3 +48,68 @@ To delete an existing macro, type `/macro =` with nothing after the `=`.
48
48
>>/bal =
49
49
Macro deleted.
50
50
```
51
+
52
+
## Macro storage on disk
53
+
54
+
### What's a macro file?
55
+
56
+
Macros in hackmud are stored in a file per user, which is located in the same place as `shell.txt`.
57
+
58
+
> Run ((%C#dir%)) and go two folders up. Or navigate to:
59
+
>
60
+
> > Windows - `C:\Users\USERNAME\AppData\Roaming\hackmud`\
61
+
> > macOS - `~/.config/hackmud`\
62
+
> > Linux - Either `~/.config/hackmud` or the game folder.
63
+
64
+
The naming scheme is `username.macros`, and are plain text files.
65
+
66
+
### Workaround: Sharing macros between users
67
+
68
+
Because macros are scoped to users by default, when you switch to another user, you can't use the first user's macros.
69
+
70
+
One of the ways you can solve this is with the concept of a symlink: https://en.wikipedia.org/wiki/Symbolic_link
71
+
72
+
By adding a symlink to a source file for macros, each user would be editing and reading from the same file, allowing macros to be shared between users.
73
+
74
+
:::warning
75
+
When mucking with files always back them up before accidentally doing destructive actions.
76
+
:::
77
+
78
+
#### How to set up a symlink on Windows
79
+
80
+
Windows 10 and later have access to `mklink`: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mklink
81
+
82
+
Here's an example of mapping / copying macros from user_a's macros to user_b's macros.
83
+
84
+
:::note
85
+
Running mklink requires a windows command prompt which has been started with administrator permissions.
To make a symlink these unix-based platforms, we're going to use the `ln` command.
99
+
100
+
:::note
101
+
Syntax may differ depending on your OS, check `man ln` for usage differences.
102
+
Also note, the parameters are in different orders in windows and unix.
103
+
:::
104
+
105
+
We want to run `ln` with the `-s` options, with the source file being the path to the file containing the macros, and the target file being the path to the `username.macros` in the previously mentioned directory.
106
+
107
+
For example on macOS, my ln usage and command looked like this:
0 commit comments