-
Notifications
You must be signed in to change notification settings - Fork 0
How to create Lua Profiles
This is the way I originally designed the app to work, the following content will show you how to lua remap profiles works and how to program them.
When I create the app, I wanted full freedom on how the controller is mapped and I will try to simplify the process for all users with a block oriented programing, to copy-paste a standard block of code and make magic.
I understand some users will bore with this explanation but you will need to know the structure of the remap profile, if you want to customice or create one.
Lua was chosen because of its simplicity for those who speak english. For the any other, use Google Translate to understand it, seriously, it's not that hard.
Another easier way is to download and use profiles of other users. Some standard profiles can be finded here.
To start creating a lua remap profile, first you need to create a file with the lua extension (.lua file). This is intended to filter the remappers with the file extension, for that reason the Lua Interpreter Plugin only recognise .lua files. DSRemapper will not load any other file with that plugin unless it have the lua extension. Same applies for other remap plugins.
This file also needs to be located on the Profiles folder located inside the DSRemapper folder located in the user Documents folder (default path: %UserProfile%\Documents). If the folder doesn't exists, first run DSRemapper.
The structure of the profile is simple, it consists of a code responsible of configuring everything and a function responsible of remapping the controller.
To write setup code you simply need to write it outside any function. When the profile is loaded, this code is executed first from top to bottom, no matter if there are functions in between.
Once this code is executed, is assumed that all was needed to do or setup, is done and the program immediately starts executing the Remap function. For that reason, in this section you will need to create and connect the emulated controllers.
To write remap code you need to write it inside the Remap function. If for some reason you don't want to execute a code repeatedly simply don't create a Remap function.
Caution: if you use a infinite loop inside setup code, the profile, and maybe the app, will freeze and you will need the task manager to close the app.
The Remap function will be declared as follow:
function Remap(input)
--code
endAll words inside brakets, and separated with commas ',', are called parameters. These are optionals, and the name doesn't matter.
The parameters and variable names can't contain spaces or symbols and can't start with numbers. Some symbols can be used, like the underscore '_'. Some valid names are:
- input
- controller_input
- controllerInput
This is a list of the content, in order, of the parameters of the Remap function:
- first parameter always contains the physical controller input
In the future there may be more.
--[[
Setup code and other functions
]]
function Remap(input)
--[[
Remap code
]]
end
--[[
Setup code and other functions
]]- Getting started
- Basic actions
- Advanced behavior (Comming soon)
- Sample plugins