Firetron’s Command Template updated logcolor

alpha
By Kobalt in Miscellaneous Published August 2022 👁 1,005 views 💬 0 comments

Description

https://www.haasscripts.com/t/firetrons-command-template/ further refine is welcome The color mapping should get some thought, maybe dynamic color (karim should know) if we can agree on mass- adoption of a similar standard for uniform inter connecting keys between script command, inputs will save us some vague patchy code errors and improve life ..
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      = 'logColor.'
inputSuggestions = 'ColorEnums'
pIsLogging       = DefineParameter(EnumType, 'logColor', description, false, Yellow, inputSuggestions)

description      = 'logColor1.'
inputSuggestions = 'ColorEnums'
pIsLogging       = DefineParameter(EnumType, 'logColor1', description, false, Green, inputSuggestions)

description      = 'logColor2.'
inputSuggestions = 'ColorEnums'
pIsLogging       = DefineParameter(EnumType, 'logColor2', description, false, Red, inputSuggestions)

description      = 'logColor3.'
inputSuggestions = 'ColorEnums'
pIsLogging       = DefineParameter(EnumType, 'logColor3', description, false, Teal, inputSuggestions)

description      = 'logColor4.'
inputSuggestions = 'ColorEnums'
pIsLogging       = DefineParameter(EnumType, 'logColor4', description, false, Fuchsia, inputSuggestions)

description      = 'logColor5.'
inputSuggestions = 'ColorEnums'
pIsLogging       = DefineParameter(EnumType, 'logColor5', description, false, Aqua, 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, logColor)
  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)

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!