Firetron's Command Template
stableDescription
A template to help you format your command code like the Firetron.
HaasScript
-- ============================================================================
-- Name
--
-- Description.
--
-- Custom Command Dependencies:
-- Dependency 1
-- Dependency 2
-- Dependency 3
--
-- Discord: @UserName
-- ============================================================================
-- ========================================================
-- Variables
-- ========================================================
-- ------------------------------------
-- Definition
-- ------------------------------------
local description
local inputSuggestions
local output
local outputSuggestions
-- ------------------------------------
-- Parameter
-- ------------------------------------
-- Basic
local pOne
-- Logging
local pIsLogging
local pIsPlotting
local pIsReporting
local pIsVerbose
local pLoggingName
-- ------------------------------------
-- Reference
-- ------------------------------------
local value
-- ========================================================
-- Command Definition
-- ========================================================
description = ''
DefineCommand('Name', description)
-- ========================================================
-- Parameter Definition
-- ========================================================
-- ------------------------------------
-- Main
-- ------------------------------------
description = ''
inputSuggestions = ''
pOne = DefineParameter(NumberType, 'pOne', description, false, 1, inputSuggestions)
-- ------------------------------------
-- Logging
-- ------------------------------------
description = 'Turns console logging on or off.'
inputSuggestions = 'Input'
pIsLogging = DefineParameter(BooleanType, 'Logging', description, false, true, inputSuggestions)
description = 'Turns chart plotting on or off.'
inputSuggestions = 'Input'
pIsPlotting = DefineParameter(BooleanType, 'Plotting', description, false, true, inputSuggestions)
description = 'Turns custom report of current state on or off.'
inputSuggestions = 'Input'
pIsReporting = DefineParameter(BooleanType, 'Reporting', description, false, true, inputSuggestions)
description = 'Turns verbose console logging on or off. Ignored if logging is turned off.'
inputSuggestions = 'Input'
pIsVerbose = DefineParameter(BooleanType, 'Verbose', description, false, false, inputSuggestions)
description = 'Name to use in logging to distinguish it from the other instances of this command.'
inputSuggestions = 'Text'
pLoggingName = DefineParameter(StringType, 'Logging Name', description, false, 'WickReversal', inputSuggestions)
-- ========================================================
-- Functions
-- ========================================================
-- ------------------------------------
-- Function Category
-- ------------------------------------
local FunctionA = function ()
return 0
end
-- ----------------
local FunctionB = function ()
return 1
end
-- ------------------------------------
-- Logging
-- ------------------------------------
local SafeLog = function (text)
if text == Load('lastLog', '') then return end
Log(text)
Save('lastLog', text)
end
-- ----------------
local LogWithName = function (message)
SafeLog(pLoggingName..': '..message)
end
-- ----------------
local LogSomething = function ()
if not pIsLogging then return end
LogWithName(pOne)
end
-- ----------------
local LogSomethingVerbose = function ()
if not pIsLogging then return end
if not pIsVerbose then return end
LogWithName(pOne)
end
-- ------------------------------------
-- Plotting
-- ------------------------------------
local PlotSomething = function ()
if not pIsPlotting then return end
end
-- ------------------------------------
-- Reporting
-- ------------------------------------
local ReportSomething = function ()
if not pIsReporting then return end
local group = pLoggingName
local name
local value
name = ''
value = pOne
CustomReport(name, value, group)
name = ''
value = pOne
CustomReport(name, value, group)
end
-- ========================================================
-- Execution
-- ========================================================
output = pOne
-- ========================================================
-- Output Definitions
-- ========================================================
description = ''
outputSuggestions = ''
DefineOutput(NumberType, output, description, outputSuggestions)
1 Comment
Sign in to leave a comment.
Firetron == Burning away the chaos one work day at a time.