The online racing simulator
Handicap system
After a long time, I got back into Lapper coding again and this is my first project to show for it. Since the original lapper can't set handicaps based on a car + a class a driver is in, I decided to make my own system for that. At the beginning it was just a static addon, which would still require the server admin to set the values manualy, but then I added a nice dynamic GUI to it which I extended further tonight.

The system can handle 4 different classes and a maximum of 3 cars, where every class can have its own added mass and/or intake restriction. All settings are live, so as soon as you change a value, it is active. The form is made dynamicly, so when you raise or lower the number of classes and/or cars the needed buttons are drawn or removed.

Tonight I released V1.02 , V1.03 and V1.04:

-------------------------------------------------------------------------

V1.00:

Initial release

V1.01:

- Added the basic GUI

V1.02:

- Added button to clear the whole form

V1.03:

- Given car names are checked if they exist
- Mass values can't be added when no car is selected
- Given mass value can't be higher then the maximum of the selected car
- When car name is changed, values for mass are reset

V1.04:

- Added 2 buttons to set all values for mass / intake to zero

-------------------------------------------------------------------------

There are a few more things I would like to add and the program has to be tested for bugs, so I am not releasing the code just yet. Let me know if anyone is interested, or if you have questions about or ideas for it.
Attached images
Capture1.PNG
Capture2.PNG
Hi Yisc

Glad you're getting back into things.

I'm not at all into the handicap/restriction type of racing, so can't really comment on what you are doing.

However, I'm very surprised that some servers/leagues don't use a weight handicap system that is used in real racing, in that drivers of a race who get a podium place are given a weight penalty - the higher the place, the heavier the weight. If you get on the podium for a few races, then you increase the penalty.

I found this, which might explain better:

Quote :How do the handicap weights work?
Cars which finish in the top three in either the GT1 or GT2 classes are awarded penalty weight. In GT1, they get 40kg for a first-place finish, 30 kg for second and 20 kg for third. In GT2, these weights are halved, so they get 20 kg, 15 kg and 10 kg respectively. Cars which finish from 4th and under progressively lose any penalty weight they might have accumulated. A 4th place finish loses 20 kg in GT1, with a loss of 30 kg in fifth place, and 40 kg are removed for sixth place onwards. The maximum weight that can be carried is 100 kg in GT1, or 50 kg in GT2. If a car carrying the maximum wins a race, they are given a 'supermaximum' of 150 kg in GT1 or 75 kg in GT2.
Penalty weight is also awarded for cars which may miss a race, or for race-by race entries.

Maybe an automatic weight penalty system can be added to your coding as an option to the manual changing that can be done?

Assuming anyone, especially you, would want such a thing.

Or should they be kept as 2 different systems?
Attached images
Poss handicap system.PNG
I might be added to the current system, although this was mainly created to facilitate races for Absolute-Beginners.nl who rank their drivers after each season and put them into classes, named /1 /2 /3 /4. People put that code at the end of their nicknames and my new system then finds the correct handicap by searching that tag + the car people are driving in.
Made another update for the handicap system today.

V1.05

- Added button to Force handicap(s) (Handicap settings of each connected player will be checked and if not matching handicap settings, player will be spectated)
- Expanded the number of classes from 4 to 5
- Expanded the numer of cars from 3 to 4
- Fixed a bug in Set all mass to zero function
Attached images
Capture.PNG
any way for this to be coupled with Tim NL's multiclass system?
I don't know what Tim his system is.
Maybe something very similar to what I made.
I haven't seen it and can honestly say I made this system on my own.
Where can we download it?
Quote from misiek08 :Where can we download it?

I've attached the script to this posting.
Dowload the handicap.txt file, rename it to handicap.lpr and put it in the includes directory of Lapper.

You also need to add a couple of things to the main Lapper script:


Event OnLapperStart()
OnLapperStart_Handicap();
EndEvent

Event OnConnect() # Player event
OnConnect_Handicap();
EndEvent

Event OnNewPlayerJoin()
OnNewPlayerJoin_Handicap();
EndEvent

Event OnDisConnect() # Player event
OnDisConnect_Handicap();
EndEvent

Event OnMSO( $text ) # Player event
SWITCH( $command )
CASE "!hcs":
IF( UserInGroup( "admin", $userName ) == 1 )
THEN
AB_Handicap ( 0,0 );
ELSE
privMsg(langEngine( "%{main_notadmin}%" ));
ENDIF
BREAK;
ENDSWITCH
EndEvent

