For Auto Assembler Templates see this post.
This is a Lua script template engine that compiles/renders templates, the template engine is based off [Link]. You can access variables and run lua code in the templates using the appropriate tags. There are two file's you'll need to start; "TemplateEngine.lua" and "LuaScriptTemplates.lua". You can just stick them both in the "autorun" folder. And you'll need to create the "Templates\lua" Folder (in the "autorun" folder) for the templates.
When CE loads, "LuaScriptTemplates" will scan the templates folder for "LoadOrder.lua" if found and it returns a table/array of file names it will load in that order; if not found is will scan the templates folder for any ".lua" files. When it finds a template file it will also look for "[template file name].settings.lua", the settings file is not required but allows for more control of the template and menu items added to the Lua script form. The settings file can return a table of the template's settings, but this is not required (more on why later).
For simple output you can use "<<" and ">>" tags, what ever is returned will be converted to string if not already and replace where the open and close tags are; these can be a called function, variable, or just a string/number. For lua code you can use "<%" and "%>" tags, these can be full lua code; thus you can set/create variables, use loops, and if statements.
Here is an archive with the needed files and one example template and setting file.
Using a template file named "My basic template.lua" like this:
Code: Select all
-- Cheat Engine Version: << getCEVersion() >>
<% print('This will print when rendered but will not render in the template.') %>
<% local text = 'here is a local variable created in the template.' %>
'<< text >> So that's pretty cool.'
-- if you need "\<<" or "\<%" to be in the rendered template then you need to escape them.
-- A single "<" doesn't need to be escaped, nor do ">>" and "%>".
print('This is in the template and not processed when rendered.')
Code: Select all
-- Cheat Engine Version: 7.2
here is a local variable created in the template. So that's pretty cool.
-- if you need "<<" or "<%" to be in the rendered template then you need to escape them.
-- A single "<" doesn't need to be escaped, nor do ">>" and "%>".
print('This is in the template and not processed when rendered.')
There is another special file named "Header.lua" which is rendered then passed to the template as "Header":
Code: Select all
<< Header >>
-- This allows for a common header without polluting the template file it self
-- and can have lua code like the template files.
-- But it will be a blank line if there's no header file.
For a settings file for "My basic template.lua" we can create a file named "My basic template.settings.lua" like this:
Code: Select all
local settings = {
Caption = 'Custom: Basic Template',
Shortcut = 'Ctrl+Alt+1',
}
return settings
Code: Select all
Template Settings:
Caption : string
The caption of the template's menu item.
Shortcut : string
The shortcut of the template's menu item.
Code: Select all
Template Variables:
CEVersion : number
The current CE version.
Date : string
The current date.
FinalCompilation : boolean
Only for the settings files as they get loaded once when CE loads then again at the start
of template rendering to get the template settings, and again just before rendering the
template but only on the last load will the environment be setup.
So this is used to know if the environment is setup if more environment setup is done in
the setting file.
Any "globals" (not really globals and only exist in the template/settings environment) created in the settings file are passed to the template file.. You can use a settings file like this to add to the template's environment:
Code: Select all
if FinalCompilation then
TimerInterval = inputQuery('Timer Interval', 'Enter timer interval', '100')
TimerMaxSecs = inputQuery('Timer Max. Seconds', 'Enter timer max. seconds', '300')
end