Skip to content

Update how to enable app and tell python version #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions ACAppTutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ Each of these contains at least one subfolder of interest:
`log.txt` is where AC logs everything about the execution of AC itself. Sometime this will contain relevant information about your application that AC logs automatically.
`py_log.txt` is where AC places strings explicitly requested to be logged by running applications.

### Python Version
Currently (AC 0.22) the Python version used is **3.3.0**

### Basic workflow

The workflow of testing an application isn't the best. It can be slow going when you're making a lot of changes, especially if you make syntax or logical mistakes. Try to be careful and ensure the code you're attempting to run is correct. You might want to look into something like pylint so you can find errors in the code without having to run Assetto Corsa.

If something is wrong with your code, and error message might show up automatically in the in-game console or in `py_log.txt`. It will always show up in `log.txt`. The best way to find an error in `log.txt` is by search for your application name, in this case `appName`, and reading the surrounding output.

I call an on-track event a session. I usually test in practise mode around a short track like silverstone-international, but it shouldn't matter what you choose.
I call an on-track event a session. I usually test in practise mode around a short track like silverstone-international, but it shouldn't matter what you choose. For easy task switching, you may disable the Fullscreen Rendering in Options-Video.

Here is how I test my application:

Expand Down Expand Up @@ -72,7 +75,9 @@ The code for your application will go in place of the ellipses. For now, we'll i

Actually, the bare minimum is probably just the return statement, but that application is not at all interesting.

If you run Assetto Corsa and start a session, you will find in the application sidebar an entry named `appName`. If you activate this, you will see a very basic widget consisting of a 200x200 application window with the name `appName` at the top. Here is what you should see in the application sidebar:
After creation of the App, you need to enable it. This can be done within the *Options-General* menu. The app will only be available in the widget bar, if it has been enabled here.

If you run Assetto Corsa and start a session, you will find in the application sidebar an entry named `appName`. The applications in the widget bar are ordered alphabetically, with the builtin apps in above the third party apps. If you activate this, you will see a very basic widget consisting of a 200x200 application window with the name `appName` at the top. Here is what you should see in the application sidebar:

![image](https://raw.github.com/ckendell/ACAppTutorial/master/images/sidebar.png?raw=true)

Expand Down Expand Up @@ -199,9 +204,9 @@ The Python API gives us access to some nice stuff, but there is a lot more than

* Add a directory within `/apps/python/appname/` with a name of your choice. I use `third_party`.
* Add into this directory `_ctypes.pyd` and `sim_info.py`.
See [Shared memory for Python applications (sim_info.py) for AC v0.20](http://www.assettocorsa.net/forum/index.php?threads/shared-memory-for-python-applications-sim_info-py-for-ac-v0-20.11382/) for where to obtain these files.
See [Shared memory for Python applications (sim_info.py) for AC v0.22](http://www.assettocorsa.net/forum/index.php?threads/shared-memory-for-python-applications-sim_info-py-for-ac-v0-22.11382/) for where to obtain these files.
* Insert the `third_party` directory into the python environment before using the import statement:
`sys.path.insert(len(sys.path), 'apps/python/appname/third_party')`.
`sys.path.append(0, 'apps/python/appname/third_party')`.
* Import from `sim_info.py` using `from sim_info import info`.

After doing so, you can get to any of the shared memory information using e.g. `info.physics.fuel`.
Expand Down