#
Modules
#
MapUtils
This module also requires the TruckSimAPI module to be enabled!
The Map plugin also has to be enabled to load the map data!
This module provides information about the closest item to the given coordinates. It will give the following data:
The run()
function has the following inputs:
X coordinate of the item to check.
Y coordinate of the item to check.
Z coordinate of the item to check.
This is only meant to be used by the Map plugin, it already has access to the closest roads so the module doesn't need to calculate it again.
This is only meant to be used by the Map plugin, it already has access to the closest prefabs so the module doesn't need to calculate it again.
#
Raycasting
This module also requires the TruckSimAPI module to be enabled!
The user has to be in the interior view for this plugin to work!
This plugin has a major flaw. It will only raycast to an imaginary plane originating from the bottom of the truck. If you are on stable ground, while the object to raycast is on a slope, the raycast will output the wrong position. This is mostly a limitation of performance.
This module provides a raycasting interface for the game. Just give it the X and Y screen coordinates and it will give you a position back.
The module will return a RaycastResponse
object with the following data:
The run()
function has the following inputs:
Screen X coordinate from the top left.
Screen Y coordinate from the top left.
#
ScreenCapture
This module provides a simple ScreenCapture interface. It will automatically switch between windows_capture, bettercam and MSS depending on the PC it's running on.
The run()
function has the following inputs:
This can be one of the following:
- both
- cropped
- full
If the variable is not set, it will default to both
.
If the variable is set to both
, the run()
function will return two np.arrays, first one is the cropped image, second one is the full image.
if the variable is set to cropped
, the run()
function will return only the cropped image.
if the variable is set to full
, the run()
function will return only the full image.
The module also has the following global variables:
#
SDKController
You should probably not use this module without asking us first, using the module in multiple plugins at the same time will cause them to constantly overwrite each other's values.
This module provides an interface to perform controller actions in the game. We hook directly into SCS's controller API.
You use the module by doing the following in your code:
from ETS2LA.modules.SDKController.main import SDKController as Controller
from typing import cast
def Initialize():
global SDKController
SDKController = runner.modules.SDKController
SDKController = cast(Controller, SDKController)
def plugin():
SDKController.steering = 0.0 # You can set floats
SDKController.wipers = True # You can also set bools
Please check the following page to see all the available variables:
#
ShowImage
Will show a given image on the screen. Also supports showing overlays on top of said image (used by the Steering module to show the steering line).
The run()
function has the following inputs:
The image to show.
The name that the window will be given.
The module also has the following global variables:
Example of how to add an overlay:
image = np.zeros((1080, 1920, 3), np.uint8)
ShowImage.overlays["test_overlay"] = image
#
Steering
This module requires the TruckSimAPI if not IGNORE_GAME
, ShowImage if drawLine
and SDKController modules to be enabled!
This module provides an easy way to send steering input to the game. It also handles smoothness sensitivity etc...
The run()
function has the following inputs:
The steering value to set, can also be None to reset the steering.
If the steering value should be sent to the game. (this can be used to enable / disable the steering)
If the steering line should be drawn with the ShowImage overlays
Whether the drawLine text should be drawn.
The module also has the following global variables:
#
TruckSimAPI
Provides information from the game. This module is required by basically all other modules and plugins.
Note
Below is a list of all the data we have from the game. The top left value is the key, for all keys but root you need to use data[key]["value"]
to get the value.
Example: data["truckFloat"]["speed"]