odwdinc / Python-SimConnect

Python interface for MSFS2020 SimConnect.dll
GNU Affero General Public License v3.0
270 stars 107 forks source link

AttributeError self.event = self.sm.map_to_sim_event(self.deff) #132

Open laurentQuarkfr opened 6 months ago

laurentQuarkfr commented 6 months ago

python 3.12

from SimConnect import *
from SimConnect.EventList import *
from SimConnect.RequestList import *

def trigger_event(event_name, value_to_use = None):
    EVENT_TO_TRIGGER = ae.find(event_name)
    if EVENT_TO_TRIGGER is not None:
        if value_to_use is None:
            EVENT_TO_TRIGGER()
        else:
            EVENT_TO_TRIGGER(int(value_to_use))
        print("success")
        return True
    else:
        print("Error: %s is not an Event" % (event_name))
        return False

sm = SimConnect()
ae = AircraftEvents(sm)
trigger_event('COM_STBY_RADIO_SET', dec_to_bcd(125.850))

trigger_event('COM_STBY_RADIO_SET', dec_to_bcd(125.850)) File "D:\SharedFolder\PythonProjects\MFS-WINWING\send.py", line 122, in trigger_event EVENT_TO_TRIGGER(int(value_to_use)) File "C:\Users\VHDX-DEFAULT\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\SimConnect\EventList.py", line 8, in call self.event = self.sm.map_to_sim_event(self.deff) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\VHDX-DEFAULT\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\SimConnect\sc.py", line 60, in getattr raise AttributeError