Begining with app development

Discussion in 'Apps' started by Guillermo, Nov 24, 2015.

  1. Guillermo

    Guillermo New Member

    Joined:
    Nov 19, 2015
    Messages:
    4
    Likes Received:
    3
    Hi everybody.

    I was trying to make my fist and very simple app for assetto, but I'm having a very anoying issue so I'm assuming I'm doing something wrong but I can't see where or wath.

    I have read the python doc thread and follow this tutorial

    https://github.com/ckendell/ACAppTutorial/blob/master/ACAppTutorial.md

    But If I try to do anything more, like read the parameter ThermalState, the app get the error: "ERROR LOADING MODULE..."

    Right now I don't have any example of code to show, but my thoughts is that the python doc is not updated, Am I right?

    I'm going to writte a little app and post it there so you could tell me what I'm doing wrong.

    See you...
     
    assettocorsamods likes this.
  2. ihlades

    ihlades Administrator Staff Member

    Joined:
    Sep 19, 2014
    Messages:
    162
    Likes Received:
    114
    Location:
    Bucharest, RO
    Hi, when you'll post some code that isn't working I'll try to help you. ;)
     
  3. Guillermo

    Guillermo New Member

    Joined:
    Nov 19, 2015
    Messages:
    4
    Likes Received:
    3
    Thanls pal. :)
    If I could get some free time I'll do it
     
  4. Guillermo

    Guillermo New Member

    Joined:
    Nov 19, 2015
    Messages:
    4
    Likes Received:
    3
    So, I have make the simplest app in the world.
    The first part which laps are counted, it's a copy paste form the tutorial I posted yesterday.
    Add a RPM counter is the easiest thing in the world but I just get "Python [ERROR] Error Loading Module: sys.path.append('apps/python/showme')"

    Code:
    import sys
    import ac
    import acsys
    
    
    l_lapcount=0
    lapcount=0
    l_Revs=0
    
    def acMain(ac_version):
        global l_lapcount
    
        appWindow = ac.newApp("showme")
        ac.setSize(appWindow, 200, 200)
    
        l_lapcount = ac.addLabel(appWindow, "Laps: 0")
        ac.setPosition(l_lapcount, 3, 30)
    
        l_Revs = ac.addLabel(appWindow, "RPM: 0")
        ac.setPosition(l_Revs, 3, 50)
    
        return "showme"
    
    def acUpdate(deltaT):
        global l_lapcount, lapcount, l_Revs
    
        laps = ac.getCarState(0, acsys.CS.LapCount)
        if laps > lapcount:
            lapcount = laps                    
            ac.setText(l_lapcount, "Laps: {}".format(lapcount))
           
        Revs = ac.getCarState(0, acsys.CS.RPM)
        ac.setText(l_Revs, "RPM: {}".format(Revs))
    
    Maybe it's just syntax problem due to lack knowleg of python, but the syntax is very simple and add a label and read a value is trivial, but no way...I'm doing something really wrong and I can't see.
     
    ACDT likes this.
  5. Guillermo

    Guillermo New Member

    Joined:
    Nov 19, 2015
    Messages:
    4
    Likes Received:
    3
    Ok, I have found one of my problems, I'm identing code with TABs, and python don't like TABs :banghead:
    kyle 1-1 Python :D

    Round 2:
    I can't read any data from acsys or SimInfo(), but the lapcount.
    So what am I doing wrong?
    Code:
    import sys
    sys.path.insert(0, 'apps/python/showme/dll')
    import ac
    import acsys
    import math
    from libs.sim_info import SimInfo
    
    sim_info = SimInfo()
    
    l_lapcount=0
    lapcount=0
    l_Revs=0
    Revs=0
    l_Gear=0
    Gears=0
    l_Compound=''
    Compound=''
    
    def acMain(ac_version):
        global l_lapcount
    
        appWindow = ac.newApp("showme")
        ac.setSize(appWindow, 200, 200)
        l_lapcount = ac.addLabel(appWindow, "Laps: 0")
        ac.setPosition(l_lapcount, 3, 30)
        l_Revs = ac.addLabel(appWindow, "RPM: 0")
        ac.setPosition(l_Revs, 3, 45)
        l_Gear = ac.addLabel(appWindow, "Gear: 0")
        ac.setPosition(l_Gear, 3, 60)
        l_Compound = ac.addLabel(appWindow, "Tyre: none")
        ac.setPosition(l_Compound, 3, 75)
       
        return "showme"
    
    def acUpdate(deltaT):
        global sim_info, l_lapcount, lapcount, l_Revs, l_Gear, Revs, Gears, l_Compound, Compound
       
        laps = ac.getCarState(0, acsys.CS.LapCount)
        if laps > lapcount:
            lapcount = laps                    
            ac.setText(l_lapcount, "Laps: {}".format(lapcount))
        Revs = ac.getCarState(0, acsys.CS.RPM)
        ac.setText(l_Revs, "RPM: {}".format(Revs))
        Gears = sim_info.physics.gear
        ac.setText(l_Gear, "Gear: {}".format(Gears))
        Compound = sim_info.graphics.tyreCompound
        ac.setText(l_Compound, "Tyre: {}".format(Compound))
    
    def acShutdown():
        ac.log("Shuttingdown showme")
        ac.console("Shuttingdown showme")
    
     
    ACDT likes this.
  6. ACDT

    ACDT New Member

    Joined:
    Jul 6, 2018
    Messages:
    4
    Likes Received:
    0
    hi if i wanted to make a app wich is like a parking sensor so when somone is near me it will fire off a beep or maybe indacate with a png light :) only its for drifting i hate hiting walls n well this is the app ima try make :) also mayeb have levels of difrent beeps or lights for how close u are
     
  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