The online racing simulator
Searching in All forums
(884 results)
Bass-Driver
S3 licensed
There is a file in post 9. With an example how to use the code.
https://www.lfs.net/forum/post/1904406#post1904406

To use that code, you must use the AutoX startlights. Which you cant because you are a Demoracer.

If you want to add/use those lights you must buy a s1/s2/s3 license.
Last edited by Bass-Driver, . Reason : typo
Bass-Driver
S3 licensed
You cannot add AutoX objects ( StartLights etc) as a demo user.
Bass-Driver
S3 licensed
Hi,
Indeed , when you change $distToDo to 1 , the server will lag badly. I've seen that in a another server.

The next option is to change the sourcecode of lapper.
I have done this and i created a new event named: OnNotIdle.(Player is driving faster than 1 KM/H).

But I haven't test this in the server. Because there is no code to be executed yet.

Maybe we could test your GPS script on my testserver.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
you better go to this post:
https://www.lfs.net/forum/post/1906198#post1906198.

And this script is far from complete. This script is not ment for public use.
Bass-Driver
S3 licensed
Thanks for solving it and for the trick.
Ill gonna save this trick.
Bass-Driver
S3 licensed
hi,
While working on a simple(should be simple) adminchat script. i Discovered a annoying issue i cannot solve.

The script stores the messages in a textfile.
After typing a message or entering the adminchat it loads the messages from the file. This works as it should be.

But the right sequence of those messages are totally lost.

Example: When you write a message : "2". and the next message is "1". That message will load above the previous message "2". And the message after that: "3". Load below "2".

Could someone give me a helping hand?

Fun fact: I have created a AdminLog system and i cannot solve this LOL.