####################
#Overriding options#
####################
include( "./../includes/handicap.lpr");

Attached files
handicap.txt - 89.8 KB - 351 views
This afternoon I further improved my handicap system, which resulted in version 1.06

V1.06

- Added a check to see if people have the class stated in their nickname


-------------------------

Question for other programmers within Lapper. First I entered the class people have in their nicknames into the $user_array , this is working okay in the OnConnect event but when reading that value in the OnNewPlayerJoin event, it takes the previous entered value. It seems like those events are ran simultaneously and therefor not use the latest information added into the array. After searching for this (what I believed) bug in my own code for 3 hours, I came to the conclusion that my code was right and Lapper doesn't handle those events properly. Has anyone else came across this problem? I have to mention that I still use Lapper 5.846, so it could be solved in a higher version.
Attached files
handicap.txt - 91.1 KB - 316 views
V1.07

- Fixed a bug when people already connected to server, changed their nickname

It is important that the whole class is written in the same color code, for example:

^9/3

When the / and the class (3 in this example) have a seperate color code, the system fails. This will be fixed once I move over to the latest version of Lapper in which I can use the stripcolor function.
Attached files
handicap.txt - 91.2 KB - 329 views
V1.08

- Fixed a bug in the Force handicap subroutine
- Added option to save values (HCS_[name of the server])
- Added option to load saved values
Attached files
handicap_5846.txt - 97.3 KB - 363 views
Although this thread is old and hasn't been updated in years, this still would be the right place to mention the a new version of this script.
So here is the BETA for the 'Handicap system' module.

This script can ONLY be used in combination with the 'Set Schedule' module.
Compared to the last version of the 1.x series, the script went from 4113 lines of code to 1440 lines of code, which is a huge improvement.

Handicap system V2.00.1 BETA (compared to version 1.15)

-Fixed a bug about not closing buttons when switching from using no subclasses to using subclasses
-Renamed sub 'config_class_indicator' to 'config_class_indicator_input'
-Merged sub 'config_class_indicator_fws' and 'config_class_indicator_pipe' into one sub 'config_class_indicator'
-A lot of code has been re-written to make it more efficient
-Added a field to show which cars are used in the race with that Race ID
-Added a button and routine to copy handicap settings from another Race ID to the current Race ID
-Added check to make sure a car name is only entered once into the handicap settings of a race
-Added a button to delete all handicap settings for the selected Race ID
-Added a check to prevent people from using a * as class indicator (* is used to seperate data when being stored)

Change the extension of the file to .lpr and add it to addonsused.lpr to be able to use it.
Attached files
hcs.txt - 53.2 KB - 272 views
This update has been out for years, but never made it to this forum.
Better late than never they say, so here it is.

Handicap system V2.00.2 BETA

-Removed -WHILE-loop in sub 'handicap_gui_force' and replaced it with a FOREACH-loop

Change the extension of the file to .lpr and add it to addonsused.lpr to be able to use it.
Attached files
hcs.txt - 53.6 KB - 221 views
Quote from Yisc[NL :;1954184"]This update has been out for years, but never made it to this forum.
Better late than never they say, so here it is.

Handicap system V2.00.2 BETA

-Removed -WHILE-loop in sub 'handicap_gui_force' and replaced it with a FOREACH-loop

Change the extension of the file to .lpr and add it to addonsused.lpr to be able to use it.

Been trying it out lately, but it doesn't seem to work anymore in 0.6U+. It just keeps saying this:
Quote :You haven't set your class and will...therefor not be able to race here
Put class number |1 behind your nickname. Use |1 if it's your first season

Was really looking forward to using this.
FYI, I have tried writing |1 in my nickname behind and after, but neither of those work. None of the combinations or prefixes work either.
The problem is not with LFS but with the latest releases of Lapper, which is the reason I am still running version 7.0.4.10 on my servers.
BassDriver knows about the issue, but it's a difficult one to tackle.
I will see if I can post an adjusted version here, that runs on the latest Lapper version.
Hello,

Could you test the follow change:

-Change "^s" to "/".
-Change "^v" to "|".

Because the encoding code, i took from insim.net fixed the japanese character bug. But i think it also read the "actual characters" instead of the previous (caret/circumflex (^)) methode of reading the "special characters".

FGED GREDG RDFGDR GSFDG