Releases: int19h/Bannerlord.CSharp.Scripting
C# Scripting 1.3.0
C# Scripting 1.2.0
Support for Bannerlord 1.7.2.
C# Scripting 1.1.1
Fix crash when starting a new campaign.
C# Scripting 1.1.0
Requires Bannerlord 1.6.x.
Sample scripts are updated for Bannerlord 1.6.x.
Scripts can ignore visibility and access non-public members directly without using Reflection.
Scripts can use preprocessor symbols to detect Bannerlord version at compile-time.
Scripts can implement SubModule.OnGameStart
and register custom campaign behaviors.
Generated .rsp file enables code completion for members coming from #load
ed scripts regardless of path.
C# Scripting 1.0.0
Major rewrite: different syntax for defining and calling scripts, per-campaign scripts, more helper globals etc. See the README for details.
WARNING: scripts written for csx 0.1.0 and 0.2.0 have to be ported to work with the new version. Given a script such as:
// test.csx
foreach (var arg in Arguments) Log.WriteLine(arg);
the easiest way to adapt it is to wrap it in a params
function:
// test.csx
void test(params string[] Arguments) {
foreach (var arg in Arguments) Log.WriteLine(arg);
}
csx 0.2.0
Scripts for csx.run
are now loaded from ...\Documents\Mount and Blade II Bannerlord\Scripts
.
WARNING: existing scripts are not moved automatically! If you're already using v0.1.0, you'll have to move them manually.
csx.eval
can now evaluate statements, and not just expressions. Due to limitations of the Bannerlord console, you have to use use .,
in lieu of ;
.
Script state (declared variables etc) is preserved between invocations of csx.eval
. Thus, it's possible to store an object reference to a variable, and then repeatedly re-use it in the console. A new command, csx.reset
, was added to clear the state.
Since there's no longer a limit on console output in Bannerlord, Log.Write...()
goes to console only by default. Use Log.ToFile()
to also log to a file. If script fails with an exception, all output produced with Log.Write...()
is still printed to console, right before the error message.
Implicit namespace imports used by csx.eval
are now configurable via ...\Documents\Mount and Blade II Bannerlord\Configs\csx.xml
.