How do I know from a plugin code when user enters and exits a session? (Delta Best)

Discussion in 'Plugins' started by cosimo, Jun 29, 2014.

  1. cosimo

    cosimo Registered

    Joined:
    Apr 14, 2013
    Messages:
    827
    Likes Received:
    99
    I have this problem in the Delta Best plugin code.

    I have come to realize I don't know when the user enters or exits a session.
    That is, if I start rF2, click "Race" and then go from the monitor screen to driving, I get the "Enter Realtime" event.
    Then if I type "ESC" to exit and go back to the monitor, I don't get any "Exit Realtime" event.

    Moreover, if I go back to the car/track selection screen, choose car/track and click Race again and then drive,
    I don't get any other "Start Session" or "Enter Realtime" events...

    Ideally I would need that to reset the current best lap and start clean in the new session.

    I figured I could do the same checking the current track/car name in the UpdateScoring() method, but those
    enter/exit events are there for a reason.

    Any ideas?
     
  2. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    From my side, i use also the EndSession API method to clean my data.

    For information, when you are in a session, and you do ESC + Restart Session -> the endSission is not called, just the StartSession is called.

    So, i clean information in the StartSession, and the EndSession API method.

    If it is not suffisant for you, you can check ScreenInfoV01 and if info.mOptionsLocation < 2 you are before a track is loaded
     
    Last edited by a moderator: Jun 29, 2014
  3. cosimo

    cosimo Registered

    Joined:
    Apr 14, 2013
    Messages:
    827
    Likes Received:
    99
    Gerald, I do clean up my data in StartSession. The problem is that I can load a different car/track and start driving and no StartSession event will be generated (that I can see, maybe I'm doing something wrong).

    I'll definitely check out ScreenInfoV01 and mOptionsLocation. Thanks for that!
     
  4. magicfr

    magicfr Registered

    Joined:
    Jan 4, 2012
    Messages:
    332
    Likes Received:
    27
    hi, from my test this W.E. the exit real time was called when going back to "pits" , i.e. when player was hitting ESC.
     

Share This Page