How to recognize teleporting to pits in Python?

Discussion in 'Apps' started by JBreak, Aug 1, 2021.

  1. JBreak

    JBreak New Member

    Joined:
    Nov 22, 2020
    Messages:
    8
    Likes Received:
    0
    I have built an app that records hotstints. You select the duration (3, 5, 10, 20 etc laps) and drive an outlap after which the app starts recording your times for the stint. Currently the stint is terminated once you enter the pitlane, and a new stint is started when you exit. It is simple and straightforward but I was thinking it would be nice to allow the driver to do pitstops in the middle of the stint. It would be interesting to try different strategies for longer stints.

    But if I allow pitstops (in other words), then I should account for the player teleporting to pits in the middle of the stint (pressing esc and selecting "back to pits"). However, I could not find information anywhere on how to recognize this event in the app. I could come up with some hacks to try to guess when this happens from the sudden change of location etc. but none seem too reliable or practical.

    Does anyone know on how to best recognize when the player teleports to the pits in a Python app? I feel I might be missing something obvious...
     
  2. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,125
    Likes Received:
    383
    Its in AC's SharedMemory, read it with "sim_info.py", i.e. InvalidateApp uses it too.

    iirc you should use
    siminfo.graphic.isInPit

    (and not
    siminfo.graphic.isInPitLine)
     
  3. JBreak

    JBreak New Member

    Joined:
    Nov 22, 2020
    Messages:
    8
    Likes Received:
    0
    Perhaps I should elaborate, I want to tell when the player teleports to the pits instead of driving there. If the player teleports, they take a shortcut which should invalidate the stint. Also I thought it would be a handy way to restart the stint intentionally if the player teleports back. I am trying to keep buttons and such to a minimum on the UI.
     
  4. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,125
    Likes Received:
    383
    That should happen just like that, you dont get lap invalid when you click back to pits? Then maybe something is setup wrong on this track or it doesnt work in practice ... .

    Unfortunately there is no such property as "playerTeleported"
     
  5. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,125
    Likes Received:
    383
    maybe you can check for those:

    Code:
    pitlimiter = False
    
    def acUpdate(...):
      # maybe do this in timed intervalls
      if info.physics.pitLimiterOn:
        pitlimiter = True
      else:
        pitlimiter = False
    
      if info.praphics.isInPit and not pitlimiter:
        stintinvalid = True
    
     
  6. JBreak

    JBreak New Member

    Joined:
    Nov 22, 2020
    Messages:
    8
    Likes Received:
    0
    These both look interesting. Thanks, I'll try these :)
     
: Question
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice