# ZeroBrane Studio custom API for auto-completion

**URL:** <https://forums.steinberg.net/t/zerobrane-studio-custom-api-for-auto-completion/100599>\
**Category:** HALion\
**Tags:** halion-6, halion-sonic-se-3, sound-design, scripting\
**Created:** [November 28, 2017, 2:16am UTC](https://forums.steinberg.net/t/zerobrane-studio-custom-api-for-auto-completion/100599 "2017-11-28T02:16:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![misohoza](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@misohoza](https://forums.steinberg.net/u/misohoza)\
**Post date:** [November 28, 2017, 2:16am UTC](https://forums.steinberg.net/t/zerobrane-studio-custom-api-for-auto-completion/100599/1 "2017-11-28T02:16:41Z")

</div>

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

[ZBS Halion.zip](https://forums.steinberg.net/uploads/short-url/r8IfjR2GN6eMuLa0zIwz8xIXQ1E.zip) (14.5 KB)  
How to install:

Download and extract the attachment.  
Place the _halion.lua_ file into this folder:

```nohighlight
ZeroBraneStudio/api/lua

```

Place the _halionKeywords.lua_ file into:

```nohighlight
ZeroBraneStudio/packages

```

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

```nohighlight
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.

---

<div class="post-metadata">

**Author:** ![misohoza](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@misohoza](https://forums.steinberg.net/u/misohoza)\
**Post date:** [December 3, 2017, 8:42pm UTC](https://forums.steinberg.net/t/zerobrane-studio-custom-api-for-auto-completion/100599/2 "2017-12-03T20:42:29Z")

</div>

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](https://forums.steinberg.net/uploads/short-url/vdUj6OfEGNtXn5xbf6ejaqHX7sU.zip) (2.16 KB)  
Files need to be placed in:

```nohighlight
ZeroBraneStudio/packages

```

**halionhelp.lua**

```nohighlight
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.

![](https://i.imgur.com/173bmTL.png)

**halionshowreference.lua**

```nohighlight
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.

![](https://i.imgur.com/YwOnwti.png)

---

<div class="post-metadata">

**Author:** ![misohoza](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@misohoza](https://forums.steinberg.net/u/misohoza)\
**Post date:** [April 17, 2019, 3:18pm UTC](https://forums.steinberg.net/t/zerobrane-studio-custom-api-for-auto-completion/100599/3 "2019-04-17T15:18:48Z")

</div>

Updated for Halion 6.3

[ZBS Halion 6.3.zip](https://forums.steinberg.net/uploads/short-url/ma9mE6dXDo98ANHLUODt77wa5dm.zip) (19.2 KB)

---

<div class="post-metadata">

**Author:** ![misohoza](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@misohoza](https://forums.steinberg.net/u/misohoza)\
**Post date:** [March 4, 2020, 6:22pm UTC](https://forums.steinberg.net/t/zerobrane-studio-custom-api-for-auto-completion/100599/4 "2020-03-04T18:22:00Z")

</div>

Updated for Halion 6.4

[ZBS Halion 6.4.zip](https://forums.steinberg.net/uploads/short-url/6rkM3uzcNKF4SjaMxyu0Q6taq01.zip) (20.5 KB)  
You can also download it from here:[GitHub - misohoza/halion-zbs: ZBS Halion 6.4](https://github.com/misohoza/halion-zbs)
