The online racing simulator
To get the Lapper to display this laps DriftScore instead of split time I assume that this is the bit that needs modifying:

Quote :Event OnSpbSplit1() # Player event
IF ( $enable_pitboard == "true" )
THEN
OnSpbSplit1_Pitboard();
ELSE
IF( GetCurrentPlayerVar("isBestSectorSplit1") == 1 )
THEN
$color = "^2";
ELSE
$color = "^1";
ENDIF
openPrivButton( "id_spb",50,55,100,10,10,5,0,$typ
. " ^7SP1"
. ": " . NumToMSH( GetCurrentPlayerVar("SectorSplit1")) . " "
. $color
. "(" . NumToMSH( GetCurrentPlayerVar("DiffSectorSplit1")) . ")"
. "&^7TPB:" . NumToMSH(GetCurrentPlayerVar("Tpb")) );
ENDIF
EndEvent

I was thinking if something like this:

Quote :Event OnSpbSplit1() # Player event
IF ( $enable_pitboard == "true" )
THEN
OnSpbSplit1_Pitboard();
ELSE
IF( GetCurrentPlayerVar("isBestSectorSplit1") == 1 )
THEN
$color = "^2";
ELSE
$color = "^1";
ENDIF
openPrivButton( "id_spb",50,55,100,10,10,5,0,$typ
. " ^7SP1"
. ": " . NumToMSH( GetCurrentPlayerVar("$DriftScore")) . " "
. $color
ENDIF
EndEvent

The part in italics I have no idea what it should be - something like TopDriftScore?

Am I even nearly right?
First, you have to understand the difference between DriftScore and LastDriftScore.


As you drive around picking up points for drifting, points collect for each individual drift as your LastDriftScore.

The score you have at end of lap/circuit is the DriftScore.

On your first drift, you will have collected points under LastDriftScore,and these points will also show under DriftScore. If you were to finish the lap (or circuit), it's this DriftScore which is saved as your high score.

If you do combo drifts (meaning you do a drift, slight gap between this drift and next but still keeping above minimum drift speed) then do another drift, then your LastDriftScore will change (based on your current drift) to whatever your new score is (might be higher or lower than your previous drift), but your DriftScore will show the total of both scores (LastDriftScore + LastDriftScore = DriftScore). Assuming you can keep above minimum speed till you finish lap, this DriftScore is saved as your high score.

Of course, if between one drift and another you happened to drop speed below minimum (or crash), your DriftScore would reset to zero.

I know this all looks complicated, but if you had the drift meter working, the above would make sense!

Or to put it another way, it's the LastDriftScore that would have to show under your splits, and DriftScore as final split/lap end.

Hope that helps!
Oh, and HOW has it helped!

You sir, are my new personal Jesus Christ

I've got the splits working showing the DriftScore at that point.

I've got the DriftScore and LastDriftScore showing up at the right time in the right place.

The message on leaving the pits works.

So, onwards

How do I get the welcome screen (where it says friendly rank -/-) to use drift scores to rank instead of laptimes?

Now that I have got !drf working, is there a way of getting the top scores that are saved by the users Nickname - NOT their username? So that 2 people sharing a controller can sort their high scores by their nicknames.

Thank you

/me goes off in search of a new "command actions" section...
Is "AngleVelocity" the same as "angle", or is it some kind of mathematical thing to do with "Angle + Velocity" or "Angle * Velocity"?

I ask because I've seen it register 110 degrees while I was at nearer 40 degrees

I've tried calling upon "DriftAngle" but getting nothing:

openPrivButton( "drew08",3,155,35,10,10,-1,32, . "^1Angle:^7 " . GetCurrentPlayerVar("DriftAngle") . " °" );
Oh, and what do i call upon for Instant speed?

I want a GPS speedo
Quote from drew555 :Oh, and what do i call upon for Instant speed?

Look for the following piece of coding in your lapper file;

[COLOR=Blue]Sub DisplaySpeed( )
# PrivMsg("SpeedTrap = " . ToPlayerUnit( GetCurrentPlayerVar( "InstantSpeed" ) . " " . GetCurrentPlayerVar("UnitSpeed"));
cmdLfs( "/msg SpeedTrap = " . GetCurrentPlayerVar( "InstantSpeed") . " kph or " . ToMph( GetCurrentPlayerVar( "InstantSpeed") ) . " Mph" );
EndSub[/COLOR]

Then under Event OnLapperStart() section, you will see something like;

RegisterNodeAction( "BL1" , 140 , DisplaySpeed );

or

RegisterZoneAction( "BL1" , -78,200, 5 , DisplaySpeed );

That means when the driver reaches a specific node or zone, then the speed will display.

BL1 is Blackwood
140 is the specific node on Blackwood
-78,200 is the specific zone on Blackwood, with 5 as how long message lasts

You need to go to racetrack and location where you want speed to display, and record the !zone or !node of your location.

I mainly use !node for speed on track, and !zone for messages about entering or leaving pits.

Once you have the !zone or !node co-ordinates, add an entry to your lapper config file.

Say you wanted speed to show on start/finish on Kyoto Oval (KY1), you would add ;

RegisterNodeAction( "KY1" , 4 , DisplaySpeed );

Thing is, you have to do this for every track configuration, and you may want to do more than 1 speedtrap if it's a big track.

On the plus side, if you change coding slightly, instead of speedtrap, you can put text, such as corner name, street name, warnings about specific corners, warnings about watching out for people leaving pits, your server name, etc, etc, etc.

For instance;

First register your node location on whichever track, along with sub-routine:

RegisterNodeAction( "KY1R" , 190 , SE_KY1Rstartfinish );

Then bit more detail on your sub-routine (basically a private message to the driver that reaches the node trigger point.

Sub SE_KY1Rstartfinish() # A Sinanju Event
privRcm( langEngine( "%{main_KY1Rstartfinish}%" ) );
EndSub


Then the message at the trigger point

main_KY1Rstartfinish = "Start / Finish line coming up";
Quote from drew555 :Is "AngleVelocity" the same as "angle", or is it some kind of mathematical thing to do with "Angle + Velocity" or "Angle * Velocity"?

I ask because I've seen it register 110 degrees while I was at nearer 40 degrees

I've tried calling upon "DriftAngle" but getting nothing:

openPrivButton( "drew08",3,155,35,10,10,-1,32, . "^1Angle:^7 " . GetCurrentPlayerVar("DriftAngle") . " °" );

I think AngleVelocity just means that your car is moving (velocity) at an angle when car should be moving in a straight line. This also happens in a corner, where the back end is not following the front.

Instead of using "DriftAngle", try "AngleVelocity".

You may want to think about differentiating between car drifting one way or another (facing left or right). Especially if you don't want a negative angle showing up on your drift score meter.


PS You've got a full stop after the comma that follows the 32 (32=background colour of button), which is then followed by text field - don't think this will work.
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

Gai-Luron
That's just made me decide to upgrade to 5.9 - but maybe it's because I've been drinking... but I can't find the best one.

Help?

Which is the best one to download - and where do I click?

Thank you

:edit:

And I meant constant speed - more like as GPS speedometer than a speedtrap
I went for....

5.9.1.4

So now do I have to re-write the lot or will a lot of my old LFSLapper.lpr file just copy and paste over?
Hello,

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.

5.8 no more developped, no maintained, no upgrade


Gai-Luron
Thanks Gai.

I have more questions (all about Lapper 5.9.1.4).

For my previous lapper, I had this:

Event OnSplit1() # Player event
openPrivButton( "split01",50,5,100,10,8,3,32, . "^1Split 01:^7 " . GetCurrentPlayerVar("DriftScore") . " ^1pts" ); );
ENDIF
EndEvent


And it gave me the DriftScore at the split marker.

I've put it directly into Lapper 5.9 and it doesn't appear to work.

Is it something simple in the transfer to 5.9?
Event OnSplit1() # Player event

it is that i say previously

now

Event OnSplit1( $userName ) # Player event

Don't change line containing word Event in LFSLapper.lpr 5.9.1.4 file, paste your code inside Event... EndEvent


This line is wrong, forgot IF and double ); ); at end
Quote :openPrivButton( "split01",50,5,100,10,8,3,32, . "^1Split 01:^7 " . GetCurrentPlayerVar("DriftScore") . " ^1pts" ); );
ENDIF

