The online racing simulator
problems with insim pack 'SCH'
(8 posts, started )
#1 - Veiti
problems with insim pack 'SCH'
Hi mates,

I was just playing around with insim and was hoping to activate my flasher by sending an insim pack. In LFS options I bound '8' to the flasher and sent a package to LFS. Unfortunately the flasher did not flash. But if I open the chat window, the '8' appears.

Here is the code. Maybe someone of you can tell me, what I have done wrong?

....
SingleCharPack.id := 'SCH';
SingleCharPack.Char := chr(56);
SingleCharPack.Flags := 0;
SingleCharPack.Spare2 := 0;
SingleCharPack.Spare3 := 0;
IdUDPClient1.SendBuffer(SingleCharPack, SizeOf(TSingleCharPack));
....

Thanks in advance.
Ciao
Veit
I dont know exactly how you construct the packages, but arent you forgetting the zero at the end of 'SCH' ? But then it should not display the 8 in the chat line either...

Hm, dunno then, sorry
#3 - Veiti
Hi,

thx for your reply. No, I don't think there's a zero missing, because the chat window of LFS receives the right key.

Anyway I bypassed this problem by sending a message directly to the LFS window (SendMessage).

Ciao
Veit
#4 - Veiti
... it's me again. There is a strange problem with sendmessage too. I send keys to LFS using this code:


.
.
.
TheWindowHandle:=FindWindow(nil, 'Live for Speed');
if TheWindowHandle<>0 then
SendMessage(TheWIndowHandle,WM_KEydown,ord(taste),0);
.
.
.

It works quite well to simulate key presses of numbers (0..9). But if I send an "114" for a "r", lfs reacts like I have pressed F4. Could someone please tell me, what I have done wrong?

Thanks in advance!
Ciao
Veiti
#5 - Stuff
For sending the SCH packet, Frankmd is right, you are missing the 0 character after SCH. See


struct SingleCharPack // send to LFS to simulate single character
{
char Id [4]; // SCH + zero
char Char; // key to press
byte Flags; // bit 0 : SHIFT / bit 1 : CTRL
byte Spare2;
byte Spare3;
};

For the SendMessage, what does ord(taste) do? If that's what you're trying to send, maybe its trying to find the ascii of 'taste' instead of each character. Hmm, maybe I'm thinking SendMessage only does 1 keystroke at a time.. meaning you would have to send 't' 'a' 's' 't' 'e' instead of 'taste'. I dunno.. I tried
#6 - Veiti
Hi Stuff,

thx for replying!

I use SendMessage (Windowes API), which expects an integer value for virtual key code. Unfortunately I forgot to upcase taste (variable of char), in order to create a right virtual key code:

SendMessage(TheWIndowHandle,WM_KEyup,ord(upcase(Taste)),0);

Anyway, thx for your help!

Ciao
Veit
#7 - nikka
Quote from Veiti :Hi mates,

I was just playing around with insim and was hoping to activate my flasher by sending an insim pack. In LFS options I bound '8' to the flasher and sent a package to LFS. Unfortunately the flasher did not flash. But if I open the chat window, the '8' appears.

Hey all, old thread, but I got the excact same problem..

If I send SCH 'h' to LFS, it turns on my right indicator.. but when I press 'h' in LFS, the history list is enabled/disabled, just as it's supposed to do. To turn on the right indicator, I have to press '8'... (and yes, I know the SCH 'h' is recieved as a 'h' in LFS, cause if I open the chat window before I send it I can see a 'h' being written)

The same for all other keys I try to send... they are recieved correctly in LFS, but are interpreted totally wrong. Is it just me, or is something very wrong?

Thanks!
That was already reported in some thread. It's a known bug (at least to me ^^).
-
(MonkOnHotTinRoof) DELETED by MonkOnHotTinRoof

problems with insim pack 'SCH'
(8 posts, started )
FGED GREDG RDFGDR GSFDG