From 867733213d6deb0f262448e7489d2bdc3afddfc6 Mon Sep 17 00:00:00 2001 From: jckirton <66995801+jckirton@users.noreply.github.com> Date: Sat, 5 Jul 2025 17:40:23 +0930 Subject: [PATCH 1/4] Added section to macros guide describing symlinks. Wording? --- docs/guides/new_players/macros.mdx | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/docs/guides/new_players/macros.mdx b/docs/guides/new_players/macros.mdx index 074a75d5..65df3daf 100644 --- a/docs/guides/new_players/macros.mdx +++ b/docs/guides/new_players/macros.mdx @@ -48,3 +48,44 @@ To delete an existing macro, type `/macro =` with nothing after the `=`. >>/bal = Macro deleted. ``` + +### Macros and symlinks + +Macro files (`username.macros`) can also be symlinks to another file and still work, assuming the file contents are valid. + +This can be used for: + +- Having macros backed up somewhere other than the game folder +- Having macros synced across many users +- Showing off just how nerdy you are + +#### What's a macro file? + +Macros in hackmud are stored in a file, which is located in the same place as `shell.txt`. + +> Try using running ((%C#dir%)) and going two folders up. Or navigating to: +> > Windows - `C:\Users\USERNAME\AppData\Roaming\hackmud`\ +> > macOS - `~/.config/hackmud`\ +> > Linux - Either `~/.config/hackmud` or the game folder. + +The naming scheme is `username.macros`, and are plain text files. + +#### How symlink? + +((%D:::This is written by a mac user, so I have no idea if the below is true for Windows:::%)) + +To make a symlink, we're going to use the `ln` command. + +***PLEASE BACKUP YOUR MACROS FILES AND CHECK `man ln`, THE USAGE MAY DIFFER FOR YOU*** + +We want to run `ln` with the `-sfn` 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. + +For example, my ln usage and command looked like this: + +``` +USAGE: +ln [options] source_file target_file + +COMMAND: +ln -sfn ~/Developer/hackmud/southr6/workshop/macros.txt ~/.config/hackmud/southr6.macros +``` From fbc72d556eba1f649c2839f3a3531f68231673fa Mon Sep 17 00:00:00 2001 From: jckirton <66995801+jckirton@users.noreply.github.com> Date: Sun, 6 Jul 2025 08:12:35 +0930 Subject: [PATCH 2/4] Applied sean's patch. --- docs/guides/new_players/macros.mdx | 41 ++++++++++++++++++------------ 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/docs/guides/new_players/macros.mdx b/docs/guides/new_players/macros.mdx index 65df3daf..74308431 100644 --- a/docs/guides/new_players/macros.mdx +++ b/docs/guides/new_players/macros.mdx @@ -49,38 +49,47 @@ To delete an existing macro, type `/macro =` with nothing after the `=`. Macro deleted. ``` -### Macros and symlinks +## Macro storage on disk -Macro files (`username.macros`) can also be symlinks to another file and still work, assuming the file contents are valid. +### What's a macro file? -This can be used for: +Macros in hackmud are stored in a file per user, which is located in the same place as `shell.txt`. -- Having macros backed up somewhere other than the game folder -- Having macros synced across many users -- Showing off just how nerdy you are - -#### What's a macro file? - -Macros in hackmud are stored in a file, which is located in the same place as `shell.txt`. - -> Try using running ((%C#dir%)) and going two folders up. Or navigating to: +> Run ((%C#dir%)) and go two folders up. Or navigate to: +> > > Windows - `C:\Users\USERNAME\AppData\Roaming\hackmud`\ > > macOS - `~/.config/hackmud`\ > > Linux - Either `~/.config/hackmud` or the game folder. The naming scheme is `username.macros`, and are plain text files. -#### How symlink? +### Workaround: Sharing macros between users + +Because macros are scoped to users by default, when you switch to another user, you can't use the first user's macros. + +One of the ways you can solve this is with the concept of a symlink: https://en.wikipedia.org/wiki/Symbolic_link -((%D:::This is written by a mac user, so I have no idea if the below is true for Windows:::%)) +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. + +#### How to set up a symlink on Windows + +TODO THIS PR + +#### How to set up a symlink on macOS & linux To make a symlink, we're going to use the `ln` command. -***PLEASE BACKUP YOUR MACROS FILES AND CHECK `man ln`, THE USAGE MAY DIFFER FOR YOU*** +:::warning +When mucking with files always back them up before accidentally doing destructive actions. +::: + +:::note +Syntax may differ depending on your OS, check `man ln` for usage differences. +::: We want to run `ln` with the `-sfn` 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. -For example, my ln usage and command looked like this: +For example on macOS, my ln usage and command looked like this: ``` USAGE: From 8b43df3460e1e436596e074a1f819d90bc508c8f Mon Sep 17 00:00:00 2001 From: Sean Mann Date: Sat, 5 Jul 2025 17:35:43 -0700 Subject: [PATCH 3/4] Windows instructions --- docs/guides/new_players/macros.mdx | 31 ++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/docs/guides/new_players/macros.mdx b/docs/guides/new_players/macros.mdx index 74308431..46398e55 100644 --- a/docs/guides/new_players/macros.mdx +++ b/docs/guides/new_players/macros.mdx @@ -71,20 +71,35 @@ One of the ways you can solve this is with the concept of a symlink: https://en. 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. +:::warning +When mucking with files always back them up before accidentally doing destructive actions. +::: + #### How to set up a symlink on Windows -TODO THIS PR +Windows 10 and later have access to `mklink`: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mklink -#### How to set up a symlink on macOS & linux +Here's an example of mapping / copying macros from user_a's macros to user_b's macros. -To make a symlink, we're going to use the `ln` command. - -:::warning -When mucking with files always back them up before accidentally doing destructive actions. +:::note +Running mklink requires a windows command prompt which has been started with administrator permissions. ::: +``` +USAGE: +mklink abs_path_to_new_link_file file_path_to_link_to + +COMMAND: +mklink "C:\Users\southr6\AppData\Roaming\hackmud\user_b.macros" "C:\Users\southr6\AppData\Roaming\hackmud\user_a.macros" +``` + +#### How to set up a symlink on macOS & linux + +To make a symlink these unix-based platforms, we're going to use the `ln` command. + :::note -Syntax may differ depending on your OS, check `man ln` for usage differences. +Syntax may differ depending on your OS, check `man ln` for usage differences. +Also note, the parameters are in different orders in windows and unix. ::: We want to run `ln` with the `-sfn` 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. @@ -93,7 +108,7 @@ For example on macOS, my ln usage and command looked like this: ``` USAGE: -ln [options] source_file target_file +ln [options] source_file new_link_file COMMAND: ln -sfn ~/Developer/hackmud/southr6/workshop/macros.txt ~/.config/hackmud/southr6.macros From 8d5a6b18677a8319827cf98e5cda6eeeb5d63b13 Mon Sep 17 00:00:00 2001 From: Sean Mann Date: Sat, 5 Jul 2025 17:37:05 -0700 Subject: [PATCH 4/4] rm -fn --- docs/guides/new_players/macros.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/new_players/macros.mdx b/docs/guides/new_players/macros.mdx index 46398e55..efcd17e3 100644 --- a/docs/guides/new_players/macros.mdx +++ b/docs/guides/new_players/macros.mdx @@ -102,7 +102,7 @@ Syntax may differ depending on your OS, check `man ln` for usage differences. Also note, the parameters are in different orders in windows and unix. ::: -We want to run `ln` with the `-sfn` 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. +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. For example on macOS, my ln usage and command looked like this: @@ -111,5 +111,5 @@ USAGE: ln [options] source_file new_link_file COMMAND: -ln -sfn ~/Developer/hackmud/southr6/workshop/macros.txt ~/.config/hackmud/southr6.macros +ln -s ~/Developer/hackmud/southr6/workshop/macros.txt ~/.config/hackmud/southr6.macros ```