Difference between revisions of "Plugins"
From Zenbot Wiki
Views
Actions
Namespaces
Variants
Tools
| Line 34: | Line 34: | ||
only Game data will be available inside the function with the following properties: | only Game data will be available inside the function with the following properties: | ||
- champion : string | - champion : string | ||
- | - mapId : number | ||
- mode : string | - mode : string | ||
- isMatchmade : boolean | - isMatchmade : boolean | ||
Revision as of 23:21, 17 December 2022
Definition
Content
A plugin is defined as a folder, or (encrypted) archive that contains the following:
info.lua [required]
- name
this will get displayed in loader/menu
- version [optional]
for example "0.0.1"
this will get displayed in loader
- author [optional]
this will get displayed in loader/menu
- description [optional]
this will get displayed in loader/menu
- icon [optional]
this will get displayed in menu
- dependencies [optional]
- required
plugin needs those libraries to work and will not load if one or more is missing/not available
example: { "Orbwalker", "HealthPrediction" }
- optional
plugin integrates those libraries but will load regardless if they are missing/not available
example: { "Evade" }
- conflicts
plugin cannot work if one or more of those is loaded, plugin will not load if they are loaded
example: { "Aatrox" }
- library [optional]
boolean to indicate if submodules should be loadable outside of this plugin
- load [optional]
(lambda) function returning a boolean that indicates if the plugin should show up ingame
function() return GameData.champion == "Aatrox" end
"Game.champion == 'Aatrox'"
only Game data will be available inside the function with the following properties:
- champion : string
- mapId : number
- mode : string
- isMatchmade : boolean
thumbnail.png [optional]
- this will get displayed in loader/menu
init.lua [optional]
- this will get loaded during loading screen - you can pre-create menu here - most objects and instances are not available
main.lua [required]
- this is the entry to your plugin
Example
info.lua:
return {
name = "MyPlugin",
version = "0.0.1",
title = "My Awesome Plugin",
author = "Me",
description = "Does awesome things",
dependencies = {
required = { "Orbwalker", "HealthPrediction" },
optional = { "SomeLibrary" },
conflicts = { "Aatrox" }
},
library = false,
load = "GameData.champion == 'Aatrox'"
}
Loading/Importing
Virtual File System
Zenbot uses a virtual file system to load its plugins
1. Core files are pre-loaded
Core virtual folder will contain /classes/ /common/ /core/ /extension/ /library/ /plugin/ /shader/ /main.lua
2. Plugins are pre-loaded and dependencies are determined and pre-loaded
/plugin/plugin1/ /plugin/plugin2/ /plugin/plugin3/ /library/dependency1/ /library/dependency2/ /library/dependency3/
3. Core entry point is executed, successfully loaded plugins are added to menu
/main.lua
4. Plugin entry points are executed, if activated in menu
/plugin/plugin1/main.lua /plugin/plugin2/main.lua /plugin/plugin3/main.lua
Importing Plugins
Libraries and internals can be loaded by using module api or import keyword
local Player = module.load"Player" or import "Player"
local Orbwalker = module.load"Orbwalker" or import "Orbwalker"
Lookup Priority
The priority order for lookups is:
- Current plugin folder
- All library folders
- Core folders
- Instances[name]
- Enums[name]