## Creating Macros - Step by step

Official MAngband News Annoucements
serina
Crystal Ooze
Posts: 373
Joined: Sat 15.09.2007, 18:42

### Creating Macros - Step by step

This guide is setup into 5 categories:
2)) General information about specific macro commands.
3)) General macros used by all characters.
5)) macros used by mages/rangers/rogues.

To inscribe items, you press the { key and select the item you wish to inscribe. If you inscribe an item with @q1 for instance, this enables the game to recognize the item as quaffable and enables you to quaff them by pressing q1. This will also enabling macroing the item to be used REALLY quickly by pressing a single button. OBS! If the item isn't a quaffable (non-potion), you will get a warning sound and the command will fail.

The macro menu is accessed by pressing % in the game. It looks like this:
-----------
Interact with Macros

(2) Save Macros
(3) Enter a New Action
(4) Create a command macro
(5) Create a normal macro
(6) Create an identity macro
(7) Create an empty macro
------------

You then press the number key corresponding to what you want to do.

If this is your first time playing, do the following before messing up the whole MAngband control system:

- Press 2
- Type: Default.prf
- Press enter

This means that if you screw up and overwrite the standard file, you can regain the original setup easily like this:

- Press 1
- Type: Default.prf
- Press enter

Do the following to create a quaff potion macro:

- Press 3
- enter this: \eq1 and press enter
- Press 4
- Press the key you want to use to quaff potions. This should be a key that the game doesn't use, so for example using F1 would be a good idea.

You first macro is done and your character should quaff your potions labelled @q1 in your inventory when you press F1 (or another key if you chose another).

PS. If you messed up the macroes, load the default.prf and try again. Also if you later have made 10 great macroes and then mess up one by overwriting a useful key, try menu pick 6 "Create an identity Macro" then press the key that is messed up. This should revert the key to it's original state.

PPS. You will want to keep the keys for your main ranged attack macro close to your main escape macro and main healing macro. For instance having main attack as F1 and main escapes as F11 or F12 wouldn’t be a good idea. (I learned to play before I figured this out, so I’ve gotten used to my macros being far apart though it’s a hassle at times)

2)) General information about specific macro commands.
This section is a few “advanced” commands used in macroing that aren’t obvious and explains their usage.

f This is the general command to fire missiles. f1 means firing the missiles inscribed with @f1. f2 means firing the missiles inscribed with @f2 etc. (Make sure you fire the correct ammo and that your weapon isn’t too heavy for you to use. All missile weapons are wieldable, but some are too heavy for certain characters to fire with. They can equip, but cannot fire.) (gnome mage with a heavy crossbow is a no go until you get WAY more STR)

q This is the general quaff command to quaff potions. q1 means quaffing potions inscribed with @q1. q2 means quaffing potions inscribed with @q2. q3… You got the point ;)

r This is the general read command to read scrolls. r1 means reading scrolls inscribed with @r1. r2 means reading scrolls inscribed with @r2. etc.

u This is the general read command to use a staff. u1 means using staves inscribed with @u1. etc.

a This is the general read command to aim a wand. a1 means using wands inscribed with @a1. etc.

z This is the general read command to zap a rod. z1 means using rods inscribed with @z1. etc.

p This is the general read command to pray from priest books (paladin/priest). p1 means praying from the book inscribed with @p1. p2 means praying from the book inscribed with @p2 etc.

mThis is the general read command to use magic from magic books (mage/ranger/rogue). m1 means casting spell from the book inscribed with @m1. m2 means praying from the book inscribed with @m2

