Don't forget to initialize SetCurrentPlayerVar("Refund", 1 ) ); on player connection
Don't forgot to use WriteLine to trace your code in console. WriteLine display a message in console screen
For debugging code is usefull. When your code is good remove lines
+-------------------------------+ |Changes from v5.914 to 5.915 | +-------------------------------+ Files to replace From the previous version LFSLapper.exe
1. Fix error on storedvalue on migration from 5.8
2. Add players Vars PBDrift to have the drift PB on the current combo
drew_welc2 = "^7Your best drift score: {0} &Don't act the fool&Respect your fellow drifters";
langEngine("%{drew_welc2}%",$bestDriftScore )
replace {0} with content of$bestDriftScore
Another example with 2 argument to langEngine
drew_welc3 = = "^7Hello {0} Welcome on {1}";
langEngine("%{drew_welc3 }%",$uname,"My Server Name" )
replace {0} with content of $uname
replace {1}with "My Server Name" ( without quote )
All identifier precede wth $ is variable
$uname is a variable that can contains text or numeric value
To set it use this syntax
$uname = "My var contain this text";
in this case $uname contains "My var contain this text";
$uname = GetCurrentPlayerVar( "UserName");
in this case $uname contains the player userName, "Gai-Luron" if it's me who connect to your server and trigger the event onConnect.
Gai-Luron
PS : For now you haven't access to the driftPb, i put it in next release
I see your previous post about this feature. I try to put in LFSLapper but there is a problem to do that. In fact LFS send packet every 1/10 of second, but the distance that vehicle have done is wrong for this unit of time and by extension the speed is wrong. But near to true for 5 time unit (average speed).
In fact this is due to packet latency or lag
If i use this 1/10 of second unit, speed can climb up to 200km/h in one packet and 20km/h in next. The real speed is near 110 when i use more then 4 packet.
The GPS value can be correct every second, no under this value
there is a possibility if i make average of the 5 previous dist making a glissando for one step unit.
Example
avg of packets ( 1 2 3 4 5 )
then avg of packets ( 2 3 4 5 6 )
then avg of packets ( 3 4 5 6 7 )
i try if i can do that , if this can be done, the GPS speed is late about 500 millisecond relative to real speed
You can copy and paste that is inside events, not the line Event yourEvent ( ), because in 5.9 Player Event have a new parameter $userName ( you don't have to use it if you want ).
Also take a look at your code because var are case sensitive now
GetCurrentPlayerVar( "username" ) not same as GetCurrentPlayerVar( "UserName" )
Take a look at varslapper.txt in doc folder for complete list of builtin var for player
5.9 it's very similar to 5.8, the big difference is that player event receive the username of the player who triggered this event, that's all. the rest catchevent and catchsub are a new feature, not obligation to use it, but recommended to have clean script.
To have all player var available take a look at file playerVars.txt in doc folder. i don't know if this file exist in your release. But in 5.9 you can refer to it to know all player var
Array are also present in your 5.8 version . in last version i optimize array, no add
All feature of the 5.9 version are the same than the older, except catchevent and catchsub.
When you use a catchEvent is like using the event.
example
LFSLapper.lpr
Event OnGoodDrift( $userName ) # This is present in main lpr file LFSLapper.lpr
....
CatchEvent
driftMeter.lpr
CatchEvent OnGoodDrift( $userName ) # This can be present in your script closePrivButton( "driftcomboboxtexttopmessage0&driftcomboboxtexttopmessage&driftcomboboxtexttopmessage1" ); globalMsg( langEngine( "%{main_ongooddrift}%" ,GetCurrentPlayerVar("NickName"),GetCurrentPlayerVar("LastDriftScore") ) ); openPrivButton( "driftcomboboxtexttopmessage2",85,19,30,5,3,8,16,langEngine( "%{driftmeter_driftcomboboxtexttopmessage2}%") );
EndCatchEvent
anotherfile.lpr
CatchEvent OnGoodDrift( $userName ) # This can be present in other script
....
EndCatchEvent
First LFSLapper do the Event OnGoodDrift and then execute all catchEvent with the name OnGoodDrift
With that you haven't to modify LFSLapper.lpr to add your code, just add a catchEvent on the event that driftmeter need. In fact you release only one .lpr file. User include your script file using include in addonsused.lpr file and your script is added and work. No modification complicated need in main lpr file
Example in addonsused.lpr
#### Include for drifting infos #### #include( "./driftdef.lpr"); # OR #include( "./driftmeter.lpr"); #####################################
just remove # before include( "./driftmeter.lpr"); to have your driftmeter working
or remove # before include( "./driftdef.lpr"); to have default drift feature, no need to remove /* or */ arround code in LFSLapper.lpr
The big difference in the 5.9 is username passed to all player event and optimization ( more speed ) for the GLScript.
Take a look at your updated driftmeter script and you understand how work catchevent. ( very easy )
In last version driftmeter is by default in LFSLapper ( with catchevent ). Remove # into addonsused.lpr before driftmeter line to have this feature , that's all
all code is in driftmeter.lpr
no modification to do in default config file
Why do you continue to use obsolete LFSlapper version?
you seem to have a 5.8 version of LFSLapper. What is your previous LFSLapper install? more change in configs files between 5.8 and 5.9. Start with a freshen release 5.9.1.3 and change the exe to 5.9.1.4