Angband Forums (http://angband.oook.cz/forum/index.php)
-   Vanilla (http://angband.oook.cz/forum/forumdisplay.php?f=3)
-   -   keybind multiple actions? (http://angband.oook.cz/forum/showthread.php?t=10058)

 Sky May 16, 2020 23:49

keybind multiple actions?

is there a way to bind a single key to perform multiple actions?
For example, let's say i want to bind F1 to cast Heroism and then to cast Berserker.

I have tried pgapgb (pga = cast hero, pgb = cast berserker), pga [enter] pgb, but neither works.
ideally a solution that doesnt involve waiting a turn in between.

 Sky May 17, 2020 08:25

hmm.. many views, few replies.

 Sideways May 17, 2020 12:38

Solutions like "pgapgb" actually do work, but only in specific situations. The problem is that many types of feedback from the game - like those from timed effects kicking in - stop all active keymaps from continuing, so if the Heroism works the keymap stops there, and if you fail to cast Heroism that also stops the keymap. I don't think there's any way around that.

Even when you do successfully take two actions through one keypress, it will still always consume two turns - casting a spell consumes 100 energy, aka "1 turn", there is and should be no way around that.

 Sky May 17, 2020 14:54

im not trying to do two actions in 1 turn, but, seeing as the rest function allows for time to pass, i thought that 'cast A - rest - cast B' might work, however that takes 3 turns for 2 spells - that's what i mean by 'losing a turn'.

 fph May 17, 2020 15:55

Multi-turn keymaps used to be available in the game (they were called macros IIRC), but they have been phased out.

I don't miss them much; keymaps seem sufficient for 99% of the purposes. Multi-turn keymaps have hard-to-define behavior if the first command fails, and forgetting that they take two turns might easily get you killed.

 wobbly May 17, 2020 16:06

Macros are great. You get some unexpected prompt or spell failure & suddenly all the keypresses are 1 key out of sequence & you're randomly removing your armour and banishing all molds from the level.

 Sideways May 17, 2020 16:28

Macros had the same problem anyway - flush() would stop them too. At least in 2.9.3, I don't see any difference between when a 2-prayer macro stops and when a 2-prayer keymap stops. Early Angband did have greater support for multi-turn mapping, but that was implemented through options that regulated when flush() would be called, and so affected macros and keymaps equally. (Macros might have been better for really weird mapping that actually temporarily changed those options... not sure.)

 Sky May 17, 2020 18:02

Quote:
 Originally Posted by wobbly (Post 145560) macros are great. You get some unexpected prompt or spell failure & suddenly all the keypresses are 1 key out of sequence & you're randomly removing your armour and banishing all molds from the level.
waahahahaha

 Pete Mack June 11, 2020 16:43

Yes, multi-turn keymaps work, but you need to clear --more-- prompts between them as part of the command.
1. Inscribe your books so that you can cast by number rather than inventory position. EG: using a very old set of spells (v3.2), the following will detect doors, stairs, and traps, map the area, and reveal all monsters, using 3 turns.
Code:

a)  Magic for Beginners. {@m1} b)  Incantations and Illusions {@m3} ... k) 5 Rods of Mapping {@z2;!!}
2. Make the keymap bind to the number, escaping away all messages
Code:

m1g\e\e\ez2\em3g
Note that if your fail rate is nonzero you may have to cast one or more of the spells again. Note further that reveal monsters spell must be last, or its results will be overridden before you see them.

 All times are GMT +1. The time now is 13:38.