w This is the general wear/wield weapon command. w1 means wielding the piece of gear inscribed with @w1 (this way you can swap gear by inscribing 2 weapons with @w1 for instance.) (There’s also a command to swap. If you inscribe 2 items with @w0, pressing X will swap them between equipped/inventory

*t Having this in a macro will target what you’re doing at the closest enemy. This needs to be done at the correct time in the macro. Spells need pre-targeting, while missile weapons need post-targeting. Example: To fire a bow at the closest enemy use this: \ef1*t . To fire a magic missile at the closest enemy, use this: \e*tm1a . To fire orb of draining at the closest enemy, use this: \e*tp3b . The books and missiles need to be inscribed properly naturally.

\e This command is the same as pressing ESC on your keyboard. Putting this first in most macros is useful for making sure your character does what you want when you’re under pressure. For instance if you’re looking at your character screen “C” and suddenly get attacked, you want your quaff potion macro or teleport macro to work. Without you hitting ESC-key first. Use \e for all macros that you want to fire when you press the key. (if you wish to perform several actions in a specific sequence without skipping any parts, don’t put \e in front of them. Usage: Use for all critical staying alive macros.

( This command is used for targeting friends in a party for healing spells (paladin/priest). Casting cure light wounds on someone would be: \e(p1B note that the casting letter needs to be a Capital letter or you cast the spell on yourself.

I think this was all the useful commands I’ve used in macros. If someone else uses others, be sure to let me know and I’ll add them.

3)) General macros used by all characters.
This section helps you set up a standard for all your characters so you don’t have to do them all over and over.
Most characters need a missile weapon macro, 2+ different potions macros and 2-4 different escape macros. I will suggest keys for some macros, but others should be set up to suit your needs/playstyle.

Firing bows:
\ef1*t this macro fires 1 shot at the closest enemy. Suggested key: TAB
When I’ve got a really powerful bow, I usually want to keep firing through lag and other things even when things die. In this case I’d use the following macro:

\ef1*tf1*tf1*tf1*tf1*t repeat as many times as you want to fire. This is known as “The lazy ranger macro” or “/autofire”. OBS! This macro isn’t cancelled by pressing a direction. You need to use a macro with \e in it or running “shift” + direction to cancel it.

Quaff macros:
\eq1 Suggested for Cure Serious Wounds or Cure Critical wounds to cure blindness/confusion or cure poison (only CCW) and also for main healing early in the game or for healing out of combat later in the game. Suggested key: F1

\eq2 Suggested for potions of Healing used for combat healing “late” in the game. Suggested key: F2

\eq3 Suggested for potions of *Healing* you know when to use these if you have gotten this far

\eq7 or \eu7 Suggested for potions or staff of speed. Suggested key: F7 (the reason I use \eq7 is that you can then remember that the key is F7 by looking in inventory)

\eq5 Suggested for potions of restore mana

The list goes on and on. I’m sure you’ve got a good idea ;)

Escape macros: These change as you gain more items/escapes
\er4 Suggested for scroll of phase door the cheapest usable means of escape. Suggested key: F4

\er5 or \eu5 Suggested for scroll of teleportation or staff of teleportation. Suggested key F5

\er6 or \eu6 Suggested scroll or staff of *destruction*. Suggested key F6

These may be replaced by spells if you’re a mage or priest with close to 0% fail chance on spells.

When you’re done with all these macros, save your macros into a lot of files since these will be generic for all classes you play. Save them as warrior.prf and priest.prf and mage.prf and ranger.prf and paladin.prf and rogue.prf. When you load the client as any character, the appropriate macro-file will auto-load. So whenever you make changes you like, save into the appropriate file. (testing the macro first or backing up the file is useful before overwriting)

I usually don’t macro spells like “Detect Evil”. I just remember p1a instead because it isn’t a prayer I need to cast when in a pinch.

\ep2b Macro for Portal as an escape. Book (Words of Wisdom) inscribed with @p2 This can be used instead of a scroll of teleportation but it kind of unreliable due to failure rate and high mana cost at low levels (you’ve been warned)

\e*tp3b Macro for Orb of Draining (ranged attack). Book (Chants and Blessings) inscribed with @p3 Suggested key: F3 ( this is just in between your powerful healing potion and your escapes

\ep2c or \ep3c or \ep3h or \ep4c healing spell. Whichever you prefer.

\ep2C or \ep3C or \ep3H or \ep4C Heal other spell but you need to target them first with (

\ep(2C or \e(p3C or \e(p3H or \e(p4C Heal other spell with auto-target that cycles through your friends.

Late on you can also macro dispel evil if you wish to clear out Troll pits easily.

// Party healing will probably be changed in the future, but this is what we’ve got at the moment.

5)) macros used by mages/”rogues”/rangers.
I usually don’t macro spells like “Detect Monsters”. I just remember m1b instead because it isn’t a spell I need to cast when in a pinch.
Rogues can’t use the offensive spells, but some stuff is the same.

\em1c Phase door macro as an escape. Book (Magic for Beginners) inscribed with @m1. Helps the stingy save a few \$ and in case you run out of scrolls and it frees up inventory space for when that’s needed. You’ve been warned on the safety of “not” using scrolls, hehe.

\em2f Teleport self as an escape. Book (Conjurings and Tricks) inscribed with @m2. This can be used instead of a scroll of teleportation but it kind of unreliable due to failure rate and high mana cost at low levels (you’ve been warned)

\e*tm1a Magic missile that fires at closest target. Book (Magic for Beginners) inscribed with @m1. Nice main ranged attack till you can upgrade to the later spells and cast them A LOT.

\e*tm2b Lightning bolt that fires at the closest target. Book (Conjurings and Tricks) inscribed with @m2. It continues past enemies till it hits max range or a wall, so it’s good for enemies that are positioned in a straight line.

The rest of the offensive spells are extremely useful as well. Macro them and then swap out your main attack as needed. (Acid bolt will be main attack for quite a while in conjunction with “Rift” you have a great combo) Also there’s Mana storm naturally ;)

If it seems like your mage is running out of keys to macro, you can use Shift+F1 or CTRL+F1 or Shift+CTRL+F1 etc. That’s 48 macros just using the F-keys. Alt works too, but we all know what alt+F4 does, so I’ve avoided using alt in fear of my windows system taking over. Hehe.

Good luck.

My spelling might be off somewhere, I haven’t bothered to check. It’s taken me 2 hours writing this.

ZAL
Last edited by serina on Tue 25.08.2009, 19:46, edited 1 time in total.

Allona
Hobgoblin
Posts: 27
Joined: Fri 08.08.2008, 05:42

### Re: Making macros Step by step.

yo bud i relllay respect you for making this

it gives you the rep of a new blud on tha crip strete ive ben tryiaang to make ds makes fo like 5 years thx bud

PowerWyrm
Balrog
Posts: 1574
Joined: Sun 27.11.2005, 15:57

### Re: Making macros Step by step.

Allona
Hobgoblin
Posts: 27
Joined: Fri 08.08.2008, 05:42

### Re: Making macros Step by step.

sorry I dont speak Sand Script... :embarrased:

timtek
Giant House Fly
Posts: 12
Joined: Sun 17.05.2009, 10:24

### Re: Making macros Step by step.

This guide is awesome, I just have one question(for now at least), where can I see my macros? I know i can't see them in game but i checked the folders in my mangband directory and I didn't see anything that looked promising.

Thorbear
Posts: 131
Joined: Wed 12.01.2005, 15:00
Contact:

### Re: Making macros Step by step.

timtek wrote:This guide is awesome, I just have one question(for now at least), where can I see my macros? I know i can't see them in game but i checked the folders in my mangband directory and I didn't see anything that looked promising.
../Mangband/lib/user/
There are all the files with your personal settings, including macro files
PowerWyrm wrote:什麼，地獄您正有關？
Allona wrote:sorry I dont speak Sand Script... :embarrased:
What it says is: "What in heavens name are you trying to say?"
I am Thorbear...

ema
Greedy Little Gnome
Posts: 15
Joined: Wed 12.08.2009, 18:46
Location: Italy

### Re: Making macros Step by step.

About "General information about macro commands", where You show an example to inscribe wands: I think is @a1 and not @w1...

serina
Crystal Ooze
Posts: 373
Joined: Sat 15.09.2007, 18:42

### Re: Making macros Step by step.

Right... You're the only one who've noticed :)

Thanks. I edited in the correct @a1

ZAL

ema
Greedy Little Gnome
Posts: 15
Joined: Wed 12.08.2009, 18:46
Location: Italy

### Re: Making macros Step by step.

You're welcome...

You have made a very important work! :-)))