Edit: Fixed something in the code. Same result.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Thanks.
Fixed in the dev version.
LFSLapper Adding ISP_CSC (Car's State Changed) packet
Bass-Driver
S3 licensed
hi,

I've added a another small event.
This event shows when the Car's State is changed.

For now it only reports when the car is driving or has been stopped.

##########################################################
#Actions to do when Car's State is changed#
##########################################################
#When $StateOfCar(bits) returns a value
#CSC_STOP, //0 Car stopped
#CSC_START, //1 Car started moving

Event OnCarStateChanged($userName,$StateOfCar)
/*
IF($StateOfCar == 0)THEN
globalmsg(getplayervar($userName,"NickName")."^7 Stopped the car!");
ENDIF
IF($StateOfCar == 1)THEN
globalmsg(getplayervar($userName,"NickName")."^7 Start driving!");
ENDIF
*/
EndEvent

Other value's that i could add in the Event Header.

-Time (current racetimer)
-Direction of the car
-Heading of the car
-Current Speed of the car (speed always be 0 or 1)
-X/Y/Z Coordinates


THIS IS A TEST VERSION
Any feedback whould be nice
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
There are a few steps to measure the distance between "The location" and "The Driver".

First: You have to set the Coordinates of the location.


CatchEvent OnLapperStart()
RegisterzoneAction( "BL1" , -60,106,4, CarShop, "");

#-60 = X-Coordinate
#106 = Y-Coordinate
#4 = width of your location
EndCatchEvent

You can check your coordinates with the !zone command.

When someone drives throught that location a sub is called named: CarShop

Sub CarShop($userName)
IF (BLABLA) THEN
#Write your code here
ENDIF
EndSub

Now you know the coordinates of the location (CarShop) and yourself !zone.

To measure the distance between you and the destination (CarShop)
To make it easy, you could create a command.

CASE "!addcheckpoint":
$X1=GetCurrentPlayerVar("X"); #Own X coordinate
$Y1=GetCurrentPlayerVar("Y"); #Own Y coordinate
$X2= -60; #CarShop Location X coordinate
$Y2= 106; #CarShop Location Y coordinate

$distX = $X1 - $X2;
$distY = $Y1 - $Y2;
$distuser = ($distX*$distX) + ($distY*$distY); #Calculate distance between You and The CarShop.
privmsg("^8Distance between you and the location: ^3" .$distuser. "^8 Meters");
BREAK;

Note:
Realtime Distance Measuring is not possible in Lapper by default.
You must modify the LFSLapper.exe, which asks C# coding skills.

Correct me if i'm wrong.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Well here's a another examplecode. Its a peace of code from a minigame i made.
I've edited a bit.


CASE "!addcheckpoint":
$CPX = GetCurrentPlayerVar("X"); #Get X-axis from player
$CPY = GetCurrentPlayerVar("Y"); #Get Y-axis from player

cmdLFS("/msg ^6›^7New Checkpoint is : ^0(^2X= ".$CPX."^7/^2Y= ".$CPY."^0)" );
RegisterzoneAction( getLapperVar( "ShortTrackName" ), $CPX,$CPY,4, FoundCheckPoint, "");
BREAK;

Sub FoundCheckPoint( $userName )
#Your code when a player drives throught the zone.
EndSub

Bass-Driver
S3 licensed
hi,

Here is a example code how to calculate the distance between 2 drivers or whatever you like.


$X1=GetPlayerVar( $Player1, "X" ); #Own X coordinate
$Y1=GetPlayerVar( $Player1, "Y" ); #Own Y coordinate
$X2=GetPlayerVar( $Player2, "X" ); #User2 X coordinate
$Y2=GetPlayerVar( $Player2, "Y" ); #User2 Y coordinate

$distX = $X1 - $X2;
$distY = $Y1 - $Y2;
$distuser = ($distX*$distX) + ($distY*$distY); #Calculate distance between user


Bass-Driver
S3 licensed
As promised: New LFSLapper Version

Version: 7.0.4.0
Contains function to control autoX startlights.

+-------------------------------+
|Changes from 7.0.3.0 to 7.0.4.0|
+-------------------------------+
1. New Lapperfunction:
startlightcontrol(5,149,1,1); #Control AutoX StartLights // More info in 'Control StartLights.txt' in 'Docs' folder. includes Examplecode

2. Renamed/added Objects for $DetectHitobject var.
Changed: All_Railings' renamed to 'All_Armco
Add: Railing


Have Fun
Bass-Driver
S3 licensed
Ill push this update(7.0.3.1) as official release next weekend. Maybe sooner.
New Version will be (7.0.4.0).
Bass-Driver
S3 licensed
I can set 12 startlightcontrol() functions without crashing.

startlightcontrol(5,149,0,1);
startlightcontrol(5,149,1,1);
startlightcontrol(5,149,2,1);
startlightcontrol(5,149,3,1);
startlightcontrol(5,149,4,1);
startlightcontrol(5,149,5,1);
startlightcontrol(5,149,6,8);
startlightcontrol(5,149,7,1);
startlightcontrol(5,149,8,1);
startlightcontrol(5,149,9,1);
startlightcontrol(5,149,10,1);
startlightcontrol(5,149,11,1);

Dont know what you mean about the Sub thing.
for testing the light i used this code.

EDIT: Moved example/test script to file
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Its not a event, its a LapperFunction. See first post.

I havent copied the "src"folder, to the testversion. But 'All_Armco' should work.
And Objectnames ( Short/Medium/Long) Armco should work too
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
you can use the startlights for drag. But you cannot place those startlights in demo.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Here is the Test Version:

For documentation see first post.
I'm not sure what RESET and UNSET does.

Have Fun

Changes:

[Add]OCO Packet(Startlight Control) (Test)
[Change]ObjectHit: All_Railings' renamed to 'All_Armco'

Edit: Released new LFSLapper version 7.0.4.0 , See Release Thread
Last edited by Bass-Driver, .
LFSLapper adding ISP_OCO packet (StartLight Control)
Bass-Driver
S3 licensed
Hello everyone,

Today i started with implementing the OCO packet in LFSLapper.

After a few tests , the startlight control works good, so far.

You can control the startlights by using a new function:

LapperFunction:
startlightcontrol(5,149,1,1);
startlightcontrol($LightAction,$LightIndex,$LightIndentifier,$LightColor);

Be sure those vars are GlobalVars.

$LightAction:

#4 = OCO_LIGHTS_RESET, // give up control of all lights
#5 = OCO_LIGHTS_SET, // use Data byte to set the bulbs
#6 = OCO_LIGHTS_UNSET, // give up control of the specified lights

$LightIndex:

AXO_START_LIGHTS (149) or STARTLIGHTS_TRACK (240)

$LightIndentifier:

identify particular start lights objects (0 to 63 or 255 = all)

You can give each StartLight a differend number in AutoX editor:

$LightColor:


STARTLIGHTS_TRACK(240) AXO_START_LIGHTS(149)
0 = off 0 = off
1 = red1 1 = red
2 = red2 2 = amber
4 = red3 -
8 = green 8 = green

First testversion will be released soon.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Sorry for the incomplete 'ObjectsList'

Should be: TrackSide_Objects
if (newCfg.varsLapper.DetectHitObject.Contains("TrackSide_Objects") && (obh.Index == 0)) //(Scenery Objects)

Changed: 'All_Railings' to 'All_Armco'
Add: 'Railing' as object

Shall i rename the objects too?
Bass-Driver
S3 licensed
Thanks,

I have changed the TrackList file in the DEV version.
The future release could take a while, because i have to update the scripts on my lapper.

Thank you all for testing and enjoy the new version of LFSLapper.
Bass-Driver
S3 licensed
New LFSLapper version:

+-------------------------------+
|Changes from 7.0.1.0 to 7.0.3.0|
+-------------------------------+
1. LapperInsimVersion changed to Version 7 (Thanks to Yisc[NL])

2. New Events:
Event OnCarContact($PlayerA,$PlayerB,$PlayerA_Speed,$PlayerB_Speed,$PlayerA_X,$PlayerB_X,$PlayerA_Y,$PlayerB_Y) # Player event
Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex) # Player event

