Binding weapons to f1, f2 etc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • petefj
    Rookie
    • Apr 2014
    • 20

    Binding weapons to f1, f2 etc

    I've read that it's possible to bind keystrokes, or weapons to specific keys such as f1 one f2 etc.

    I'm finding it very difficult to do this. For instance where do I find the code for Magic missile, or lightning strike or similar? And where do these codes need to be saved?

    And do these instructions have to be inserted into the game file each time you log in and play Angband?

    Can anyone point me to a source of info on this?

    Thank you,

    Peter
  • Pete Mack
    Prophet
    • Apr 2007
    • 6883

    #2
    Those are two separate issues. You can bind numbers and commands to items, eg @w0 on swap weapons so the command w0 will swap weapons rather than w<letter>, or @m1 to bind spellcasting from Beginners Handbook to 1, so m1a5 will target magic missile at the current target.
    You can then bind m1a5 to any key using keymaps under the option menu. (=)

    Comment

    • Ingwe Ingweron
      Veteran
      • Jan 2009
      • 2129

      #3
      Originally posted by petefj
      ...And do these instructions have to be inserted into the game file each time you log in and play Angband?
      I have a template .prf file that I use which contains my keymaps, inscriptions, and subwindows preferences. When I choose the @ race/class at the start of the game, I "un-comment out" (remove the"#") for the relevant lines in my template.prf, load the .prf, and then save keymaps, inscriptions and subwindows preferences to the @.

      Below is an excerpt from my template.prf for "Light Area" (note this is for the nightlies branch and note also that these keymaps also correlate with and depend upon my autoinscriptions.

      Using this, I can always press F4 to light area, regardless of class. Currently, my @ is a Half-troll warrior carrying a rod of illumination, hence you'll see the relevant line is un-commented.

      ## LIGHT AREA - [F4] ##

      ## Any Class ##
      ## Scroll of Light (inscribed @r4)
      #keymap-act:r4
      ## Staff of Light (inscribed @u4)
      #keymap-act:u4
      ## Rod of Illumination (inscribed @z4)
      keymap-act:z4
      ## Phial
      #keymap-act:Af

      ## Mage ##
      ## Light Area spell
      #keymap-act:m1d

      ## Priest ## (Prefers Phial)
      ## Call Light spell
      #keymap-act:m1e

      ## Rogue ##
      ## Light Area spell
      #keymap-act:m1c

      ## Ranger ##
      ## Light Area spell
      #keymap-act:m1d

      ## Paladin ##
      ## Call Light spell
      #keymap-act:m1e
      “We're more of the love, blood, and rhetoric school. Well, we can do you blood and love without the rhetoric, and we can do you blood and rhetoric without the love, and we can do you all three concurrent or consecutive. But we can't give you love and rhetoric without the blood. Blood is compulsory. They're all blood, you see.”
      ― Tom Stoppard, Rosencrantz and Guildenstern are Dead

      Comment

      • takkaria
        Veteran
        • Apr 2007
        • 1951

        #4
        Originally posted by Ingwe Ingweron
        I have a template .prf file that I use which contains my keymaps, inscriptions, and subwindows preferences. When I choose the @ race/class at the start of the game, I "un-comment out" (remove the"#") for the relevant lines in my template.prf, load the .prf, and then save keymaps, inscriptions and subwindows preferences to the @.
        Do you know that the game loads a pref file named after your class, if you have one? So e.g. Paladin.prf or Ranger.prf. Might save you a bit of faff editing your keymaps every time!
        takkaria whispers something about options. -more-

        Comment

        • Ingwe Ingweron
          Veteran
          • Jan 2009
          • 2129

          #5
          Originally posted by takkaria
          Do you know that the game loads a pref file named after your class, if you have one? So e.g. Paladin.prf or Ranger.prf. Might save you a bit of faff editing your keymaps every time!
          News to me. Thanks, Takkaria!
          “We're more of the love, blood, and rhetoric school. Well, we can do you blood and love without the rhetoric, and we can do you blood and rhetoric without the love, and we can do you all three concurrent or consecutive. But we can't give you love and rhetoric without the blood. Blood is compulsory. They're all blood, you see.”
          ― Tom Stoppard, Rosencrantz and Guildenstern are Dead

          Comment

          • redlumf
            Scout
            • Aug 2015
            • 25

            #6
            Originally posted by petefj
            I've read that it's possible to bind keystrokes, or weapons to specific keys such as f1 one f2 etc.
            On what platform/subsystem? (eg. windows/sdl, linux/gcu etc)

            Comment

            • Pete Mack
              Prophet
              • Apr 2007
              • 6883

              #7
              Platform independent, so all platforms

              Comment

              • redlumf
                Scout
                • Aug 2015
                • 25

                #8
                Originally posted by Pete Mack
                Platform independent, so all platforms
                Ok, good luck with gcu then.

                But if OP was in gcu and can compile from sources then, locate in main-gcu.c the /* keypad keys */ and replace the

                Code:
                /* keypad keys */
                		case 0xFC: i = '0'; break;
                		case 0xFD: i = '.'; break;
                		case 0xC0: i = '\b'; break;
                		case 0xDF: i = '1'; break;
                		case 0xF5: i = '3'; break;
                		case 0xE9: i = '5'; break;
                		case 0xC1: i = '7'; break;
                		case 0xF4: i = '9'; break;
                with

                Code:
                	/* keypad keys */
                		case 0xFC: i = '0';mods |= KC_MOD_KEYPAD; break;
                		case 0xFD: i = '.';mods |= KC_MOD_KEYPAD; break;
                		case 0xC0: i = '\b';mods |= KC_MOD_KEYPAD; break;
                		case 0xDF: i = '1';mods |= KC_MOD_KEYPAD; break;
                		case 0xF5: i = '3';mods |= KC_MOD_KEYPAD; break;
                		case 0xE9: i = '5';mods |= KC_MOD_KEYPAD; break;
                		case 0xC1: i = '7';mods |= KC_MOD_KEYPAD; break;
                		case 0xF4: i = '9';mods |= KC_MOD_KEYPAD; break;
                		
                		case KEY_F(1):i=KC_F1;break;
                		case KEY_F(2):i=KC_F2;break;
                		case KEY_F(3):i=KC_F3;break;
                		case KEY_F(4):i=KC_F4;break;
                		case KEY_F(5):i=KC_F5;break;
                		case KEY_F(6):i=KC_F6;break;
                		case KEY_F(7):i=KC_F7;break;
                		case KEY_F(8):i=KC_F8;break;
                		case KEY_F(9):i=KC_F9;break;
                                case KEY_F(10):i=KC_F10;break;
                		case KEY_F(11):i=KC_F11;break;
                		case KEY_F(12):i=KC_F12;break;
                and then you might get working function keys with gcu ;-)
                Last edited by redlumf; October 17, 2016, 20:02. Reason: forgot the with between the two blocks

                Comment

                Working...
                😀
                😂
                🥰
                😘
                🤢
                😎
                😞
                😡
                👍
                👎