Difference between revisions of "ScriptHook: Script"

From Nomad DB
Line 1: Line 1:
A Script is a collection of Lua scripts that are loaded by [[WD2 ScriptHook]]. Scripts are loaded upon starting the game with ScriptHook installed. This guide will give you an overview of the structure behind those Scripts.
+
A Script is a collection of Lua scripts that are loaded by [[WD2 ScriptHook]]. Scripts are loaded upon starting the game with ScriptHook installed.
  
 +
'''This guide will give you an overview of the structure behind those Scripts.
 +
'''
 
== Directory Structure ==
 
== Directory Structure ==
 
<pre>
 
<pre>
Line 10: Line 12:
  
 
=== manifest.json ===
 
=== manifest.json ===
The manifest holds information about a Script. Name, Author & Version can be specified here. The "entrypoint" is the Lua script that is loaded. For the ''keyBinds'' section, check out [[WD2 ScriptHook: Key Binds]].
+
The manifest holds information about a Script. Name, Author & Version can be specified here. The "entrypoint" is the Lua script that is loaded.
  
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
Line 24: Line 26:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
== Concepts ==
 +
=== Key Bindings ===
 +
You can bind Keys to Lua functions. Key Bindings are configured within the ''manifest.json'' section. For more information, check out [[WD2 ScriptHook: Key Binds]].
 +
 +
=== Console Commands ===
 +
Scripts can register custom Console Commands. These commands are registered directly within Lua. Check out [[WD2 ScriptHook: Console Commands]].
  
 
== Related Pages ==
 
== Related Pages ==

Revision as of 22:51, 14 April 2020

A Script is a collection of Lua scripts that are loaded by WD2 ScriptHook. Scripts are loaded upon starting the game with ScriptHook installed.

This guide will give you an overview of the structure behind those Scripts.

Directory Structure

data/scripts
data/scripts/[name]
data/scripts/[name]/manifest.json
data/scripts/[name]/[...].lua

manifest.json

The manifest holds information about a Script. Name, Author & Version can be specified here. The "entrypoint" is the Lua script that is loaded.

{
	"name": "Simple Trainer",
	"author": "Nomad Group",
	"version": "1.0",
	
	"entrypoint": "main.lua",
	"keyBinds": {
		"menu": "F4"
	}
}

Concepts

Key Bindings

You can bind Keys to Lua functions. Key Bindings are configured within the manifest.json section. For more information, check out WD2 ScriptHook: Key Binds.

Console Commands

Scripts can register custom Console Commands. These commands are registered directly within Lua. Check out WD2 ScriptHook: Console Commands.

Related Pages