Welcome Message plugin

Hello,

Introduction
This plugin sends a whispered welcome message to drivers entering the dedicated server. It does so by finding the associated dedicated server window, entering the chat message and sending it. It can be used to provide links to a website, to give a brief explanation of the rules, or just to welcome anyone entering the server.
Additionally it allows setting weight penalties automatically for drivers entering the server, either based on the driver name or the vehicle class.

Installation
- put the WelcomePlugin.dll file in the rFactor2 Bin64\Plugins folder (in case of 64-bit) or Bin32\Plugins folder (in case of 32-bit)
- put the WelcomePlugin.json file in the rFactor2 profile folder (or simply create one)

Usage
Put the welcome and weight information in the WelcomePlugin.json file. The file has to following format:

Code:
{
    "DriverMassOptions": {
        "DriverX": 15,
        "DriverY": 25,
        "[ABC] DriverZ": 25,
    },
    "VehicleMassOptions": {
        "Class1": 10,
        "Class2": 15,
        "Class3": 25
    },
    "WelcomeText": [
        "Line1",
        "Line2",
        "Etc",
        "It is not recommended to put more than 5 lines for performance reasons",
        "The maximum length for each line is 95 chars, the rest will be truncated"
    ],
    "SendWelcomeTextEverySession": true
}

