Instruction Mapping
You can customize the command mapping, and then just type in the short commands you've set up!
Step 1: Create a new lua file
Create a new lua file in the script directory of your project, for example: command_mapping.lua
Step 2: Write the code
Write the following code in the lua file you created in Step 1:
-- create a new module
local commandMapping = {}
-- import the command module
local command = require("command")
-- define the execute function
function commandMapping.execute()
-- write your code here
end
return commandMapping
Step 3: Customize the command mapping
In the execute function, you can customize the command mapping by command.RegisterCommandMapping, for example:
-- create a new module
local commandMapping = {}
-- import the command module
local command = require("command")
-- define the execute function
function commandMapping.execute()
-- command.RegisterCommandMapping(New command, Original command)
-- After this, you can enter new command with the same effect as the original command.
command.RegisterCommandMapping("crimson", "actionFlow action/placeAndDig")
command.RegisterCommandMapping("iron_ores", "actionFlow action/placeAndDig_iron_ores")
command.RegisterCommandMapping("mushroom", "actionFlow action/mushroomStem")
end
return commandMapping
In this example, we have customized the command mapping, and then we can enter the following commands to trigger the corresponding actions:
New command | Original command |
|---|---|
crimson | actionFlow action/placeAndDig |
iron_ores | actionFlow action/placeAndDig_iron_ores |
mushroom | actionFlow action/mushroomStem |
Last modified: 12 11月 2023