ZeroBrane Studio custom API for auto-completion

Post topics about HALion scripting.
Post Reply
misohoza
Member
Posts: 869
Joined: Sun Oct 05, 2014 12:18 am
Contact:

ZeroBrane Studio custom API for auto-completion

Post by misohoza » Tue Nov 28, 2017 3:16 am

Custom api for Halion functions auto-completion and tooltips and a simple plugin for syntax highlighting.

ZBS Halion.zip
(14.51 KiB) Downloaded 141 times

How to install:

Download and extract the attachment.
Place the halion.lua file into this folder:

Code: Select all

ZeroBraneStudio/api/lua
Place the halionKeywords.lua file into:

Code: Select all

ZeroBraneStudio/packages
Open you user settings (Edit/Preferences/Settings: User) and paste the following into your user.lua file:

Code: Select all

api = {'halion'}

styles['keywords4'] = {fg = {193, 85, 77}, b = true, u = true}
styles['keywords5'] = {fg = {66, 86, 180}, b = true, u = true}
styles['keywords6'] = {fg = {0, 102, 0}, b = true, u = true}
First line is necessary to register the api. The rest is optional.
Save your user settings and restart the application.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

misohoza
Member
Posts: 869
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: ZeroBrane Studio custom API for auto-completion

Post by misohoza » Sun Dec 03, 2017 9:42 pm

Another two plugins for ZeroBrane Studio. One adds "Halion Help" option to the main Help menu and the other adds "Show reference" option to the editor (right-click) menu.
ZBS_plugins.zip
(2.16 KiB) Downloaded 123 times
Files need to be placed in:

Code: Select all

ZeroBraneStudio/packages
halionhelp.lua

Code: Select all

local id = ID("halionhelpmenu.halionhelpmenu")
local url = "https://developer.steinberg.help/display/HSD/HALion+Script+Home"
return {
  name = "Halion Help",
  description = "Adds Halion help option to the menu.",
  author = "..",
  version = 0.3,
  dependencies = "1.30",

  onRegister = function(self)
    local menu = ide:FindTopMenu("&Help")
    menu:Append(id, "Halion Help")
    ide:GetMainFrame():Connect(id, wx.wxEVT_COMMAND_MENU_SELECTED,
      function(event) wx.wxLaunchDefaultBrowser(url, 0) end)
  end,

  onUnRegister = function(self)
    ide:RemoveMenuItem(id)
  end,
}
Adds "Halion Help" option which should open Halion Script Homepage in your default browser.

Image

halionshowreference.lua

Code: Select all

