Skip to content

CSP Lua Apps

CheesyManiac edited this page Jun 24, 2024 · 5 revisions

Possible Manifest Values:

[ABOUT]
NAME = AppNameHere
AUTHOR = AuthorNameHere
VERSION = 1.0
DESCRIPTION = DescriptionHere
URL = LinkToAppSource
REQUIRED_VERSION = BuildID	; The minimum required CSP version ID that this app requires in order to work
[CORE]
PREPROCESS = 1 	; (0 or 1) Temporary option forcing Lua preprocess on, for testing
LAZY = FULL  	; Possible values:
			; • NONE (or 0, default value): load script when Assetto Corsa is loading, run it until it’s closed
			; • PARTIAL (or 1): load script only when app is first opened, after that keep it running until Assetto Corsa is closed.
			; • FULL (or 2): load script when app is opened, when all windows are closed, unload an app completely.
			; Note: when app unloads, all of its internal state (apart from stored with things like `ac.Connect()`, 
			; `ac.storage()` or `ac.store()`) is completely lost. That is why sometimes it might make more sense to
			; use partial laziness and unload app manually on closing (for example, if your app has manual saving
			; and a user closed or hid window without saving).

FLAGS = value		; Currently available values:
			; • DISABLED_OFFLINE: disables and hides the app when in an singleplayer (offline) session.
[WINDOW_...]
ID = WINDOW_ID          ; defaults to section name
NAME = Window Name      ; shown it title bar of a window and in taskbar
TAGS = list, values	; I honestly don't know
DEFAULT_POSITION = X, Y ; Default location (in pixels) of where the app is displayed on first open (scaled by UI scale in CSP)
BACKGROUND_COLOR = value;
SIZE = width, height    ; default window size in pixels (can be scaled based on global UI scaling parameter)
MIN_SIZE = 40, 20       ; minimum window size
MAX_SIZE = ∞, ∞         ; maximum window size
PADDING = X, Y          ; if set, overwrites default window padding
FLAGS = …               ; window flags separated by comma:
                            ; • MAIN: makes window act like main window (if not set, first window gets that role)
                            ; • SETTINGS: adds settings button next to collapse and close buttons in title bar, opening settings window
                            ; • AUTO_RESIZE: automatically resizes window to fit its content
                            ; • FIXED_SIZE: prevents window from being resized
                            ; • DARK_HEADER: black font and symbols in title bar
                            ; • FADING: makes window fade when inactive, similar to chat app
                            ; • FLOATING_TITLE_BAR: idk what this does, its hidden when I tried
                            ; • HIDDEN_OFFLINE: makes the window hidden when in a singleplayer (offline) session (useful if the app use is not intended for offline)
                            ; • HIDDEN_ONLINE: makes the window hidden when connected to an online server (useful if the app uses functions not available online)
                            ; • HIDDEN_RENDER_CUSTOM: hide in custom screen setup
                            ; • HIDDEN_RENDER_SINGLE: hide in single screen mode
                            ; • HIDDEN_RENDER_TRIPLE: hide in triple screen
                            ; • HIDDEN_RENDER_VR: hide in VR
                            ; • NO_BACKGROUND: makes background transparent
                            ; • NO_COLLAPSE: hides collapse button
                            ; • NO_SCROLL_WITH_MOUSE: stops mouse wheel from scrolling
                            ; • NO_SCROLLBAR: hides scrollbar 
                            ; • NO_TITLE_BAR: hides title bar
                            ; • SETUP: show in setup screen 
                            ; • SETUP_HIDDEN: show on setup menu but not in app list

FUNCTION_MAIN = fn      ; function to be called each frame to draw window content
FUNCTION_SETTINGS = fn  ; function to be called to draw content of corresponding settings window (only with “SETTINGS” flag)
FUNCTION_ON_SHOW = fn   ; function to be called once when window opens
FUNCTION_ON_HIDE = fn   ; function to be called once when window closes
ICON = icon.png         ; name of window icon (icon is searched in app folder)
FUNCTION_ICON = fn      ; optional function to be called instead to draw a window icon, for dynamic icons
GROUP = value		; Group within the CSP App taskbar in which the app is displayed
[SERVICE]
SCRIPT = Filename	; .lua file within the app that is run each time period
PERIOD = 24h		; Time period that CSP runs the above script. I don't know other possible values
[AWAKE_TRIGGERS]
EVENT = 'value'		; use ac.onSharedEvent() to use this. See the internal AppShelf app as an example
URL = '^https?://'	; I'm honestly not sure
BUTTON = 'value'	; Use ac.ControlButton() to use this. See the internal CspDebug app as an example.
Clone this wiki locally