@@#link; <<link 'Pick up the gun.'>> <<if $playerInventory.has('a gun')>> <<replace '#links'>>You already have a gun, you don't need another...<</replace>> <<else>> <<pickup '$playerInventory' 'a gun'>> <<replace '#links'>>You take the gun and hide it in your coat.<</replace>> <</if>> <</link>> @@
it should be <<replace '#link'>> in the usage example, otherwise it will output an error due to it not finding #links.
Originally reported by @VirtualGhost
I don't know if it's the right place to report it, but here you go. On your macro's description here https://github.com/ChapelR/custom-macros-for-sugarcube-2/blob/master/docs/simple-inventory.md
@@#link; <<link 'Pick up the gun.'>> <<if $playerInventory.has('a gun')>> <<replace '#links'>>You already have a gun, you don't need another...<</replace>> <<else>> <<pickup '$playerInventory' 'a gun'>> <<replace '#links'>>You take the gun and hide it in your coat.<</replace>> <</if>> <</link>> @@
it should be <<replace '#link'>> in the usage example, otherwise it will output an error due to it not finding #links.