viktor-ferenczi

se-dev-script

1
1
# Install this skill:
npx skills add viktor-ferenczi/se-dev-skills --skill "se-dev-script"

Install specific skill from multi-skill repository

# Description

In-game (programmable block, aka PB) script development for Space Engineers version 1

# SKILL.md


name: se-dev-script
description: In-game (programmable block, aka PB) script development for Space Engineers version 1
license: MIT


Getting Started

If the Prepare.DONE file is missing in this folder, you MUST run the one-time preparation steps:
1. Review the requirements and instructions in Prepare.md.
2. Execute the preparation by running .\Prepare.bat from this folder.
3. IMPORTANT: You are on Windows. Use & to chain commands in cmd.exe or ; in PowerShell. Do NOT use &&.
4. DO NOT create the Prepare.DONE file yourself. It is automatically created by Prepare.bat only upon a successful run. Creating it manually is "faking" success and will lead to errors.

Usage Guide

  • A Python virtual environment in this folder was made available by the preparation.
  • Use this Python virtual environment to write short, targeted, reusable utility scripts as needed.
    Build a catalog of such scripts in UtilityScripts.md next to this skill file.
  • Use uv run script_name.py in this folder (as CWD) to run your scripts.
  • IMPORTANT: Space Engineers modding is done on Windows. All commands must work on Windows.
  • Use busybox.exe as a prefix to run individual UNIX-like commands, for example: busybox.exe grep -r "pattern" folder.
  • Do NOT open a bash shell with busybox bash. Run busybox commands directly from cmd or PowerShell instead.
  • CRITICAL: Always use forward slashes (/) in file paths passed to busybox. Backslashes are interpreted as escape characters by bash and will be silently removed, mangling paths. Windows accepts forward slashes. Correct: busybox.exe grep "pattern" C:/Users/name/folder โ€” Wrong: C:\Users\name\folder.
  • Alternatively use Windows PowerShell, which handles backslash paths natively.
  • See the list of available Python packages in pyproject.toml.
  • The SteamScripts folder contains game content (mods, scripts, blueprints) the player downloaded. Filter scripts by the existence of a Script.cs file directly in the numbered content folder.
  • The LocalScripts folder contains mods the player is developing. It is a link to %AppData%/SpaceEngineers/IngameScripts.

Use only names matching the PB API whitelist: PBApiWhitelist.txt
The whitelist was exported from game version 1.208.015 using MDK2's Mdk.Extractor.

In-game (PB) scripts are released on the Steam Workshop or Mod.IO, mostly on the former.
In-game scripts are compiled by the game on loading into the PB or world loading (if the PB has a script loaded)
with a PB Script API whitelist enforced, which is supposed to guarantee safety and security.
Scripts cannot crash the game, since any exception is caught and the script is killed by the game.
Scripts can still lag the game if no specific resource usage enforcement is set up by the player or server admin.

The script's source code size is limited to 100,000 bytes when the player loads it. The ScriptDev plugin can load
more from local file into offline (local) games for testing purposes, therefore scripts can be tested without
source code compression, which is useful to get fully detailed exception tracebacks.

Use the se-dev-game-code skill to search the game's decompiled code. You may need this to
understand how the game's internals work and how to script it properly. Stick to game code
searches corresponding to names on the PB API whitelist for efficiency.

References:
- Script Template repo PB script template repository to start a new project. See ScriptTemplate.md
- Script Merge tool Merging PB scripts from C# projects into single file with optional code compression. See ScriptMerge.md
- Script Dev plugin Automatic script loading into the PB in-game for easier testing. See ScriptDev.md
- Mod Development Kit (MDK2)
- Programmable Block API
- Wiki on Scripting

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.