3.New PlayerVar:
Z, //Height of player on track
+-------------------------------+
|Changes from v6.014 to 7.0.1.0 |
+-------------------------------+
1. New player vars (case sensitive):
ObjectContactSpeed, //Speed of player when hitting a object
ObjectContactHead, //Heading of player when hitting a object
ObjectContactDir, //Direction of player when hitting a object

AccelerationStartSpeed2, // Min value for the acceleration feature relative to user unit km or mph
AccelerationEndSpeed2, // Max value for the acceleration feature relative to user unit km or mph
AccelerationTime2, // Acceleration time achieved from start to end speed

2. New Lapper Vars
$AccelerationStartSpeed2 = 100; # At which speed to start measuring time. In km/h
$AccelerationEndSpeed2 = 160; # At which speed to stop measuring time. In km/h
$AccelerationStartSpeedMph2 = 60; # At which speed to start measuring time. In Mph
$AccelerationEndSpeedMph2 = 100; # At which speed to stop measuring time. In Mph
$AccelerationPrivateMaxTime2 = 10; # Maximum acceleration time in seconds to show message

$DetectHitObject = ""; #To get objectstrings for detection look at docs/ObjectHit.txt

3. New Events:
Event OnAcceleration2( $userName ) # Player event
Event OnObjectHit($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType) # Player event

Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Final Release: CON (Carcontact) and UCO (InSim checkpoint / InSim circle) packets


Update: -Add Circleindex to OnCrossingChecker event.
-Version numbering is changed. Last number is now for small codechanges like bugfixes etc.

See first post
ISP_UCO help
Bass-Driver
S3 licensed
hi,

Ive add the UCO packed in LFSLapper, which is working well.
https://www.lfs.net/forum/thre ... per-adding-ISP-UCO-packet

i have a question about it.

Is it possible to indicate the InsimCircle Index(Object index = 253) and Insim Checkpoint 1/2/3/F(Object index = 252)?
I have red the LytFormat file but i dont know how to code it.

Could someone give me a helping hand?
Bass-Driver
S3 licensed
Whould be nice if it possible to indicate which Checkpoint or Checker you acrossed.
LFSLapper adding ISP_UCO packet
Bass-Driver
S3 licensed
New Packet/Event , new thread.

New packet: UCO - report InSim checkpoint / InSim circle (autoX objects)

To get data from this packet, the new insimversion is required
Thanks to Yisc[NL] for fixing this problem.

##########################################################
#Actions to do on Insim Checker/Checkpoint (AutoX object)#
##########################################################
#When $Flags(bits) returns a value
#UCO_CIRCLE_ENTER, //0 (00) User entered a Checker
#UCO_CIRCLE_LEAVE, //1 (01) User left a Checker
#UCO_CP_FWD, //2 (10) User crossed Checkpoint in forward direction
#UCO_CP_REV, //3 (11) User crossed Checkpoint in reverse direction

Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex) # Player event
#privmsg(getplayervar($userName,"NickName"));
#privmsg("Action: ".$Flags);
#privmsg("Time: ".$Time);
#privmsg("Object: ".$Object);
#privmsg("CircleIndex: ".$CircleIndex);
#privmsg("Speed: ".$UserSpeed." ".getplayervar($userName,"UnitSpeed"));
EndEvent

Edit: Check for newest release in Release Thread.
Last edited by Bass-Driver, .
FGED GREDG RDFGDR GSFDG