maybe a bad copy paste from your LFSLapper file to your post
I understand now, thank you Gai.

It worked!

Now this one.... also worked in previous lapper:

Event OnNewPlayerJoin( $userName ) # Player event
openPrivButton( "drewpitleave",50,5,100,10,8,3,32, "^1! ^7R E M E M B E R^1 !"
. "&^7First lap after pits ^1may not ^7count!" );
EndEvent


This is the one that I want to make a new mwessage whenever someone leaves the pits.

See anything obvious?
Take a look in err file.
Fixed the pit message, turns out it was this...

Quote : "^1! ^7R E M E M B E R^1 !"
. "&^7First lap after pits ^1may not ^7count!" );

... that was wrong.

Not sure what was wrong with it, but I deleted it and re typed it and it's now fine

Now... how do I change the 0-100 kmh display to read in MPH?
Automatic done relative to choice in !myconfig for each player

Script present in LFSLapper.lpr file is also relative to that choice
Thank you

Now it's time to get ahead of myself a bit.

There are a couple of things I want to try - one is a GPS speedometer - that shows a constant display of speed, updated in real time.

I know the cars all have speedometers - but I want a GPS one to see actual vehicle speed instead of rear wheel speed.

We do this with GPS units when we do it for real - and I wanted something similar for this.

