• Dear visitors,

    The email issue has been finally solved.
    Thank you for your patience and happy browsing.

    Team ACM.

QUESTION How to get max gears of a car in python?

FitbyBit

New Member
I'm trying to figure out how to get "max gears" value for a car.
This AC API document describes "Gear" property, but there is no kind of "MaxGears" property.

Code for getting a current "Gear":
Code:
current_gear = ac.getCarState(ac.getFocusedCar(), acsys.CS.Gear)
Is there a way to get max gear's value?
 

LilyanaCarney

New Member
You can use the following code to get the maximum number of car gears in Assetto Corsa:
max_gears = ac.getCarState(ac.getFocusedCar(), acsys.CS.GearNumGears)

This property GearNumGears returns the maximum number of gears for the car. You can then use this variable for any needs in a future script.
 

fughettaboutit

aka leBluem
when i try this (ingame oc):

Code:
import ac, acsys, traceback
try:
  max_gears = ac.getCarState(0, acsys.CS.GearNumGears)
except:
  ac.log('error : ' + traceback.format_exc() )
this comes up in the log:
Code:
AttributeError: type object 'CS' has no attribute 'GearNumGears'
dont use ChatGPT for everything
snippet from "...steamapps\common\assettocorsa\apps\python\system\acsys.py"
there is no "GearNumGears" indeed
upload_2023-3-21_13-17-17.png
 
Last edited:
Top