Macroes

Tangaria is real-time game (till you will be hurt by monsters – then time slowes) and the adventurer will often find himself in situations where he won’t have time to enter all the commands manually. So if you want to survive in Tangaria, you will have to learn how to create macroses. A macros is a programmed key on your keyboard which map a single keypress to a series of keypresses. For example you might map the key F1 to “maa” (the keypresses to cast “Magic Missile” as a spellcaster). This can speed up access to commonly-used features.

You can program any ley to do whatever keypresses you want, in any order you want. Most people use the function keys (F1-F12) for the macroses because none of them are used for game commands. 

Except special keymapping (Keymap by command, item or spell) there is also oldschool way to macro different action. Lets first create an example macro – to macro Cure Light Wounds potion at F1 key:

  • inscribe { potion as @q1
  • press =e to enter macro mode (you’ll see the menu)
  • press d to create new macro
  • press a key on which bind to macro: F1
  • input the action: q1 (it will become [Escape]q1)
  • press - when finished
  • press y to save the key
  • press b (‘save keymaps to file’)
  • Now, press Esc to get out of the menu and back in the game.
  • press F1, and you will drink Cure Light Wounds potion.

But why there is [Escape] part? The command also could look like \eand it’s the same as Esc key. So if you were doing something else, like eating, quaffing, or gaining spells, and
something bad happens, you want the macro to work at once! Also, it’s useful when you don’t want to press Esc on numerous occations, like when firing rapid stinking cloud or something. Time is precious in Tangaria. 

You could put \e’s in the back too, but not overdo it. The more \e’s you have, the more lag you will get. So if you had the first four spells in the first book, the macro-actions
would be like this:

Remember to macro all your items and spells (if you play caster). You can use ctrl+F1-F12 too, not only simple F’s.

As you saved your macros to the default file, it will be autoloaded every time you start the client; otherwise you should load the file manually.

Keymaps have two parts: the trigger key and the action. These are written where possible just as ordinary characters. However, if modifier keys (shift, control, etc.) are used then they are encoded as special characters within curly braces {}.

As you probably know, throwing flasks of oil at monsters hurt them. If you
are a mage, inscribe your flasks @v1, and set the action [ESCAPE]v1*t.

  • Here’s how to shoot with your bow:
  • Macro your arrows @f1
  • Set action as [ESCAPE]ef1*t

The *t is for targetting. Happy shooting 🙂

So back to theory: when 

Possible modifiers are:

K = Keypad (for numbers)
M = Meta (Cmd-key on OS X, alt on most other platforms)
^ = Ctrl
S = Shift
If the only modifier is the control key, the curly braces {} aren’t included. For example:

{^S}& = Ctrl + Shift + &
^D = Ctrl + D
Special keys, like F1, F2, or Tab, are all written within square brackets []. For example:

^[F1] = Ctrl + F1
{^S}[Tab] = Ctrl + Shift + Tab
Special keys include [Escape].

The game will run keymaps in whatever keyset you use (original or roguelike). So if you write keymaps for roguelike keys and switch to original keys, they may not work as you expect! Keymap actions aren’t recursive either, so if you had a keymap whose trigger was F1, including F1 inside the action wouldn’t run the keymap action again.

Keymaps are written in pref files as:

A:<action>
C:<type>:<trigger>
The action must always come first, <type> means ‘keyset type’, which is either 0 for the original keyset or 1 for the roguelike keyset. For example:

A:maa
C:0:[F1]
Tangaria uses a few built-in keymaps. These are for the movement keys (they are mapped to ; plus the number, e.g. 5 -> ;5), amongst others. You can see the full list in pref.prf but they shouldn’t impact on you in any way.

To avoid triggering a keymap for a given key, you can type the backslash \ command before pressing that key.

Examples of macroses

An alternative oldschool way to create macro to cast a Magic Missile at closest monster. Inscribe (by pressing {) your magic book, “Magic for beginners” with @m1. This should set your book as a number 1. The m in front is for security purposes, so you can only cast spells with that number.

  • press =e to go to the macro-screen.
  • d to create new macro
  • F5 on your keyboard.
  • enter a new action. Set the action as m1a*t
  • - when finished.
  • y to save the key
  • b (‘save keymaps to file’)
  • Esc to get out of the menu and back in the game.
  • press F5, and you will cast cast “Magic missile” (m1a) and will target it to closest mosnter (*t).

More examples:

Example 1: You’re a Mage. Gain the spell Detect Creatures. Hit G then 1 then b. Inscribe { your Beginners magic book with @m1. This gives your book a specific number instead of just a position in your inventory. Positions may change as you drop items or if an item is destroyed so if you don’t give your book a number the keymap might not find the right book. This is VERY important.

Press =e to go to the keymap screen. Press d) Create a keymap. Press F1 on your keyboard. Set the action as [Escape]m1b then hit -. Press y to save the keymap. You have now programmed the F1 key to execute the Detect Creature spell.

Now, hit Esc to get out of the keymap menu. If you now try hitting F1 you will cast the Detect Creature spell. But why we used the [Escape] part in [Escape]m1b? The [Escape] is the same as Esc key. So if you were doing something else, like eating, quaffing, or gaining spells, and something bad happens, you want the keymap to work.

Example 2: You’re a Warrior. Inscribe your potion of Berserk Strength with @q1. Go to the keymap menu =e and choose option d) Create a keymap. Press the key where you want this keymap, F2 for example. Set the action as [Escape]q1 (see above). Then hit Esc, and you’re in the game again.

When you now press F2 it will quaff your potion of Berserk Strength.

Example 3: You want to use a bow. Inscribe your arrows @f1. Set action as [Escape]f1' to target the closest monster, or even use the h command to fire the default ammo in your quiver at the closest monster.

Remeber to save your macroses =eb; otherway when you will quite the game and start it again – you will need to map macroses again, which is quite annoying. Better to save macroses after change.

Examples from Jir

Action             Macro   Inscription corresponding
-----------------  ----------------  -----------------
read a scroll      \er1    @r1 (phase door, teleport, etc)
phase door(magic)  \em1c   @m1 ("Magic for Beginners")
quaff a potion     \eq1    @q1 (!crit, !healing etc.)
magic missile      \em1a' @m1 ("Magic for Beginners")
fire a missile     \ef1'  @f1 (arrows, bolts, shot, etc)

' in macro means to target closest enemy. 'magic missile' and 'fire a missile' macro will target and shoot automatically;) teleport(staff) \eu1 @u1 (staff of teleportation) satisfy hunger \em3a @m3 ("Incantations" book) detection \ep6b @p6 ("Godly Insight") auto-pickup on \e=1\s\s\s\s\sy\e\e auto-pickup off \e=1\s\s\s\s\sn\e\e load a macro file \e%1foo.prf\n\e [foo.prf can be the filename you want] machine gun \et1*tt1*tt1*tt1*tt1*t [work well with pern archers] An example of continuous actions macro: quaff & PhaseDoor \eq1r1 @r1,@q1

If you save macros to files with some special names, the macros will be autoloaded only in corresponding situation.

–file name— — autoloaded when playing ———
druid.prf              druid class
Jir.prf                   character named ‘Jir’

Test the macroes in town or maybe at 50ft — or wrong macro may kill you one day.

 

Special Keys

Certain special keys may be intercepted by the operating system or the host machine, causing unexpected results. In general, these special keys are control keys, and often, you can disable their special effects.

It is often possible to specify “control-keys” without actually pressing the control key, by typing a caret ^ followed by the key. This is useful for specifying control-key commands which might be caught by the operating system as explained above.

Pressing backslash \ before a command will bypass all keymaps, and the next keypress will be interpreted as an “underlying command” key, unless it is a caret ^, in which case the keypress after that will be turned into a control-key and interpreted as a command in the underlying Angband keyset. The backslash key is useful for creating actions which are
not affected by any keymap definitions that may be in force, for example, the sequence \ + . + 6 will always mean “run east”, even if the . key has been mapped to a different underlying command.

The 0 and ^ and \ keys all have special meaning when entered at the command prompt, and there is no “useful” way to specify any of them as an “underlying command”, which is okay, since they would have no effect.

For many input requests or queries, the special character ESCAPE will abort the command. The ‘[y/n]’ prompts may be answered with y or n, or Esc.


If you saved macros when they were messed up and now you can’t do something – just delete your macro-file pref.prf


Maybe outdated:

The following strings in macro are handled as escape sequences:

\e escape Cancels the action.
It’s automatically inserted as [ESCAPE] in the beginning of new macroes.

\s space
space characters in macro is shown as \s

\n line feed
means Enter key. This will enable some complicated macros

Keys frequently used as trigger:
Meta(Alt), Ctrl, Function keys and other non-used keys(like ‘/’,’^’ etc).

To report typo, error or make suggestion: select text and press Ctrl+Enter.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.