UI Panels Max Limit?

MTC84
MTC84 Member Posts: 71 Member
edited October 22 in Scripting Workshop

Hi,

I have hit a wall whilst coding a huge instrument using UI Panels. Can someone tell me if there is a limit on the number of UI Panels I can use within an instrument?

As soon as I add an extra code block and UI Panel attached to that control, I get a code error which previously passed the Apply test. I've already used a copy of the same code block and it works as it should. It almost feels like I might have hit a limit or something within Kontakt. I hope I am wrong.

I've triple checked my code for any mistakes but can't find any. It's frustrating because I am 7 controls away from done!

Thanks.

Comments

  • MTC84
    MTC84 Member Posts: 71 Member
    edited December 2023

    I'm still baffled with this one despite checking my code with fresh eyes. If anyone has experienced any weird behaviour when using over 20 UI panels, please get in touch. Many thanks.

    I have tested the code block in a separately and it works fine. I've no idea what is causing the (what appear to be random) code errors once I add it to my instrument build.

  • medusa
    medusa Member Posts: 98 Helper

    What's the error you get?

    There is a limit to the number of lines in the on init callback.

  • pscript
    pscript Member Posts: 2 Newcomer
    edited December 2023

    999x @ 6.5.0 <=

    I've noticed that it can behave irrationally (and the translator says nothing) when there are too many parentheses/operations in a single line (mathematical). Then, if you split it up, it suddenly calms down. Or it could do inexplicable things if not every image had a .txt, or its content wasn't appropriate. Unfortunately, only you have a chance to find the problem, it remains to comment out blocks, and then sooner or later you'll find what's causing it... But sure, it's not a limit.

    If the ICB (Init Callback) is too long(over 10k line), it causes a parser stack overflow, which can be resolved with the if(1=1) trick, where you place the overly long parts into it..  just do this procedure for as many code blocks until the stack overflow error disappears

    on init

    if (1=1)

    end if

    if (1=1)

    end if

    end on

  • MTC84
    MTC84 Member Posts: 71 Member

    Thanks for the replies and input.

    I don't think the on init call back is too long because i have already built 99% of this instrument before learning about UI Panels. I am basically using UI Panels to condense the code which has turned out to be a pain and is holding back from moving forward! I might end up bodging it so i use a combination of UI Panels and the long winded way i know works. Less elegant but gets me moving forward.

    The errors i get are totally random. The code line error it shows has already been checked and passed but as soon as i add a single new control it will show an error with something unconnected to the new control i added. The code is a copy and paste from something already functional and works perfectly when i test the code in a new instrument so i know my coding is correct. It is so strange! Hence my original question about limits.

    The code is way too big to share here so i can't really show whay is going on sadly.

  • medusa
    medusa Member Posts: 98 Helper

    I think there is a limit of 512 instances of any single widget type.

  • MTC84
    MTC84 Member Posts: 71 Member

    Thanks. Just so I am clear, what do you define as a widget within Kontakt's script? I'm a low skilled coder at best and always keen to learn.

    I will have a go at a hybrid method (mix of ui panels and the long way around) to see how that works out.

  • medusa
    medusa Member Posts: 98 Helper

    A widget is a GUI object type, like a slider, a knob, a label, a panel, etc

  • MTC84
    MTC84 Member Posts: 71 Member
    edited January 1

    Thanks very much.

    I wonder if it is as simple as me over stepping the 512 widgets limit in this case. The errors I got really were strange. Adding the 22 UI_Panels probably tipped me over the limit at a guess. Hopefully I will figure out a work around.

This discussion has been closed.
Back To Top