Community Script Hook V .NET
You may remember the .NET ScriptHook back from GTAIV, it allowed using the easy to learn, but extremly powerful .NET languages to write scripts that can be executed ingame.
About
This ASI plugin for the just released Script Hook V attempts to recreate this experience for GTAV. It's full source code is hosted on Github, development is community-driven and open to everybody, so contributions are warmly welcomed.
Right now it's able to load, compile and run .NET scripts and reload them while the game is running (press the "Insert" key). It also comes with a vast scripting API abstracting away the native function calls (you can still do those manually through "GTA.Native.Function.Call" though). Scripts are executed in a separate AppDomain, any exceptions thrown thus shouldn't affect the game or ScriptHook.
Thanks a lot to Alexander Blade for Script Hook V and HazardX for the inspiration with his GTAIV .NET ScriptHook.
Download Latest Binary Release
Installation
Install both the Microsoft .NET Framework 4.5.2 and the Visual C++ Redistributable Package for Visual Studio 2015 (x64) (or loading will fail).
Download and install the latest Script Hook V (including the ASI loader).
Download Script Hook V .NET and copy the ASI file into your game folder.
Create (or download) a C#/VisualBasic code file (.cs, .vb) or compiled .NET assembly (.dll) inside the "scripts" folder in your game directory and start scripting!
Contributing
Important files:
src/Main.cpp: The main script entry point
src/ScriptDomain.cpp: .NET script manager. Loads, compiles and executes the scripts.
src/Script.hpp: Class from which all scripts have to inherit, handles the script main loop.
src/Native.cpp: Managed to native function call conversion.
src/NativeHashes.hpp: Native function hash enumeration.
The remaining files implement the scripting API. Any help on improving that API is much appreciated.
Documentation
Either use notepad to edit source code scripts directly or use Visual Studio to compile them to assemblies. Going down the Visual Studio way has the advantage of syntax highlighting, code completion and Intellisense (since there is no API documentation yet). Just create a C# or VisualBasic class library project, add a reference to Script Hook V .NET (rename the ASI to DLL) in the project properties and you are ready to go.
If something doesn't work, check the log file ScriptHookVDotNet creates. It catches exceptions and gives you all the information to get to the bottom of the problem.
Visit the wiki for more help on how to get started and write scripts.
gamerzworld, Hanneswasco, PingPang and 35 others like this