The online racing simulator
Controlling siren, horn and lights in LFSLapper
Hi there,
Is it possible for LFSLapper to be able to control the local player's headlights, horn and siren? I'm making a script which I would like this to be able to do.
Sure, you can do such thing with Lapper.
You will need to make a command like:

CASE "!siren"

So if someone types '!horn' in chat a sub event is executed.
In that sub event you need to send a command to LFS, like:

cmdLFS("/siren fast");
Quote from Yisc[NL] :Sure, you can do such thing with Lapper.
You will need to make a command like:

CASE "!siren"

So if someone types '!horn' in chat a sub event is executed.
In that sub event you need to send a command to LFS, like:

cmdLFS("/siren fast");

Okay, thanks :-)
I'm having an issue with the delayed command, in the fact that it isn't executing it. Here's what I put if it helps:


Sub LightsOn($userName)
cmdLFS("/press 3");
DelayedCommand(1, LightsFlashToOff);
EndSub

Sub LightsFlashToOff($userName)
cmdLFS("/press 3");
DelayedCommand(1, LightsOn);
EndSub

that doesnt work, because it will execute the command for the host.

I also havent run Lapper in localmode before, So i cant say if it works locally.
Also

The Insimpacket that controls the local player lights/horns isnt implemented yet.

SMALL_LCS, // 9 - instruction : set local car switches (lights, horn, siren)

// CAR SWITCHES
// ============

// To operate the local car's lights, horn or siren you can send this IS_SMALL :

// ReqI : 0
// SubT : SMALL_LCS (Local Car Switches)
// UVal : Switches (see below)

// Switches bits

// Bits 0 to 7 are a set of flags specifying which values to set. You can set as many
// as you like at a time. This is to allow you to set only the values you want to set
// while leaving the others to be controlled by the user.

#define LCS_SET_SIGNALS 1 // bit 0
#define LCS_SET_FLASH 2 // bit 1
#define LCS_SET_HEADLIGHTS 4 // bit 2
#define LCS_SET_HORN 8 // bit 3
#define LCS_SET_SIREN 0x10 // bit 4

// Depending on the above values, InSim will read some of the following values and try
// to set them as required, if a real player is found on the local computer.

// bits 8-9 (Switches & 0x0300) - Signal (0 off / 1 left / 2 right / 3 hazard)
// bit 10 (Switches & 0x0400) - Flash
// bit 11 (Switches & 0x0800) - Headlights

// bits 16-18 (Switches & 0x070000) - Horn (0 off / 1 to 5 horn type)
// bits 20-21 (Switches & 0x300000) - Siren (0 off / 1 fast / 2 slow)

Ah, there's the master to show us the light.
I've just tried every trick in my book to get it working and failed misserably.
Now I know why, not possible (yet) Smile
Tongue

Yisc[NL] , could you try to run LFSLapper localy? Because that packet i showed can only be run locally.
Will see when i have time to implement this packet Tongue
Quote from Bass-Driver :Tongue

Yisc[NL] , could you try to run LFSLapper locally? Because that packet i showed can only be run locally.
Will see when i have time to implement this packet Tongue

This script works fine when Lapper is run LOCALY:

CatchEvent OnMSO( $userName, $text ) # Player event

$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF

SWITCH( $command )

CASE "!lights":
LightsOn ( 0,0 );
BREAK;
ENDSWITCH
EndCatchEvent

Sub LightsOn( $KeyFlags, $id )
cmdLFS("/press 3");
DelayedCommand(1, LightsFlashToOff);
EndSub

Sub LightsOn_2 ()
cmdLFS("/press 3");
DelayedCommand(1, LightsFlashToOff);
EndSub

Sub LightsFlashToOff()
cmdLFS("/press 3");
DelayedCommand(1, LightsOn_2);
EndSub

To me it has not worked, to put the command does nothing the lights
Quote from Popughini :To me it has not worked, to put the command does nothing the lights

If you would have read carefully, you would have noticed that it isn't working online.
A packet has to be implemented into Lapper, to be able to use those commands.

FGED GREDG RDFGDR GSFDG