multiple dependable button toggle / button step lua syntax | Intech Studio
💬 general Grid

multiple dependable button toggle / button step lua syntax

alex
alex · · 3 replies

Hi there,
I’ve got a quite big multi part question 🙈

I’m controlling a lighting software (madmapper) with grid. In that software I’ve got multiple cues eg cue 1 through 7 and each cue has several variations (between 3-7 each. Now I programmed the following in Grid and everything works as expected.

element[0] is a toggle, each toggle outputs a different cc. this toggles between the main cues 1 through 7

element[4] is also a toggle but the output is dependent on element[0]. so if element[0] is at cue 2 it toggles all variations of cue 2

question 1 (screenshot 1): what is the correct syntax for button steps? I want to put everything in one codeblock rather than using action blocks for steps because with action blocks I’ve reached maximum character limit with only 4 steps.

question 2 (screenshot 2+3): I easily reach the 390 character limit. Is that the absolute limit or can I go above that somehow? Also is there a smarter less redundant way to code this? I already put element[0]:button_value() in a variable to safe characters but the “midi_send()” command is quite long.

Am I asking to much in general? I’ve only got a 3 toggle top layer and barely a 2 toggles dependable working without reaching the character limit. But I was aiming for 7 toggles for each. That way only 2 buttons could output 49 midi signals.

Thank you in advance! I’m super happy with grid and love learning to code for it. Maybe my plan with 7 toggles each is just a little to ambitious 😅

Replies (3)

alex alex ·

update:
I just learned about lookup tables.
Chatgpt recommended the following to drastically shorten my code. Will test it further tomorrow 🙂

local t={ [0]=1, [63]=2, [126]=3 }
if t[val1] then midi_send(0,176,t[val1],20) end

kkerti kkerti ·

If you select an action block (or multiple action blocks) on the action chain - below the events - next to the copy paste buttons is a "merge as code" button, which transforms the action blocks to code. That's a quick way to consolidate blocks into code.

kkerti kkerti ·

We are working on a huge release which impacts 3 key areas of Editor: the editor app itself, profile cloud and the firmware for the modules. Unfortunately this release became interlinked, so without completing all of them, can't release any of them. But once this next release is ready, the character limit should be doubled.

Discord

View on Discord

This post is from the Intech Studio Discord community.

Open thread →