If this works, I may use it for the angle meter too (having it attached to onDriftScore gives you the angle of the last drift - not in real time).

Is there a function for getting the vehicles true speed in real time?
Hello,

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

i hope you understand what i say

Gai-Luron
Yes, I understand.

A small lag is very acceptable - I believe that true GPS actually works that way as well.

Thank you.
And here's another one...

I have this at the welcome screen:

openPrivButton( "pos",25,80,150,10,8,-1,32,langEngine("%{drew_welc2}%",$Posabs,$Posqual,$Groupqual ) );

(default, apart from the modified langEngine entry)
Pointing to this:

drew_welc2 = "^7Your best drift score:&Don't act the fool&Respect your fellow drifters&Your face.";

What I'm after is getting the players highest score held in the !drf database for this track to be displayed here...

drew_welc2 = "^7Your best drift score: <BestDriftScoreHere>&Don't act the fool&Respect your fellow drifters";

I've tried various ways - but I'm struggling.

Is this even possible?
drew_welc2 = "^7Your best drift score: {0} &Don't act the fool&Respect your fellow drifters";

openPrivButton( "pos",25,80,150,10,8,-1,32,langEngine("%{drew_welc2}%",$bestDrifScore ) );

{0} is replaced by the first arg in langengine
{1} is replaced by the second arg in langengine
and so on

Dont forget to assign $bestDrifScore with the GetCurrentPlayerVar containing the best drift score.that's all

look at other langengine in default file to better understand how it work
Here's where I have my problems

I'm not a programmer, and have only been playing with lapper for a couple of days - so some of the terms are a little confusing.

Quote :drew_welc2 = "^7Your best drift score: {0} &Don't act the fool&Respect your fellow drifters";

So, where I want bestDriftScore displayed, I put in {0} - and it is replaced by bestDriftScore. I understand that.

Quote :openPrivButton( "pos",25,80,150,10,8,-1,32,langEngine("%{drew_welc2}%",$bestDrifScore ) );

Here's where I start to lose it.

In the "button text" section:

(langEngine("%{drew_welc2}%",$bestDriftScore ) )

It means: Look in the langEngine, Display drew_welc2 then bestDriftScore.

Correct?

Quote :{0} is replaced by the first arg in langengine
{1} is replaced by the second arg in langengine
and so on

I'm a newb - does that mean that in this case:

Lang "EN"

main_welc1 = "Welcome to my server";
main_welc2 = "It's the greatest server";
main_accept = "Continue";
main_deny = "Leave";
main_speedtrap = "^7SPEEDTRAP";

EndLang


That {0} at other places in the script is replaced by "Welcome to my server"?

and {2} is replaced by "Continue"?

So that:

openPrivButton( "cont_button",25,80,150,10,8,-1,32, {2} );

Would give me a button with 'Continue' written on it?

Quote :Dont forget to assign $bestDrifScore with the GetCurrentPlayerVar containing the best drift score.

How do I define bestDriftScore? And what is the significance of the $?

The bestDriftScore that I want to display is the one held in my driftPB.dbs file for the player name.

Thank you for your patience
Quote from Gai-Luron :Hello,

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

i hope you understand what i say

Gai-Luron

that will be cool for drift points and such... would also help me with my cruise addon
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

FGED GREDG RDFGDR GSFDG