Forum
See player keypresses when watching a demo
Created 25th February 2012 @ 03:24
Add A Reply Pages: 1 2 Next »
A while back I discovered that demo files contain a recording of the commands that players enter. After a slightly laborious process I was able to make this information print out to a text file – http://www.reddit.com/r/teamfortress/comments/m0i9z/retrieve_button_presses_from_a_demo_file_with_tickoriginal post[/url].
However, that in itself wasn’t all that useful because it required post-production and the output was in a text file or somesuch.
I just figured out another way that you can achieve something similar within tf2.
You need these four console commands:
• developer 1
this spits out the console output in the top-left corner of your screen while playing / spectating (may vary depending on HUD of choice)
• demo_debug 1
as explained in the linked post, this outputs everything that happens in the demo, include commands by the player
• con_filter_enable 1
we want to be able to remove all the other junk from the console output about player deaths and unbounded objects and things
• con_filter_text "dem_consolecmd"
this will only show lines with player commands
As a result, you get something like this
The output format is [tick] dem_consolecmd [action][key]
I don’t exactly know what numbering system the keys are using… they’re not ASCII, at least, but they appear consistent. If anyone recognizes it, comment below.
Now if you’re watching a particularly dexterous player, such as Epsilon schocky, it’s quite hard to follow along at 100% speed, so if you get to an especially interesting section, it’s probably best to slow things down using demoui or whatever.
Frankly this is extremely nerdy and probably of little benefit, but more info to learn from can’t hurt, eh?
Last edited by atmo,
interesting
The keycodes are the Source keymap (used for P.OnKeyCodePressed()
, etc).
(0, KEY_NONE)
(1, KEY_0)
(2, KEY_1)
(3, KEY_2)
(4, KEY_3)
(5, KEY_4)
(6, KEY_5)
(7, KEY_6)
(8, KEY_7)
(9, KEY_8)
(10, KEY_9)
(11, KEY_A)
(13, KEY_C)
(12, KEY_B)
(14, KEY_D)
(15, KEY_E)
(16, KEY_F)
(17, KEY_G)
(18, KEY_H)
(19, KEY_I)
(20, KEY_J)
(21, KEY_K)
(22, KEY_L)
(23, KEY_M)
(24, KEY_N)
(25, KEY_O)
(26, KEY_P)
(27, KEY_Q)
(28, KEY_R)
(29, KEY_S)
(30, KEY_T)
(31, KEY_U)
(32, KEY_V)
(33, KEY_W)
(34, KEY_X)
(35, KEY_Y)
(36, KEY_Z)
(37, KEY_PAD_0)
(38, KEY_PAD_1)
(39, KEY_PAD_2)
(40, KEY_PAD_3)
(41, KEY_PAD_4)
(42, KEY_PAD_5)
(43, KEY_PAD_6)
(44, KEY_PAD_7)
(45, KEY_PAD_8)
(46, KEY_PAD_9)
(47, KEY_PAD_DIVIDE)
(48, KEY_PAD_MULTIPLY)
(49, KEY_PAD_MINUS)
(50, KEY_PAD_PLUS)
(51, KEY_PAD_ENTER)
(52, KEY_PAD_DECIMAL)
(53, KEY_LBRACKET)
(54, KEY_RBRACKET)
(55, KEY_SEMICOLON)
(56, KEY_APOSTROPHE)
(57, KEY_BACKQUOTE)
(58, KEY_COMMA)
(59, KEY_PERIOD)
(60, KEY_SLASH)
(61, KEY_BACKSLASH)
(62, KEY_MINUS)
(63, KEY_EQUAL)
(64, KEY_ENTER)
(65, KEY_SPACE)
(66, KEY_BACKSPACE)
(67, KEY_TAB)
(68, KEY_CAPSLOCK)
(69, KEY_NUMLOCK)
(70, KEY_ESCAPE)
(71, KEY_SCROLLLOCK)
(72, KEY_INSERT)
(73, KEY_DELETE)
(74, KEY_HOME)
(75, KEY_END)
(76, KEY_PAGEUP)
(77, KEY_PAGEDOWN)
(78, KEY_BREAK)
(79, KEY_LSHIFT)
(80, KEY_RSHIFT)
(81, KEY_LALT)
(82, KEY_RALT)
(83, KEY_LCONTROL)
(84, KEY_RCONTROL)
(85, KEY_LWIN)
(86, KEY_RWIN)
(87, KEY_APP)
(88, KEY_UP)
(89, KEY_LEFT)
(90, KEY_DOWN)
(91, KEY_RIGHT)
(92, KEY_F1)
(93, KEY_F2)
(94, KEY_F3)
(95, KEY_F4)
(96, KEY_F5)
(97, KEY_F6)
(98, KEY_F7)
(99, KEY_F8)
(100, KEY_F9)
(101, KEY_F10)
(102, KEY_F11)
(103, KEY_F12)
(104, KEY_CAPSLOCKTOGGLE)
(105, KEY_NUMLOCKTOGGLE)
(106, KEY_SCROLLLOCKTOGGLE)
(107, MOUSE_LEFT)
(108, MOUSE_RIGHT)
(109, MOUSE_MIDDLE)
(110, MOUSE_4)
(111, MOUSE_5)
(112, MOUSE_WHEEL_UP)
(113, MOUSE_WHEEL_DOWN)
(114, KEY_XBUTTON_A)
(115, KEY_XBUTTON_B)
(116, KEY_XBUTTON_X)
(117, KEY_XBUTTON_Y)
(118, KEY_XBUTTON_LEFT_SHOULDER)
(119, KEY_XBUTTON_RIGHT_SHOULDER)
(120, KEY_XBUTTON_BACK)
(121, KEY_XBUTTON_START)
(122, KEY_XBUTTON_STICK1)
(123, KEY_XBUTTON_STICK2)
(146, KEY_XBUTTON_UP)
(147, KEY_XBUTTON_RIGHT)
(148, KEY_XBUTTON_DOWN)
(149, KEY_XBUTTON_LEFT)
(150, KEY_XSTICK1_RIGHT)
(151, KEY_XSTICK1_LEFT)
(152, KEY_XSTICK1_DOWN)
(153, KEY_XSTICK1_UP)
(154, KEY_XBUTTON_LTRIGGER)
(155, KEY_XBUTTON_RTRIGGER)
(156, KEY_XSTICK2_RIGHT)
(157, KEY_XSTICK2_LEFT)
(158, KEY_XSTICK2_DOWN)
(159, KEY_XSTICK2_UP)
Last edited by octochris,
Cool. And 107 = M1, 108 = M2.
uh, thanks for the sticky! also shoutout to max who might do something with this idk
Quoted from slate
would be interesting if triggerbots actually send mouse1 pressed.
Some may, others may not.
Quoted from Яyan
[…]
Some may, others may not.
Any decently programmed triggerbot would most definitely not do such a thing.
I can’t remember where I came across this thread but yeah, this script will show keys during your demo recordings or something
http://forums.tf2jump.com/index.php?topic=596.0
I haven’t tried it. If they come up while you’re playing it sounds kind of annoying. Maybe if they weren’t positioned around the crosshair.
There’s a some sort of HUD that also displays keypresses. Don’t know where you can get it but here it is in action showing a RJ wall pogo
http://www.youtube.com/watch?v=oMwNOx8ulUI
Or could this be done by using keypresses in combination with close captioning?
edit: just checked the link. That’s indeed the keypress script you’re seeing in the movie.
Last edited by CapTVK,
That’s either the script I linked to above, or the showkeys (!skeys) server plugin.
I’m not sure that the script on tf2jump would work for 6v6 though, since it seems to use wait commands.
Add A Reply Pages: 1 2 Next »