- Place any vehicle class names in the "VehicleMassOptions" list with the associated weight penalty. Leave an empty list or remove the "VehicleMassOptions" section entirely if you do not want to assign weights based on the vehicle class.
Note: the vehicle class is the name that is displayed in-game, i.e. the "Category" in the .veh file.
- Place any drivers in the "DriverMassOptions" list with the associated weight penalty. Leave an empty list or remove the "DriverMassOptions" section entirely if you do not want to assign weights. The driver weight overrides the vehicle class weight in case both are set and apply to the driver.
- Place the welcome text in the "WelcomeText" list. The maximum length per line is 95 chars (taking the maximum driver name length of 32 into account). If you put longer text it will be truncated by the game.
- Set SendWelcomeTextEverySession to true to have the welcome chat sent every session change. Set it to false to have it sent only when joining the server.
- Geeky note: if there are any particular extended ascii characters such as "éàáç@€" in the driver names (e.g. see http://www.ascii-code.com/, any character in the range of 128-255), be sure to encode the file as ANSI and not UTF8 or other. This is because rFactor only supports ANSI encoding and not UTF8, which is often the default file format.

Known issues
- When typing a message in the dedicated server chat at the same time a driver enters, your chat is restored but the chat edit loses focus while it's sending the welcome messages. You have to click in the chat again to continue typing.
- Not really known issue, but per design: the WelcomePlugin.json file is reloaded every session switch for any changes.
- The plugin is untested with rFactor in other languages than the default English.
- The plugin obviously only works for dedicated servers.

Enjoy!
Tygernoot.

v2.3 Plugin files (32-bit): http://www.tyka.net/racepad/downloads/WelcomePlugin_2.3.1_x86.zip
v2.3 Plugin files (64-bit): http://www.tyka.net/racepad/downloads/WelcomePlugin_2.3.1_x64.zip
v2.3 Source code: http://www.tyka.net/racepad/downloads/WelcomePlugin_2.3.1_source.zip

Latest update: 16 September 2019 - Added VehicleMassOptions to set weight based on class

Hi there Tygernoot! Only just got this working, know its been out ages. Just wanted to say Thankyou V much mate!
 
Sorry for the "feature request" but it would be nice to have a non-whispered message option that is sent to chat at the start of every session.
/w messages & weight penalties could be sent on user join
And another more generic (non-whispered) message could be sent once at the start of every session.
 
Does anybody else have a problem where the welcome plugin will intermittently fail to apply ballast with more than 10-ish drivers (AI or human)? It will work for some drivers but not others.
 
Does anybody else have a problem where the welcome plugin will intermittently fail to apply ballast with more than 10-ish drivers (AI or human)? It will work for some drivers but not others.
The main reason I can think of for not working is that the driver names in the plugin not matching the drivers ingame name. Check the results .xml file for the drivers names that are affected and see if they match. Some human drivers manage to put a trailing space after their name.
 
Yah, I've run into the trailing space issue and have verified all of the names.
This isn't a problem with fewer than 10-ish drivers present. As long as we're under that number, the ballast is automatically applied normally.
Above that number (again, either with human drivers or AI drivers or a mix of the two), ballast is only automatically applied to some drivers. I can manually apply the ballast using /setmass directly or invoking a /batch file.
 
Yah, I've run into the trailing space issue and have verified all of the names.
This isn't a problem with fewer than 10-ish drivers present. As long as we're under that number, the ballast is automatically applied normally.
Above that number (again, either with human drivers or AI drivers or a mix of the two), ballast is only automatically applied to some drivers. I can manually apply the ballast using /setmass directly or invoking a /batch file.

I have a similar problem. We never have more than ten drivers having success ballast(BTCC rules) but have regularly 20+ drivers joining our server, so everybody always get their success ballast set.
But, when I add additional welcomeText to the WelcomePlugin.json some(of the ten) drivers are starting to NOT get their success ballast, so I assume this is a performance issue. Make sure to use the plugin ONLY for success ballast(not also for welcome message) and see if that fixes your problem. If that is already your case, then I don't know any workaround other than upgrading your server hw, or convince the authors to optimize the code.
 
Jason sent me a PM a while ago about this issue, but I haven't looked into it yet. I have sort of given up on rFactor (and sim racing altogether) for the last year or two, so not really active in doing any plugin work for it either.

The source is available in the first post though, so if anyone feels like compiling a new version, here's something perhaps worth trying.

Instead of programmatically clicking the GUI button every UpdateScoring() tick, do it only every 3 ticks or so.

Code:
void WelcomePlugin::UpdateScoring( const ScoringInfoV01 &info ) {  
    if(WLC_hwndSendChatButton && WLC_hwndChatEdit) {
        m_nScoringCounter++;
        if(m_messageQueue.size() && ( m_nScoringCounter % 3 == 0 ) ) {     // update this if()
            DriverQueueMessage qMessage = m_messageQueue.front();
              ...

Otherwise, I can have a look if the plugin still compiles on my latest machine/setup.

Best regards,
Ed.
 
Whilst I (now) appreciate that this is no longer being actively supported, does anyone know why multi-line messages in the WelcomeText section have started to appear in client chat boxes out of sequence?

…and as a workaround, would fewer, longer lines of text with embedded carriage-returns allow a bit more control?
 
Hello, anybody knows if the mass penalty system works on this plugin ?
Looks like my "Vehicule CLass Name" is Wrong ... what should i use ?
And where can i get the very last version ? I've got antivirus alerts on some links ...
Thanks.
 
Last edited:
Hello, anybody knows if the mass penalty system works on this plugin ?
Looks like my "Vehicule CLass Name" is Wrong ... what should i use ?
And where can i get the very last version ? I've got antivirus alerts on some links ...
Thanks.
Worked well last time I played with it, are you using the “Category” from the veh file as your class?
BD7ED37B-5521-45E1-8DA8-2A4845E685D0.jpeg
 
Thanks, didn't read that properly ...
For example, i should use "Ferrari, Ferrari 488 GTE" full with the comma ?
Or "Ferrari 488 GTE" is enough ?
 
Last edited:
I can't remember which one the game reads first, (I think it's the first entry) so I'd try with just "Ferrari" and if that doesn't work try the "Ferrari 488 GTE"

Edit: the log analyser shows the category as "Ferrari"
 
Do i have a message on console when it works on a class ?
Both categories doesn't seem to work.

By name i get the log on the chat console and it works with 200 kg.
But i can't make it work by class ...
 
Last edited:
ok GTE works;
in the welcome.json;
upload_2022-11-14_14-17-39.png


When I join with Ferrari GTE, on server screen;

upload_2022-11-14_14-18-29.png


and ingame message as well
 
Did a little bit of testing and it looks like that it's reading the first entry in the Class line in the .veh file, ie Line 39.
upload_2022-11-14_14-46-39.png


Dan, check in your server's ....userdata/player folder for a file called WelcomePluginLog.txt. Open it and check if there is an "error parsing json file" line. I had this when I grabbed a brand new download from page one.... I ended up copying the contents from a server I admin and pasted in and all worked then. Details of what I pasted in;
Code:
{
   "DriverMassOptions": {
       "DriverX": 15,
       "DriverY": 25,
       "DriverZ": 25
   },
   "VehicleMassOptions": {
       "GTE": 10,
       "Class2": 15,
       "Class3": 25
   },
   "WelcomeText": [
       "Welcome ",
       "Discord ",
       "Live Races ",
       "Log Analyser ",
       "Teamspeak "
      
   ],
   "SendWelcomeTextEverySession": false
}
 
Thank you, i appreciate, i'm trying to make a "lazy BOP" but i struggle.

I want to add X kilograms to the F488 GTE and Y kilograms to the Aston GTE. I can't use GTE class because they both have the same first category and so they will have the same penalty ... but X and Y are differents.

I think i'm screwed or i will need to modify the plugin ...

Or maybe i need to not add the GTE category when starting server in cars choice. I will try using all other possibilities only.

Mass penalty by user name works perfectly.

For the setups fixed i had to use "GTE GTE_FERRARI_488" maybe i need to use the all thing with blanks like in assigned setups ... I will try too.

It would be cool to have a log option that lists the options of all players at connexion, like name, class ... that can be used in the json.
 
Last edited:
I'm finally recompiling the plugin and using vehicule name instead of class which is "GTE" :confused:.
Now i have "Ferrari 488 GTE #51" but i remove the " #51" and get some kind of generic car name ...

And now my json is :
Code:
    "VehicleMassOptions": {
        "Aston Martin Vantage GTE": 30,
        "BMW M8 GTE": 0,
        "Ferrari 488 GTE": 60,
        "Porsche 991RSR GTE": 15,
    },

And it works perfectly ... just need to check all veh files to get all vehicle names ...
 
Last edited:
Back
Top