🖍️
RED4ext Plugin Dev
HomeRED ModdingDiscordGitHub
  • Home
  • Getting Started
    • Installing RED4ext
    • Installing a Plugin
    • Configuration
    • Uninstalling
  • Mod Developers
    • RED4ext & RED4ext.SDK
      • Browse Red4Ext: NativeDB
    • Creating a Plugin
    • Creating a Custom Native Class
    • Adding a Native Function
    • Custom game states
    • Logging
    • Creating a plugin with RedLib
    • Installing a plugin with red-cli
  • Utils
    • NativeDB
    • CRC32 Hasher
    • FNV1A64 Hasher
Powered by GitBook
On this page
  • Introduction
  • Setup red-cli
  • Setup CMake
Edit on GitHub
Export as PDF
  1. Mod Developers

Installing a plugin with red-cli

This guide will show you how you can quickly install a plugin in your game's folder after building it.

PreviousCreating a plugin with RedLib

Last updated 9 months ago

Introduction

is command line interface tool to improve your experience as a scripting modder. It allows you to run commands from a terminal to quickly install your plugin in the game folder. It is also convenient to make an archive with your plugin, ready to release to users on Nexus Mods.

This tool is also compatible with Redscript. See if you are also writing scripts in addition to a RED4ext plugin.

Setup red-cli

This tool requires a red.config.json file to be present in the root directory of your project. Basically, it should be in the same directory of your CMakeLists.txt file.

You can find everything you need to install / configure red-cli through its README.

Setup CMake

You can add a command in your CMakeLists.txt file to execute red-cli after building in Debug or in Release mode. We will use the function add_custom_command of CMake to do this.

We can ask CMake to execute the command red-cli install in Debug mode and the command red-cli pack in Release mode:

## Debug mode: install scripts (+ tests) and plugin in game folder.
## Release mode: create archive with bundled scripts and plugin.
add_custom_command(
        TARGET ${CMAKE_PROJECT_NAME}
        POST_BUILD
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
        COMMENT "$<$<CONFIG:Debug>:Install scripts with red-cli>" "$<$<CONFIG:Release>:Build archive with red-cli>"
        COMMAND "$<$<CONFIG:Debug>:red-cli;install>" "$<$<CONFIG:Release>:red-cli;pack>"
        COMMAND_EXPAND_LISTS
)

Now, every time you compile your project in Debug mode, it will install the DLL plugin and the scripts in the game's folder. You're ready to run the game and test your mod.

When your project is ready, you can compile your project in Release mode, it will create an archive with your DLL plugin and a bundle of your scripts. You could extract the archive in your game's folder, and test it to make sure everything is in order prior to releasing it on Nexus Mods.

red-cli
this guide