now, as mage or ranger, occasionally rogue, there will be times where you simply need the fire command repeated many times. maybe you are just killing trolls. if this is a directional, non targeted command (cast acidbolt east) the game will happily repeat commands even when a key is not pressed.

I seriously question the amount of time you save by holding a button down vs. just hitting it 15 times in rapid succession. It's not too hard to hit a key 5 times a second; are you really that hard-pressed for time that you need to save 2 seconds (remembering that it takes a bit for key repeat to kick in) while fighting trolls?

this must be because the commands stack - if you use the keyboard to tell angband (fire 15 bolts east) then angband will tell the system "i will now fire as many bolts east as you have told me" instead of "ok i see that you want a command done, i will do it and then i will wait for new instructions".

I don't think there's any concept of commands 'stacking' in Angband like you say. Angband gets told by its frontend, which gets told by the OS, that a key got pressed. Angband does an instruction, and then goes back to the frontend to ask for another command. It goes like this:

Angband doesn't get one instruction saying 'fire 15 bolts east', it gets 15 keypresses and it processes each in turn. The OS/graphics library does the keypress buffering for us, and it's good, like kandrc tried to explain. If you don't buffer, you risk losing input, which in a game like Angband would be pretty terrible.

Angband does have the concept of flushing the input buffer. (grep the source for flush and look for something with both "flush" and "input" in proximity)

If someone were sufficiently motivated to hack in a command to flush the buffer, then a macro along the lines of cast-acid-bolt-at-nearest-target-then-flush-the-input-buffer might have interesting effects...

If someone were sufficiently motivated to hack in a command to flush the buffer, then a macro along the lines of cast-acid-bolt-at-nearest-target-then-flush-the-input-buffer might have interesting effects...

Yeah, that sounds like it might work. In fact, you don't need to hack anything in, you can just put a Control-R after the command because redrawing forces a flush.

I must say you all are unfair to Sky. Throttling keyboard repeat rate is reasonable, possible and easy.
takkaria, unsurprisingly, even figured out how to do it

Quote:

Originally Posted by takkaria

You could imagine a check where if the current command is the same as the previous one, then you check if the key is held down. But then if you pressed [f1] two times in a row manually (as opposed to with auto-repeat), this wouldn't be the desired behaviour either. You could, I guess, take a note of the time when each keypress comes through and compare it to the time of the previous command, and if they're really close together turn on scanning behaviour. But I imagine that will be pretty error-prone too, and would feel pretty non-deterministic to the player.

The best typists can type about 600 symbols per minute. (I heard in typing competitions they use stenography, and special keyboards with "chords" - no idea what that is - and then can show about 1200 symbols/min, but 600 is a pretty reasonable limit for a normal human with a standard keyboard). That's 10 symbols/sec, or 1 symbol in 100 milliseconds, which is a considerable time... Of course, 600 is average, and peak speed is higher than that, but if keypresses come faster than, say, once per 50 msecs, it means that the user is holding down a key, or pressed several keys (almost) simultaneously. So the pseudocode looks like:

You can also memorize the previous key, and only discard the new key if the time is not right and the new key is the same as the previous one (so that "movement delay" would work).

I implemented that in textui2 (but I forgot the previous key thing). That's how all key repeat limiters work, and it doesn't feel non deterministic or anything, if it allows, say, 20 keys per second. After that the difference can only be percieved when holding down a key.

As for flushing the input queue, you can just read from it until it's empty, and, btw, Angband already has TERM_XTRA_FLUSH, which is supposed to do exactly that.