Opened 11 years ago

Closed 5 years ago

#437 closed bug (fixed (in master))

Inscriptions shouldn't ignore roguelike keyset option

Reported by: roustk@… Owned by: takkaria
Milestone: 3.5.0 Keywords: inscriptions keyset InputRework

Description (last modified by fizzix)

To number rods, you always have to inscribe them with @z1, even though the
roguelike keyset uses 'a' for rods. Similarly, arrows need to be @f1 when
shooting uses 't'.

It would be keen if inscriptions could be interpreted per the roguelike setting.

The relevant code (in 3.0.9) appears to be get_tag() in object1.c, which tests
the first character after '@' against p_ptr->command_cmd.


Change History (10)

comment:1 Changed 11 years ago by roustk@…

This is harder to do than might be obvious, because roguelike is really a keymap.

One possibility is to change at about line 2733 of object1.c (3.0.9):

                        /* Check the special tags */
                        if ((s[1] == p_ptr->command_cmd) && (s[2] == tag))

Instead, check whether we are in roguelike mode and then run s[1] through the
keymap interpreter like:

                        /* Check roguelike mode */
                        if (rogue_like_commands)
                          /* Force user to use roguelike tags (rods are 'a' not 'z') */
                          /* Pass the tag through the keymap interpreter */
                          cptr act;
                          act = keymap_act[KEYMAP_MODE_ROGUE][(byte)(s[1])];
                          if(act) s[1] = act[0];

                        /* Check the special tags */
                        if ((s[1] == p_ptr->command_cmd) && (s[2] == tag))

We also would need to handle '!' and '^' inscriptions, which are elsewhere in the code.

A problem with this, however, is that commands like destroy (^d) may break the
gui. What would happen if I put a control-d (ascii 04) in an inscription instead of "!k"?
Would input, display, parsing, save, load, dump, or several other things break?


comment:2 Changed 11 years ago by roustk@…

Different suggestion: there is currently an escape '\' to override the keymap interpreter
and take the next keypress raw. Maybe create something similar in inscriptions.

For example, if '`' (backquote) were chosen as the make-it-roguelike escape,
one could inscribe a rod as either @z1 or @`a1 and have it work as expected
(use by pressing a1 in roguelike or z1 in standard).

This would complicate the code slightly, but not much more than my previous proposal.
After the /* Check the special tags */ section at about 2733 in object1.c (3.0.9) add:

                        /* Check roguelike mode */
                        if (s[1] == '`')
                          /* Use roguelike mode (rods are 'a' not 'z') */
                          /* Pass the inscription through the keymap interpreter */
                          cptr act;
                          act = keymap_act[KEYMAP_MODE_ROGUE][(byte)(s[2])];
                            if ((act[0] == p_ptr->command_cmd) && (s[3] == tag))
                                /* Save the actual inventory ID */
                                *cp = i;

                                /* Success */
                                return (TRUE);

Similar changes are required at the '!' and '^' cases buried throughout the code.
Maybe things need to be (or have been) redone to centralize inscription parsing.
Once I get my new machine I'll try to get svn up and running so I can grep the
current code (as I'd also like to get "!*!*" working again).


comment:3 Changed 10 years ago by magnate

  • Keywords inscriptions keyset added

comment:4 Changed 8 years ago by takkaria

  • Keywords InputRework added
  • Milestone changed from Future to 3.3.0
  • Owner set to takkaria
  • Status changed from new to assigned

comment:5 Changed 8 years ago by magnate

  • Milestone changed from 3.3.0 to 3.4.0

Postponing to 3.4 per IRC

comment:6 Changed 7 years ago by fizzix

  • Description modified (diff)
  • Milestone changed from 3.4.0 to 3.5.0


comment:7 Changed 7 years ago by takkaria

This should be significantly easier now - roguelike and standard keysets are on par. The only issue is parsing. I've posted on the forums about this ( to get an idea of how much other roguelike keyset users want this.

comment:8 Changed 6 years ago by takkaria

This looks easier than I thought. The only UI problem is how to handle control characters, but !^d should be adequate for that.

comment:9 Changed 6 years ago by takkaria

  • Type changed from change to bug

comment:10 Changed 5 years ago by takkaria

  • Resolution set to fixed (in master)
  • Status changed from assigned to closed

Fixed provisionally in 2c5b80fb08e6396cef38250c96b3141ccbee7374.

Note: See TracTickets for help on using tickets.