Skip to content

A PowerShell module for compiling SourceMod (.sp) and AMX Mod X (.sma) plugin source files for Source / Goldsource games.

License

Notifications You must be signed in to change notification settings

startersclan/Compile-SourceScript

Repository files navigation

Compile-SourceScript

azuredevops-build github-release powershellgallery-version

A PowerShell module for compiling SourceMod (.sp) and AMX Mod X (.sma) plugin source files for Source / Goldsource games.

Introduction

Compile-SourceScript is a wrapper to ease development of each of the mod's plugins. Specified plugins are compiled and subsequently copied into the mod's plugins directory if found to be new or have been changed.

Requirements

Installation

The module can either be installed, or imported from a local copy of this git repository.

via Install

# Latest version
Install-Module -Name Compile-SourceScript -Repository PSGallery -Scope CurrentUser -Verbose

# Or, for specific version
Install-Module -Name Compile-SourceScript -Repository PSGallery -RequiredVersion x.x.x -Scope CurrentUser -Verbose

If prompted to trust the repository, type Y and enter.

via Import

# Clone the git repository
git clone https://github.com/startersclan/Compile-SourceScript.git
cd Compile-SourceScript/

# Checkout version to use
git checkout vx.x.x

# Import the module
Import-Module ./src/Compile-SourceScript/Compile-SourceScript.psm1 -Force -Verbose

The module is now ready for use.

Usage

Functions

Compile-SourceScript [-File] <String> [-SkipWrapper] [-Force] [<CommonParameters>]

Example 1

Compiles the SourceMod plugin source file plugin1.sp, and installs the compiled plugin with user confirmation for the game Counter-Strike: Global Offensive.

Compile-SourceScript -File ~/server/csgo/addons/sourcemod/scripting/plugin1.sp

Example 2

Compiles the AMX Mod X plugin source file plugin2.sma without using the mod's compiler wrapper, and installs the compiled plugin without user confirmation for the game Counter-Strike 1.6.

Compile-SourceScript -File ~/server/cstrike/addons/amxmodx/scripting/plugin2.sma -SkipWrapper -Force

VSCode

Compile-SourceScript can be invoked via Build Tasks in VSCode.

Sample tasks files can be found here.

Common issues

Compiler errors

  • bash: /path/to/scripting/amxxpc: No such file or directory

    Install dependencies for the compiler.

  • compiler failed to instantiate: amxxpc32.so: cannot open shared object file: No such file or directory

    Invoke the compiler from within the directory where the compiler is located:

    cd /path/to/scripting
    ./amxxpc

    See here for more details.