User Guides - scripthookvdotnet/scripthookvdotnet GitHub Wiki
Install
- Install both the Microsoft .NET Framework 4.8 (or higher, so skip this on Windows 10) and the Microsoft Visual C++ Redistributable Package for Visual Studio 2019 (x64).
- Download and install the latest Script Hook V.
- Download one of archives of pre-built binaries and copy the
ScriptHookVDotNet.asi
,ScriptHookVDotNet2.dll
andScriptHookVDotNet3.dll
files into your game directory. Also copyScriptHookVDotNet.ini
if you want to edit the configurations.- Unless you are experiencing compatibility issues with some scripts, you should use the latest version since for more number of script support and improved performance.
- You need to use the ASI file and the DLL files for APIs in an archive of the same version as internal structure can be changed without notices. If you experience some issues by cherry-picking a ASI file and DLL files for APIs, we will not provide support at all.
Configs
You can change configs of ScriptHookVDotNet (SHVDN) by editing ScriptHookVDotNet.ini
at your game directory.
- For avaiable key names, see Keys Enum of .NET Framework API Reference. Key name values are case-insensitive.
- For example, if you want to set the console key values to the F5 key, type
ConsoleKey=F5
orConsoleKey=f5
. Spaces before and after values are allowed, but ones for key names are not allowed (so you can type likeConsoleKey= F5
, but notConsoleKey =F5
).
- For example, if you want to set the console key values to the F5 key, type
Available Options
- ReloadKey
- Sets the key that immediately reloads the SHVDN runtime. Set to
None
by default.
- Sets the key that immediately reloads the SHVDN runtime. Set to
- ConsoleKey
- Sets the key that opens or closes SHVDN console. Set to
F4
by default.
- Sets the key that opens or closes SHVDN console. Set to
- ScriptsLocation
- Specifies the folder where sctipts should be located to load. Set to
scripts
by default. - More than a few scripts expect the script location to be always
scripts
, so you may encounters various issues such as ini probing location by editing this option.
- Specifies the folder where sctipts should be located to load. Set to
Console
SHVDN has a in-game console with C# expression support, where the v3 scripting API can be used. You can reload all scripts by Reload();
(case-sensitive since evaluated as a C# expression. The semicolon can be omitted in this case).
Open the console and enter Help()
for more information on how to use it in various ways. The console registers 2 aliases, which are P
as a alias of Game.Player.Character
and V
as a alias of P.CurrentVehicle
. Although it does not have autocomplete or dedicated custom console commands yet, it has full access to the v3 scripting API, so is a powerful tool for all kinds of purposes (e.g. type V.Repair()
to repair your current vehicle). There is a command history, use the combination of Ctrl + P
or Ctrl + N
, or the arrow up/down keys to go through it. Page up/down can be used to go through the log history.
If some scripts define public static methods, you can also call them, like Namespace.CommandClass.FooBar()
.
Available Console Shortcuts
SHVDN has many shortcuts for console similar to what bash has for emacs mode. No need to reach for the arrow keys just to move the cursor or go through the command history.
Shortcut | Action |
---|---|
Esc | Close the console |
Ctrl + V | Paste the clipboard content |
Ctrl + A / Home | Move to the start of the command line |
Ctrl + E / End | Move to the end of the command line |
Ctrl + F | Move one character forward |
Ctrl + B | Move one character backward |
Ctrl + Right / Alt + F | Move the cursor one word forward |
Ctrl + Left / Alt + B | Move the cursor one word backward |
Ctrl + H | Delete one character before the cursor |
Ctrl + D | Delete one character after the cursor |
Ctrl + T | Transpose two characters right before and after the cursor |
Ctrl + U | Cut the Line before the cursor (does not copy to the clipboard) |
Ctrl + K | Cut the Line after the cursor (does not copy to the clipboard) |
Ctrl + P / Up arrow | Move to previous command |
Ctrl + N / Down arrow | Move to next command |
Ctrl + L | Clear the command history |
Page Down | View previous page of the command history |
Page Up | View next page of the command history |