how can I combine two functions on CC in local variables? | Intech Studio
💬 general Grid

how can I combine two functions on CC in local variables?

Demetrisag
Demetrisag · · 1 replies

with the help of chatgpt, some presets and stuff I found here and countless hours I managed to get two pages working the way I want them. One is rotating the en16 grid
system code is

function rotIndx(i)
    local r, c = i // 4, i % 4
    return rot == 1 and (3 - r) + c * 4 or rot == 2 and (3 - r) * 4 + (3 - c) or rot == 3 and r + (3 - c) * 4 or
        r * 4 + c
end```
so I change the number of local rot to anything I like. this function affect any knob that on the local CC value has this ```rotIndx(self:element_index(),module_rotation())```

and another page which I use one knob as toggle to move all my CC and notes value higher so I can use it as a bank, so the system code for this is
```s, n = 0, 60
function t()
    s = 1 - s
    n = 1 - n
end
function e_cc(x)
    return (s * 16) + x
end
function e_note(x)
    return (n * 16) + x
end```  

and the button I trigger it is
```if self:button_state() > 0 then
    t()
end```

(Codes are super compact so I can combine them)

and this affect any knob that on the local CC value has this ```e_cc(self:element_index())``` 
the relative same of course goes for buttons for both functions


Now my question is. I want to combine both of these in one page!  If I put both codes on the system page then I try adding   e_cc  to this ```rotIndx(self:element_index(),module_rotation())``` like that  ```e_cc+rotIndx(self:element_index(),module_rotation())``` but it doesnt work, if I try like that ```e_cc, rotIndx(self:element_index(),module_rotation())``` the whole thing crashes. How do I do this correctly?

Replies (1)

Demetrisag Demetrisag ·

just to clarify I dont want to switch banks and rotate at the same time. If I want to change bank then this will only be a bank and not rotation. rotation is only if I want to move the unit around and the cable or leds are anooying me

Discord

View on Discord

This post is from the Intech Studio Discord community.

Open thread →