local id = ID("showhalionreference.showhalionreferencemenu")
local ident = "([a-zA-Z_][a-zA-Z_0-9%.]*)"
local func = {['addLayerPassword'] = true, ['addQCAssignment'] = true, ['afterTouch'] = true, ['appendBus'] = true, ['appendEffect'] = true, ['appendLayer'] = true, ['appendLayerAsync'] = true, ['appendMidiModule'] = true, ['appendZone'] = true, ['assignAutomation'] = true, ['AudioFile.open'] = true, ['beat2ms'] = true, ['calcModulation'] = true, ['changeNoteExpression'] = true, ['changePan'] = true, ['changeTune'] = true, ['changeVolume'] = true, ['changeVolumedB'] = true, ['clone'] = true, ['controlChange'] = true, ['defineModulation'] = true, ['defineParameter'] = true, ['defineSlotLocal'] = true, ['endUndoBlock'] = true, ['Event'] = true, ['fade'] = true, ['findBusses'] = true, ['findChildren'] = true, ['findEffects'] = true, ['findLayers'] = true, ['findMidiModules'] = true, ['findSlots'] = true, ['findZones'] = true, ['forgetAutomation'] = true, ['getAllocatedMemory'] = true, ['getAutomationIndex'] = true, ['getBarDuration'] = true, ['getBeatDuration'] = true, ['getBeatTime'] = true, ['getBeatTimeInBar'] = true, ['getBus'] = true, ['getCC'] = true, ['getChild'] = true, ['getContext'] = true, ['getDisplayString'] = true, ['getEffect'] = true, ['getElement'] = true, ['getFreeVoices'] = true, ['getHostName'] = true, ['getHostVersion'] = true, ['getKeyProperties'] = true, ['getKeySwitches'] = true, ['getLayer'] = true, ['getMidiModule'] = true, ['getModulationMatrixRow'] = true, ['getMsTime'] = true, ['getNoteDuration'] = true, ['getNoteExpression'] = true, ['getNoteExpressionProperties'] = true, ['getNumQCAssignments'] = true, ['getOutputBus'] = true, ['getParameter'] = true, ['getParameterDefinition'] = true, ['getParameterNormalized'] = true, ['getPeak'] = true, ['getProductName'] = true, ['getProductVersion'] = true, ['getProgram'] = true, ['getQCAssignmentBypass'] = true, ['getQCAssignmentCurve'] = true, ['getQCAssignmentMax'] = true, ['getQCAssignmentMin'] = true, ['getQCAssignmentMode'] = true, ['getQCAssignmentParamId'] = true, ['getQCAssignmentScope'] = true, ['getSamplingRate'] = true, ['getScriptExecTimeOut'] = true, ['getScriptVersion'] = true, ['getSlot'] = true, ['getSlotIndex'] = true, ['getSource1'] = true, ['getSource2'] = true, ['getTempo'] = true, ['getTime'] = true, ['getTimeSignature'] = true, ['getUsedMemory'] = true, ['getUsedVoices'] = true, ['getUsedVoicesOfSlot'] = true, ['getUserPresetPath'] = true, ['getVoices'] = true, ['getZone'] = true, ['hasParameter'] = true, ['insertBus'] = true, ['insertEffect'] = true, ['insertEnvelopePoint'] = true, ['insertEvent'] = true, ['insertLayer'] = true, ['insertLayerAsync'] = true, ['insertMidiModule'] = true, ['insertZone'] = true, ['isKeyDown'] = true, ['isNoteHeld'] = true, ['isOctaveKeyDown'] = true, ['isPlaying'] = true, ['loadPreset'] = true, ['loadPresetAsync'] = true, ['messageBox'] = true, ['ms2beat'] = true, ['ms2samples'] = true, ['onAfterTouch'] = true, ['onController'] = true, ['onInit'] = true, ['onLoad'] = true, ['onLoadIntoSlot'] = true, ['onLoadSubPreset'] = true, ['onNote'] = true, ['onNoteExpression'] = true, ['onPitchBend'] = true, ['onRelease'] = true, ['onRemoveFromSlot'] = true, ['onSave'] = true, ['onSaveSubPreset'] = true, ['onTriggerPad'] = true, ['onUnhandledEvent'] = true, ['openURL'] = true, ['pitchBend'] = true, ['playNote'] = true, ['playTriggerPad'] = true, ['postEvent'] = true, ['printRaw'] = true, ['readMidiFile'] = true, ['releaseVoice'] = true, ['removeBus'] = true, ['removeEffect'] = true, ['removeEnvelopePoint'] = true, ['removeFromParent'] = true, ['removeLayer'] = true, ['removeMidiModule'] = true, ['removeQCAssignment'] = true, ['removeZone'] = true, ['runAsync'] = true, ['samples2ms'] = true, ['setName'] = true, ['setOutputBus'] = true, ['setParameter'] = true, ['setParameterNormalized'] = true, ['setProgram'] = true, ['setQCAssignmentBypass'] = true, ['setQCAssignmentCurve'] = true, ['setQCAssignmentMax'] = true, ['setQCAssignmentMin'] = true, ['setQCAssignmentMode'] = true, ['setQCAssignmentParamId'] = true, ['setQCAssignmentScope'] = true, ['setScriptExecTimeOut'] = true, ['setSource1'] = true, ['setSource2'] = true, ['sortEvents'] = true, ['spawn'] = true, ['startUndoBlock'] = true, ['wait'] = true, ['waitBeat'] = true, ['waitForRelease'] = true, ['writeMidiFile']= true, }
return {
  name = "Show halion reference",
  description = "Adds 'show halion reference' option to the editor menu.",
  author = "..",
  version = 0.2,
  dependencies = "1.30",

  onMenuEditor = function(self, menu, editor, event)
    local point = editor:ScreenToClient(event:GetPosition())
    local pos = editor:PositionFromPointClose(point.x, point.y)
    if not pos then return end

    local line = editor:LineFromPosition(pos)
    local linetx = editor:GetLine(line)
    local localpos = pos-editor:PositionFromLine(line)
    local selected = editor:GetSelectionStart() ~= editor:GetSelectionEnd()
    and pos >= editor:GetSelectionStart() and pos <= editor:GetSelectionEnd()

    local start = linetx:sub(1,localpos):find(ident.."$")
    local right = linetx:sub(localpos+1,#linetx):match("^([a-zA-Z_0-9%.%:]*)%s*['\"{%(]?")
    local ref = selected
    and editor:GetTextRange(editor:GetSelectionStart(), editor:GetSelectionEnd())
    or (start and linetx:sub(start,localpos)..right or nil)

    if ref and func[ref] then
      menu:Append(id, ("Show Reference: %s"):format(ref))
      menu:Connect(id, wx.wxEVT_COMMAND_MENU_SELECTED,
        function() wx.wxLaunchDefaultBrowser('https://developer.steinberg.help/display/HSD/'..ref, 0) end)
    end
  end
}
Adds "Show Reference" option to the editor popup menu. It should open your default browser and display the reference of the function you have right-clicked.

Image
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

misohoza
Member
Posts: 869
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: ZeroBrane Studio custom API for auto-completion

Post by misohoza » Wed Apr 17, 2019 4:18 pm

Updated for Halion 6.3

ZBS Halion 6.3.zip
(19.24 KiB) Downloaded 27 times
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest