The online racing simulator
[OT] C#: How to manipulate user's keyboard input?
Hi guys,

I'm sitting here wondering a bit... is it possible (in a performance-wise somewhat reasonable way) to manipulate the user's keyboard input? Basically, the thing I want to do is a little gimmick application that lets the lights & indicators of a users car flash in a certain way, which is meant to be used for pacecars. To achieve that, I'd need to simulate to LFS that the user has pressed the 7, 8, 9, 0 or L button on the keyboard.

I'd like to use it since (for me) it adds a tiny little bit to the realism if a car which is skinned and driven as a pacecar actually has flashing lights instead of the plain hazard lights going on-off-on-off ever so slowly. I totally know that this program might not be needed in any way at all, but it's also a learning thingie.

Any help or link to a site worth reading is much appreciated. Thanks in advance

Stalker
Find the handle of the LFS window and then using SendMessage with the appropriate events should be enough (WM_CHAR or WM_KEYDOWN/UP). It's not pretty and might cause other problems (for instance, if a chat window gets opened), but it is quick to do
#3 - Bean0
Isn't this possible via LFS scripts? (controlling the blinkers on a time delay that is)
SendKeys?

Quote from xaotik :Isn't this possible via LFS scripts? (controlling the blinkers on a time delay that is)

No, because there is no wait command in the LFS scripting system.
Quote from AndroidXP :SendKeys?


No, because there is no wait command in the LFS scripting system.

Just me being pedantic, but there is a new LFS scripting /wait command, but would help not in this case at all as LFS freezes momentarialy when you execute /wait.

/wait E C :like exec but LFS hangs until E exits, with command line C
Yes, well, no. Okay, there is a "wait" command, but it does something completely different than what I'm talking of. Tbh, I forgot about the LFS version of this command and was thinking in terms of Half Life/Source engine scripting, where "wait" simply skips a frame (not terribly useful either, but better than nothing).

What we'd need would be a "/pause ms" command, that simply halts script execution for <ms> milliseconds. But at the same time, there's so much more you could copy from many first person shooter's scripting architecture to make LFS scripting more useful and intuitive. Like aliases.

FGED GREDG RDFGDR GSFDG