The online racing simulator
This is a Drift Meter to use with LFSLapper (1st post for V5.7; later post for V5.8)
This isn’t really in the right forum section, but this is where a lot of people are asking for a meter that records a drift score, so I’m putting it here rather than the LFSLapper forum.

Hopefully this may stop a lot of repeat posts for the same thing.


LFSLapper Version
This drift meter will work with LFSLapper V 5.714 or earlier.

If you make extremely small change to the coding script, you should get it to work with V 5.716 too.

(There was a slight change in LFSLapper 5.716, in that the Personal Best and Drift databases lost the .txt suffix (i.e. V5.714 drift database its $DriftDatabase = "./DriftPB.txt, but in V5.716, it’s $DriftDatabase = "./DriftPB. So if you remove the .txt in the coding you can get it to work).

The coding is in 2 parts.

If you want to know what the majority of the coding actually means, see the attached text file. If you’re au fait with programming Lapper, then you’ll know it by heart anyway. It’s all fairly simple and basic stuff – which is why I could do it!


Anyway, now for the coding…

First part goes in the "Sub OnConnectClose()" section, which starts something like " closePrivButton("welc&pos&clos...."


Code has to be put in after closePrivButton, but before the EndSub at the end of the section.




openGlobalButton( "sinrs_dm_logo",5,98,36,6,4,-1,16,"^1Put your name/team name in this space" ); # Put your name/teamname or server or anything else you want in between the quotes - this text (^1) will be in red (see attached text file if you want to learn how to change the text colour)
openGlobalButton( "sinrs_dm_track",5,113,36,5,5,-1,16,"^3Track: ^2" . $LongTrackName . " ^1[" . $ShortTrackName . "]" );
openGlobalButton( "sinrs_dm_caranddriver",5,118,36,5,8,-1,16,"^6Car: ^2". $Car . "^7 - ^6Driver: " . $Nickname . );
openGlobalButton( "sinrs_dm_criteria",5,146,36,4,4,-1,16,"^4Scoring Criteria: "
. "&^7Minimum Drift Speed: ^330MPH / 48kph"
. "&^7Drift Angles (degrees): ^215^3 min / ^1100 ^3max");
openGlobalButton( "sinrs_dm_back",4,97,38,48,4,-1,32," " ); # Blank backing
openGlobalButton( "sinrs_dm _text",5,105,36,8,4,-1,16,"^0DRIFT MASTER ^1(c)Sin'rs" ); # 'DRIFT MASTER is in Black text
openGlobalButton( "sinrs_dm_driftblank",5,124,36,6,4,-1,80,"This Drift Score: " );
openGlobalButton( "sinrs_dm_comboblank",5,131,36,6,4,-1,80,"Total Combo Score: " );
openGlobalButton( "sinrs_dm_angleblank",5,138,36,6,4,-1,80,"Drift Angle: " );
openPrivButton( "sinrs_dm_score",30,124,11,6,4,-1,128,"- - - " ); # Blank. Score will overlay once you start scoring drift points
openPrivButton( "sinrs_dm_combo",30,131,11,6,4,-1,128,"- - - " ); # Blank
openPrivButton( "sinrs_dm _angle",30,138,11,6,4,-1,128,"> - < " ); # Blank
openGlobalButton( "sinrs_dm_criteriablank",4,145,38,14,3,-1,32," " );

The next section should overwrite your complete ‘Drifting options’ lapper section.

#================#
#Drifting options #
#================#

$DriftDatabase = "./DriftPB.txt"; # This is the filepath for a file containing the collected data.


$MinimumDriftSpeed = 48; # Minimum speed in km/h to maintain. Driving below that speed will reset score (48kmph is approx 30MPH)
$MinimumDriftAngle = 15; # Minimum angel to maintain. When angle is below value, score is reset
$MaximumDriftAngle = 100; # Maximum angel to maintain. When angle is above value, score is reset
$GoodDriftScore = 2000; # Value to be reached to execute action on good drift score
$MinimumDriftScore = 250; # Minimum drift score required

Event OnDriftScore()

IF( $AngleVelocity < 0 )

THEN
$AngleVelocity_reverse=($AngleVelocity)*(-1);

openPrivButton( "sinrs_dm_score",30,124,11,6,4,-1,128," ^7" . $LastDriftScore ); # Gray text with white score
openPrivButton( "sinrs_dm_combo",30,131,11,6,4,-1,128," ^2" . $DriftScore ); # Gray text with green score
openPrivButton( "sinrs_dm_angle",30,138,11,6,4,-1,128," ^7" . $AngleVelocity_reverse . "^2 =>" ); # Gray text with white score and green arrow

ELSE

openPrivButton( "sinrs_dm_score",30,124,11,6,4,-1,128," ^7" . $LastDriftScore ); # Gray text with white score
openPrivButton( "sinrs_dm_combo",30,131,11,6,4,-1,128," ^3" . $DriftScore ); # Gray text with yellow score
openPrivButton( "sinrs_dm_angle",30,138,11,6,4,-1,128," ^1<= ^7" . $AngleVelocity . " " ); # Gray text with white score and red arrow
ENDIF

EndEvent

# Message that will be shown to all on a drivers new personal best drift lap.
Event DriftPBAction()
cmdLFS( "/rcm " . $Nickname . "^3 made new drift PB: ^7" . $DriftScore . " ^3pts!" );
cmdLFS( "/rcm_all" );
EndEvent

# Message that will be shown when total lap drift score is higher or equal to MinimumDriftScore.
Event DriftLapAction()
cmdLFS("/msg " . $Nickname . " ^3drifted to ^7" . $DriftScore . " ^3pts" );
EndEvent

# Message that will be shown to all when driver makes a good drift score
Event GoodDriftAction()
cmdLFS( "/rcm " . $Nickname . " ^3made excellent drift: ^7" . $LastDriftScore ." ^3pts" );
cmdLFS( "/rcm_all" );

EndEvent

# Message that will be shown to all if a driver fails to score a minimum amount
Event DriftTooLowAction()
cmdLFS( "/rcm " . $Nickname . " ^3was absolutely rubbish!" );
cmdLFS( "/rcm_all" );
EndEvent

I've also included the 2 parts of the lapper code in a text file, which i've attached, to make it easier to copy and paste.

Remember to save backup copy of your original lapper file before you go changing it.

I take no responsibility for anything. Ask my kids.

If it all works, then I hope you enjoy. Any problems, then revert back to your saved backup copy.

PS I realise I could have used origL and origD for left and down instead of the long winded way I did it, but my way makes it much easier to reverse engineer (learn).



EDIT
-----
And for those of you who're still struggling, I've added the drift master meter coding into a vanilla LFSLapper.lpr (version 5.714) configuration. (File zipped as can't upload .lpr file).
-----
Attached images
Sin'rs Drift Master Meter.png
Attached files
LFSLapper Simple Button Coding.txt - 4.8 KB - 1753 views
Drift Master Coding.txt - 4.2 KB - 1772 views
LFSLapper.zip - 11.7 KB - 2571 views
Drift Meter
Does it work if i do this on the demo?
-
(MariusMM) DELETED by MariusMM
Great work dude! *downloads Lapper 5.714 again*
#5 - G!NhO
max drift angle: 100 degrees?

Then you are going backwards...

90 Degrees is the max angle you can get.
Quote from G!NhO :max drift angle: 100 degrees?

Then you are going backwards...

90 Degrees is the max angle you can get.

That's how I drift with keyboard (actually it's a slide, then a crash, then a roll - unfortunately never happens at the end of the lap, so my great drift scores always get reset to zero).

Good thing about the config, is you can reset this angle to be min and max whatever you want, along with speed, and what sort of score gets a fanfare.

As a non-drifter (who only made this scoreboard at someone else's request), what do YOU consider the minimum and angles should be set at to get score, and what sort of minimum speed to be kept up for a whole circuit/lap?

Let me know, please?

Ta.

Sinanju

PS I'm looking for a drift setup for a MRT if you've got one handy?
Quote from G!NhO :max drift angle: 100 degrees?

Then you are going backwards...

90 Degrees is the max angle you can get.

No, like if you use a FXO, I can get 100 with ease, and still manage to not spin out, so I don't see what's wrong with 100 degrees.
#8 - G!NhO
With fxo it isnt really drifting, and you will really slow down if you do that.

If you look at it like that, i can get a 180 degree angle with rb4 and not spin out...
It's slow yeah, and not real drifting, but 100 degrees is still manageable with even a XRT.
Yes I had same argument with people for my drift mod. I made it 100 degrees to.

Thing is, you can get 90 deg and that's fine, but if you happen to step out 1 degree or even 0.01 degree or get a tiny lag then the drift is lost and that's a shame when you're right on the knife's edge. So it's just a buffer so that you can keep at 90 deg safely.

Well that's why I made mine 100 degrees anyway. Just my 2c
As there's some debate on 90 or 100 degrees, I might split the difference and make it 95!

Like I've said before, in Lapper, it's a configurable option.

For instance, if you held a competion with heats, you could do certain min/max angles and speed for early qualifying heats, and start narrowing the angles and upping the speed that enable a score for later heats. Or you could just set it once, and see who gets the highest score. That's me out then!
Drift Meter Version 2
This is a Drift Meter to use with LFSLapper

This drift meter will work with LFSLapper V 5.844

Since Gai has now updated his Lapper, I've updated my Drift Meter to suit new version.

And with thanks for a great idea by [DUB]Azzy, and with help of some of his coding, I've added messages that appear both on the meter and at top of screen. These messages change the better (or worse) your drifting gets.

The messages on the meter change depending on your current drift. The messages at top of screen change depending on your overall score for all your drifts during a lap/circuit.

Drop below the minimum speed during a lap, and you lose scores!

See attached graphic for some of the messages that appear.

Not all possible combinations of messages are shown - I'm not good enough to get enough points.

Before the Drift Meter will work, you will need to set 'Drift Option' on !gui to Yes.

To install, open your LFSLapper.lpr script.

The whole of the section that starts

############
#Drifting options#
############


should be replaced with my section that starts

############
#Drifting options#
############


and ends with

#########################
# This is end of Drifting Options Section
#########################



Everything after

# Lang "EN" section

in my script needs to be added into your own script under Lang "EN" section.

Almost all LANG items start with 'main_'

Apologies for French, Italian, German, etc, etc, users, but I've only done an English section.

If you're confident enough with changing some of the simple scripting, some of the scores or messages can be changed.

For instance, I have
> 3150 = awesome (LANG - main_TDSM8 = "^8That was awesome";
> 5100 = insane (LANG
- main_TDSM9 = "^1That was insane";

You can always change to:

main_TDSM8 = "^8That was insane";
main_TDSM9 = "^1That was awesome";

Or just change the score numbers.

To the proper Lapper coders out there: I know the coding is a mess and inelegant! But at least I can follow some of it.

There is a LANG item called main_mylogo. You can overwrite what I have put in (Put your individual/team logo here) and add your own team name/clan here.

Caveats: Any mistakes in the coding are purely mine, and I can only apologize in advance if it all goes horribly wrong. For that reason, I would recommend that you backup your current known to work lfslapper.lpr script first before amending! And I will take no responsibility for anything.


Attached images
DriftMeter with text.PNG
Attached files
DriftMeter2.txt - 23.9 KB - 1234 views
Looking very nice
hmm... ive been working on the drift settings for many hours new, im not used to this insim lapper so i wounder... stuck at figuring where / if i can change the locations of the drift stuff showing on screen?
Quote from tm_raven :hmm... ive been working on the drift settings for many hours new, im not used to this insim lapper so i wounder... stuck at figuring where / if i can change the locations of the drift stuff showing on screen?

openPrivButton( "help",25,28,150,10,5,-1,0,"^2Commands list", backcall );
Open a button for the current player
1 - Unique id for this button
2 - Left coordinate for this button ( 0-200 )
$origL = (value between 0-200); - when this value is used, every next value can be made relative to this one (example: $origL + 5
3 - Top coordinate for this button ( 0-200 )
$origT = (value between 0-200); - when this value is used, every next value can be made relative to this one (example: $origT + 5
4 - Width of the button ( 0-200 )
5 - Heigth of the button ( 0-200 )
6 - Space between line in multiline button
7 - Duration in seconds for the button to be displayed (use -1 if you don't want an automatic close)
8 - Format of the button, look at insim.txt for values
9 - Button caption, for multiline, separate each line with &
10 - Option name of the backcalled sub
In other words - if you see line of code like

CODE:
openPrivButton( "driftcombotext",17,150,9,7,3,-1,0,langEngine( "%{main_driftcombotext}%" , $DriftScore ) );

Then;

button is called driftcombotext (unique name - no other button allowed to be called this)
17 17 (out of 200) from left of screen
150 150 (out of 200) down from top of screen
9 width of button (max size = 200 - button width) you don't want button off screen)
7 this is height of button (can also be height of text within button - can change if multiline message, as each text line is approx this size)
3 defines spacing in multilines and also acts as a gap top and bottom if only 1 line of text
-1 this is how long button is on for in seconds (you can't get a -1 second, so this means don't switch button off (1 would be 1 second, 2 would be 2 seconds....)
0 this is basically colour of button plus placement of text (0 = clear button with text centred, 16 = light grey button/centred text, 32 = darker button/centred text. Other combinations available (3 colours of buttons as described, plus centred text, left justified text or right justified text)
langEngine( "%{main_driftcombotext}%" this basically tells lapper to look for a file within itself in the language (LANG) section called main_driftcombotext, and put this text on the button - in this case it's the drivers driftscore and the colours the score and any text to be in - you are allowed multiple colours for text - same as peoples names)
$DriftScore this is the name of the sub-routine (usually described as backcalled sub). In this case it's a dynamic number (number can change), but could easily be another sub-routine to open another button or set of buttons.

At the very start of the line, it has openPrivButton. This means only the driver sees this button. Could have put openGlobalButton, and everyone would have seen it. As we're trying to measure the drivers score, should be private as only they should see it. If you made it global, everytime any driver made a drift, it would appear on the button - you wouldn't know who had made the drift.

Global buttons are great if you want to broadcast to everyone that someone's got high score or new pb, etc.

Be aware that the commas, semi-colons and other punctuation is vital.
Re: Lapper
Looking good Sinanju keep up the good work mate.
how exactly is the drift score calculated? can the scripting accept mathematical calculations like multipliers?

i.e. if you drift to 200 points on one drift, after that your score will increase at a rate of say 2x? over 1000 then it goes to 3x? or something variable so the longer you hold a drift your score increases faster and faster?
Quote from erfrag :how exactly is the drift score calculated? can the scripting accept mathematical calculations like multipliers?

i.e. if you drift to 200 points on one drift, after that your score will increase at a rate of say 2x? over 1000 then it goes to 3x? or something variable so the longer you hold a drift your score increases faster and faster?

Haven't tried it, but maybe something like;

IF( $LastDriftScore > 500 )
THEN
$LastDriftScore=$LastDriftScore*2;
ENDIF

IF( $LastDriftScore > 1000 )
THEN
$LastDriftScore=$LastDriftScore*3;
ENDIF

although if I was using multipliers, I'd probably use x1.1, x1.2, x1.3, etc.
worded it kind of wrong. what i meant was that after so many points, the rate at which your score increases for the current drift will go faster, and faster, but resets when the drift ends, lap ends, or you loose your speed or spin out.


EDIT: ok, i found an example of what i was looking for being used on 420 Driftwars. but IDK if the system they are using is LFS Lapper or not. if it is it has been modified quite a bit. i know how i can do what i want, its just going to take some time and i have to learn the 'button' format so i don't have to guess+check as much and constantly have to look at a reference for formatting.
Quote from erfrag :worded it kind of wrong. what i meant was that after so many points, the rate at which your score increases for the current drift will go faster, and faster, but resets when the drift ends, lap ends, or you loose your speed or spin out.

Apart from the multiplier that's exactly what will happen as standard.

One of the settings that you can configure (in Drifting Options section) is the $MinimumDriftSpeed - if the speed of your car falls below this (drifting or not), your score resets to zero (this may not show on the drift meter as it tends just to keep last score up regardless).

During a drift, the score increments as $LastDriftScore - if you want it incrementing faster use the multiplier - if you combine drifts (keep above minimum speed and in between min and max angles allowed), then the overall score is saved as $DriftScore. It's this $DriftScore that is saved at end of lap (or circuit of autocross).

That's why even though you may get some decent drifts during a lap, if you can't keep it all together till you get over the start/finish line, your lap score might be lower that some of the previous scores you got during the same lap.

Button format is easy - any of the lapper.lpr configs will have an explanation built in. For a drift meter, you could make some of it global buttons, but for the scores/angles, these should probably only be private buttons - unless your drivers are doing a layout one driver at a time.

If you look up a couple of posts, you'll see an explanation for who buttons are configured.
yes i under stand that. thanks for the info!
#23 - KIMA
Hello everyone, I have a black server, calling on him people are often not a registered member on the LFS and off site so they can not ban the game if such a prog that would ban them?
Any chance of some1 uploading this as an insim? With the drift meter already configured as i have no idea how to compile code. If possible change name to [LLM]Drifting
Quote :Any chance of some1 uploading this as an insim?

The DriftMeter is only small addition to the default LFSLapper.lpr configuration file.

If you follow the instructions in the posts, you should be able to add the Drifting section fairly easily.

FGED GREDG RDFGDR GSFDG