Welcome Message plugin

Discussion in 'Plugins' started by Tygernoot, Mar 11, 2012.

  1. Tygernoot

    Tygernoot Registered

    Joined:
    Feb 26, 2012
    Messages:
    114
    Likes Received:
    64
    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
     
    Last edited: Sep 16, 2019
    DanRZ, instinkt, Racecraft and 4 others like this.
  2. Fergy

    Fergy Registered

    Joined:
    Jan 12, 2012
    Messages:
    597
    Likes Received:
    26
    Great work Ed, fantastic:D I will add this asap and let you know know how it all goes.
     
  3. B1gch0pper

    B1gch0pper Registered

    Joined:
    Jan 11, 2012
    Messages:
    32
    Likes Received:
    0
    Hmmm, cant seem to get this going, nothing appears when i join server...
    Tried the WelcomeText.txt in all folders including creating a folder called WelcomeText in Plugins folder and sticking it in there but still nothing...
     
  4. Tygernoot

    Tygernoot Registered

    Joined:
    Feb 26, 2012
    Messages:
    114
    Likes Received:
    64
    Hmmm, probably a bug on my side then. I haven't really tested it under all conditions (only locally on my Win7 install running as administrator). Maybe something like UAC could block the process as well.

    The WelcomeText.txt should be in the main rFactor2 directory (e.g. E:\Games\rFactor2\WelcomeText.txt)

    So let's find out what the issue is. I built a 'debug' version which outputs some info to a WelcomeLog.txt stored in the rFactor2 root folder. If there's no WelcomeText.txt found, it now uses a default welcome message.

    Can you try with this version and see whether it works or what is output in the log file? I tested joining my own server but for quicker testing you can also add some AI cars.

    Here's an example output log where it's working on my PC:

    Code:
    Added welcome line: Welcome to the server!
    Added welcome line: Put your welcome text here...
    Added welcome line: Plugin made by Tygernoot :)
    Succeeded to open handle to the dedicated window (chat button)
    Succeeded to open handle to the dedicated window (chat edit)
    Driver joined the server: Emanuele Lavaggi
    Driver joined the server: Jack Bull
    Driver joined the server: Walter Crankshaw
    Sending message: /w Emanuele Lavaggi Welcome to the server!
    Sending message: /w Emanuele Lavaggi Put your welcome text here...
    Sending message: /w Emanuele Lavaggi Plugin made by Tygernoot :)
    Sending message: /w Jack Bull Welcome to the server!
    Sending message: /w Jack Bull Put your welcome text here...
    Sending message: /w Jack Bull Plugin made by Tygernoot :)
    Sending message: /w Walter Crankshaw Welcome to the server!
    Sending message: /w Walter Crankshaw Put your welcome text here...
    Sending message: /w Walter Crankshaw Plugin made by Tygernoot :)
     
  5. Fergy

    Fergy Registered

    Joined:
    Jan 12, 2012
    Messages:
    597
    Likes Received:
    26
    Works perfect for me. Really happy with it. Big well done.
     
  6. Denstjiro

    Denstjiro Registered

    Joined:
    Oct 6, 2010
    Messages:
    2,952
    Likes Received:
    14
    Not tested yet but this looks like a winner to me, great work and thx! :)
     
  7. B1gch0pper

    B1gch0pper Registered

    Joined:
    Jan 11, 2012
    Messages:
    32
    Likes Received:
    0
    Still cant get this little beauty working :(
    Tried both versions supplied above but nothing, no clue to it running atall, no created error log, im stumped...

    Are you guys running the server through the dedicated server application or through the launcher then 'Host'? As it seems they are different (even though ive tried both ways)
     
  8. Fergy

    Fergy Registered

    Joined:
    Jan 12, 2012
    Messages:
    597
    Likes Received:
    26
    Running a server. I'm not sure why it's not working for you. I assume your adding the Welcome file to the main directory? We could chat on teamspeak if you like. PM me if your you need some help.
     
  9. Tygernoot

    Tygernoot Registered

    Joined:
    Feb 26, 2012
    Messages:
    114
    Likes Received:
    64
    Strange that it's not working for you.

    I tested by running the dedicated server through the launcher ("Host" button). At work now, so can't check, but if you run the dedicated from the rFactor\Core folder, you most likely need to put the plugin in the rFactor\Core\Plugins folder if there is one.

    Do you have UAC enabled? If so, can you try with UAC switched off? Perhaps the file cannot be written in the rFactor directory due to UAC and I should put it in the user's Documents folder.

    Do other plugins work or is it just this one?
     
  10. Antaeus

    Antaeus Registered

    Joined:
    Jan 6, 2013
    Messages:
    198
    Likes Received:
    0
    on my PC also didn't work, UAC is off, running by Launch - Host

    tried 2 versions, and WelcomeText.txt put in main rF2 folder
     
  11. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    Plugin is only 36k - I'd check your build settings. Copy the ones from the example plugin, it'll probably end up closer to 100k and it'll work for more people.
     
  12. Tygernoot

    Tygernoot Registered

    Joined:
    Feb 26, 2012
    Messages:
    114
    Likes Received:
    64
    Hello,

    The plugin didn't work anymore since I hadn't updated it for the latest rFactor2 versions. I made a small change and it's working again.

    @Lazza: the reason it's so small is because I removed all the example code ;)

    Here is the updated plugin together with the source code. Maybe it can be useful for someone, plus this way someone else can also update it in case rF2 changes again (as I don't really follow rF2's development lately).

    Best regards,
    Tyger.

    View attachment 6546
    View attachment 6547
     
  13. Fergy

    Fergy Registered

    Joined:
    Jan 12, 2012
    Messages:
    597
    Likes Received:
    26
    Great work Tyger, thank you:)
     
  14. Adrianstealth

    Adrianstealth Registered

    Joined:
    May 28, 2012
    Messages:
    4,578
    Likes Received:
    1,071
    Great!

    But what does it do?

    Give a welcome message to people joining an online server ?
     
  15. Paul Swire

    Paul Swire Registered

    Joined:
    Jan 21, 2012
    Messages:
    168
    Likes Received:
    6
    Thanks Tygernoot.

    Works perfectly :D
     
  16. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    Ok, see how it goes I guess. My motec plugin was 40k until it didn't run for lots of people...
     
  17. Antaeus

    Antaeus Registered

    Joined:
    Jan 6, 2013
    Messages:
    198
    Likes Received:
    0
    still dont work.. i run dedicated server on Win Server 2008

    maybe i must install something?
     
  18. TIG_green

    TIG_green Registered

    Joined:
    Jul 21, 2012
    Messages:
    3,038
    Likes Received:
    44
    How is this different from putting a welcome text into multiplayer.ini file?
     
  19. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,346
    Likes Received:
    6,572
    Try this: View attachment WelcomePlugin_v1.1_newbuild.zip

    That's using the exact same source code but with the standard build options... so it doesn't rely as much on your system having some things (hence being bigger). No guarantee it'll work though ;)

    Well for one thing it allows multiple lines...
     
  20. TIG_green

    TIG_green Registered

    Joined:
    Jul 21, 2012
    Messages:
    3,038
    Likes Received:
    44
    oh, did not know. Thanks.
     

Share This Page