Ace
Crystal Ooze
Posts: 368
Joined: Fri 15.02.2008, 12:50

### Re: Making macros Step by step.

Maybe you want to add some activate (artefacts) macros? I suppose they need post-targeting but Iam never sure about this because sometimes its working and sometimes not :) but my configs are screwed up like hell anyway at the moment.

Flambard
King Vampire
Posts: 258
Joined: Wed 20.06.2007, 10:49

### Re: Making macros Step by step.

BTW, we have an editable portion of the wiki now, probably for guides just like that. Anyone remembers the link?

Thorbear
Posts: 131
Joined: Wed 12.01.2005, 15:00
Contact:

### Re: Making macros Step by step.

what wiki?
I am Thorbear...

Ace
Crystal Ooze
Posts: 368
Joined: Fri 15.02.2008, 12:50

### Re: Making macros Step by step.

Found this on my harddisk somewhere I think I wrote it a long time ago :)
and I am still unsure if the @z and @A must be pretargeted or not :) Maybe the system is just buggy, because sometimes i press the "activate" macro and it says "the rod is still charging"

Code: Select all

Syntax:
magic	@m1...9		\e*tm1...9a-z 	*t optional (depends on spell) 1..9 == book, a-z == spell
pray	 @p1...9		\e*tp1...9a-z	*t optional (depends on spell) 1..9 == book, a-z == spell
scrolls @r1...9 	\er1...9*t	*t optional (depends on spell) 1..9 == book, a-z == spell
Fire	 @f1...9		\ef1...9*t	inscribe the ammo, wield the shooting device
potions @q1...9		\eq1...9
wands	@a1...9		\ea1...9*t	*t optional (depends on spell)
rods	 @z1...9		\ez1...9*t	*t optional (depends on spell)
Artefacts @A1...9     \eA1...9*t  *t optional (depends on spell), unsure if *t to the beginning or to the end of the macro

examples:
@p3     \e(p3C   flush prev. input, nearest player, book 3, 3rd spell (capital letters!) Heal others....
@m3     \e(m3A   flush prev. input, nearest player, book 3, 1st spell (capital letters!) Heal others....

@m7     \em7a    flush prev. input, mage book 7, first spell (a)
@m1     \e*tm1a  flush prev. input, nearest target, mage book 1, first spell (a)
@r1     \er1     flush prev. input read scroll inscribed with 1
@f3     \ef3*t   flush prev. input, fire ammo with shooting device, nearest target
@q7     \eq7     flush prev. input, quaff pot 7

Flambard
King Vampire
Posts: 258
Joined: Wed 20.06.2007, 10:49

### Re: Making macros Step by step.

https://www.mangband.org/Contrib

BTW, I think it's much harder to find the guides now that they are in a separate forum sub-section. Stickies were better.

Warrior
Ancient MultiHued Dragon
Posts: 662
Joined: Sat 26.10.2002, 15:00
Location: Norway
Contact:

### Re: Making Macros - Step by step

I've made this guide a global announcement and cleared up a few typos to go!
-- Mangband Project Team Member