From b8e5208e33803613ff3ef98f6172355cbc805aae Mon Sep 17 00:00:00 2001 From: Barbz Date: Thu, 16 Nov 2017 02:26:15 +0100 Subject: [PATCH] CMake - Made it easier to add your custom scripts (#703) --- src/scripts/Custom/README.md | 15 +++++++++++++-- src/scripts/ScriptLoader.cpp | 12 ++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/scripts/Custom/README.md b/src/scripts/Custom/README.md index 7b9e83d4e..05944b870 100644 --- a/src/scripts/Custom/README.md +++ b/src/scripts/Custom/README.md @@ -6,14 +6,20 @@ They will be git-ignored Remember to use cmake macro inside your CMakeLists.txt to correctly add scripts to project solution. -BTW, **We strongly suggest you** to use our module system to create your custom + + +/!\ BTW, **We strongly suggest you** to use our module system to create your custom powerful module instead of simple scripts. ----------------- -CMakeLists.txt example: +How to: + +1) Create a CMakeLists.txt in this directory + +Example (everything below is needed, just replace with your scripts' names): set(scripts_STAT_SRCS ${scripts_STAT_SRCS} @@ -24,3 +30,8 @@ set(scripts_STAT_SRCS AC_ADD_SCRIPT_LOADER("Custom" "ScriptLoader.h") message(" -> Prepared: My custom scripts") + + +2) Add them to ../ScriptLoader.cpp + +Open the file and go at the end of the file to know what to edit. diff --git a/src/scripts/ScriptLoader.cpp b/src/scripts/ScriptLoader.cpp index 2c0814c9b..a5e9f710e 100644 --- a/src/scripts/ScriptLoader.cpp +++ b/src/scripts/ScriptLoader.cpp @@ -1171,3 +1171,15 @@ void AddOutdoorPvPScripts() #endif } + +//~ ********************** Put your custom scripts below, like the commented examples, uncomment and edit ************************************* + + +//~ void AddSC_MySuperScript(); + +void AddCustomScripts() +{ +#ifdef SCRIPTS + //~ AddSC_MySuperScript(); +#endif +}