Skip to content

5.5 Assignable UI controls

Davide Magni edited this page Sep 1, 2016 · 4 revisions

The "Custom" page features a good amount of assignable UI Controls which can help the developer to trigger actions, get and set values and perform basic debugging operations.

This page is useful for a few different purposes:

  • Avoid using message() when you need to retrieve the value of a variable/function. By doing so, you can display more variables at a time and you leave the “message zone” free. This helps to find out if there are Script Warnings or such, which would be overlayed if a message() is used.

  • Avoid declaring temporary buttons or value edits to trigger simple actions (saving arrays, displaying something etc.)

Assignable Labels

The left-hand side features 10 assignable Text Labels. These can be used to display any value, be it the value of a variable or the result of a function. To use an Assignable Label, you need to add the following piece of code in the desired place in your script (it must be inside a callback, obviously!):

DEBUG.show_value(<id>,<variable>)

  • <id> is the number of the Label. When the label is not assigned, its ID is displayed. When a label is assigned, the ID will be replaced by the name of the variable or function displayed.
  • <variable> can be a variable, a position inside an array, a function, a constant, anything.

Assignable Buttons

You can assing up to 5 custom Buttons to perform up to 3 simple tasks, such as saving arrays, displaying values or triggering actions. To use an Assignable Button, you need to add the following piece of code at the very end of your script, outside any callback:

DEBUG.custom_button(<id>,<text>,<task_1>,<task_2>,<task_3>)

  • <id> is the number of the Button as displayed on the Button itself. When clicked, the ID will be replaced by the text inserted in .
  • <task_1>, <task_2> and <task_3> have to be replaced with a single line of code each. If you need to perform less than 3 tasks, just use the instruction empty.

Assignable Value Edits

You can assign up to 5 Value Edits to perform up to 3 simple tasks, such as setting a Parameter, triggering actions or such. To use an Assignable Value Edit, you need to add the following piece of code at the very end of your script, outside any callback:

DEBUG.custom_value_edit(<id>,<min>,<max>,<task_1>,<task_2>,<task_3>)

  • <id> is the number of the Value Edit as displayed on the Value Edit itself.
  • <min> and are the edge values of the Value Edit. The value of the Value Edit will be clipped to this couple of values.
  • <task_1>, <task_2> and <task_3> have to be replaced with a single line of code each. If you need to perform less than 3 tasks, just use the instruction empty.

Details about Assignable UI Controls and examples

Assignable Labels

The following script allows you to display these values:

*on Assignable Label 1, display the played note; *on Assignable Label 2, display the ENGINE_UPTIME of the played note; *on Assignable Label 3, display the triggered MIDI CC; *on Assignable Label 4, display the value of the MIDI CC.

on note 
DEBUG.show_value(1, EVENT_NOTE) 
DEBUG.show_value(2, ENGINE_UPTIME)
end on

on controller 
DEBUG.show_value(3, CC_NUM) 
DEBUG.show_value(4, CC[CC_NUM])
end on

Assignable Buttons

The following script allows you to save an array containing all the names of the MIDI notes and display a 2-slots message once this is done. Note that the task 3 is not used, so the instruction empty is used instead.

Each Assignable Button is declared, therefore it has a variable name. Each name follows this scheme:

DEBUG.custom_button_<id>

See the example below:

DEBUG.custom_button(1, "Save array", save_array(!NOTE_NAME, 1), message_2("Saved", ENGINE_UPTIME), empty) 

Assignable Value Edits

The following script allows you to set a Value Edit and display its value on an Assignable Label. Note that the tasks 2 and 3 are not used, so the instruction empty is used instead.

Each Assignable Value Edit is declared, therefore it has a variable name. Each name follows this scheme:

DEBUG.custom_ve_<id>

See the example below:

DEBUG.custom_value_edit(1, 0, 100, DEBUG.show_value(6, DEBUG.custom_ve_1), empty, empty)