[resolved]win build 1500 setValue issue (bug?)

Home Forums General Programming [resolved]win build 1500 setValue issue (bug?)

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #10986
    Hecticcc
    Participant
      • Topics: 25
      • Replies: 160
      • Total: 185
      • ★★

      In the panel i am working on i get errors with setValue() in build 1500, in 1449 i have no problems & all works as it should.

      Error i get is

      
      lua runtime error
      
      At line[-1]:[C]
      What:C
      Namewhat: method
      Name: setValue
      Error message: No matching overload found, candidates:
      void setValue(CtrlrModulator&,int,bool,bool)
      
      • This topic was modified 10 years, 9 months ago by Hecticcc. Reason: resolved
      #10987
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        setValue takes 2 boolean values, i’m sure you used to have 3, this all changed but your old setModulatorValue() calls should be fine, only the setValue() calls are different.

        The two boolean values are

        1. force – to force a change trigger even if the previous value was the same
        2. mute – controls MIDI output

        #10988
        atom
        Keymaster
          • Topics: 159
          • Replies: 2945
          • Total: 3104
          • ★★★★★

          When in doubt always have a look at:
          https://sourceforge.net/p/ctrlrv4/code/1503/tree/nightly/Source/Lua/CtrlrLuaModulator.cpp

          and the magic what() method in the console

          #10991
          Hecticcc
          Participant
            • Topics: 25
            • Replies: 160
            • Total: 185
            • ★★

            Thanks Atom, i found the offending scripts & modifying them now 🙂

            Could it be that a few revs ago setValue only took one bool? I had them setup that way in the scripts that produced this error and they worked until now.

            Cheerz,
            Hec

            #10993
            atom
            Keymaster
              • Topics: 159
              • Replies: 2945
              • Total: 3104
              • ★★★★★

              Well it did take one but a long time ago, it’s possible. I saw people using setModulatorValue() so i left that unchanged, i think i’ll bring back setValue() with one bool so that no more errors pop up.

              #10994
              Hecticcc
              Participant
                • Topics: 25
                • Replies: 160
                • Total: 185
                • ★★

                Mmmh, changing all to setValue(somevar,bool,bool) still gives the same error. I then changed them to the “old” way, setModulatorValur(x, bool,bool,bool) and this works again.

                Moral of the story – imme stick to the old way for now 🙂

                #10995
                atom
                Keymaster
                  • Topics: 159
                  • Replies: 2945
                  • Total: 3104
                  • ★★★★★

                  Please show me the exact code, it might be a type mismatch between int/bool.

                  #10998
                  Hecticcc
                  Participant
                    • Topics: 25
                    • Replies: 160
                    • Total: 185
                    • ★★

                    Simultane posting – always good for a laugh!

                    Yeah, if it does not break anything please do, less typing 🙂

                    #11000
                    Hecticcc
                    Participant
                      • Topics: 25
                      • Replies: 160
                      • Total: 185
                      • ★★

                      First fetch some midi data and trigger other functions when needed:

                      midiReceived = function(midi)
                      ID = midi:getLuaData():getByte(7)
                      LS = midi:getLuaData():getByte(9)
                      MS = midi:getLuaData():getByte(10)
                      ......
                      ....
                      ...
                      if ID == 44 then setSamplezoneRoot(LS,MS) end

                      ....
                      end

                      And then the “helper” function, this produces the errors:

                      function setSamplezoneRoot(x,y)

                      local rootnote = panel:getModulatorByName("sampleZoneRootNote")
                      rootnote:setValue(LS,false,true)

                      end

                      #11001
                      atom
                      Keymaster
                        • Topics: 159
                        • Replies: 2945
                        • Total: 3104
                        • ★★★★★

                        Ok i don’t know if i get it, you define LS in one method, and pass it to setSamplezoneRoot() as parameters named x and y but you never use that you use LS in that method, this will work almost always but the ALMOST is a big problem. The LS variable might be used uninitialized and passed in as “nil” and this will cause problems, it has to be int (nil is a special type)

                        #11002
                        Hecticcc
                        Participant
                          • Topics: 25
                          • Replies: 160
                          • Total: 185
                          • ★★

                          Lol i did not even spot this one!
                          I think i wrote this one in a sleepy moment, the other (similar) functions i wrote use the correct variables.

                          Thanks Atom!

                          #11003
                          Hecticcc
                          Participant
                            • Topics: 25
                            • Replies: 160
                            • Total: 185
                            • ★★

                            Yah, nil values have had me doing some funny stuff along the way. If it’s supposed to be an int value i force it to be 0 in the script that needs the value and then Lua is happy again – and me too 🙂

                            #11004
                            atom
                            Keymaster
                              • Topics: 159
                              • Replies: 2945
                              • Total: 3104
                              • ★★★★★

                              Well like i said you got lucky here, because ALL variables in Lua are global by default (unless declared local). But you should pay attention to the scope of your variables.

                              Also i recommend picking a naming scheme for your variables. If you keep them all caps it suggests constants for other developers, i try to sitck to lowercase notation, it’s an abbrevation of the hungarian notation: http://en.wikipedia.org/wiki/Hungarian_notation
                              i leave the type part, lua has no types. What i’m saying is, pick a method and stick to it.

                              #11006
                              Hecticcc
                              Participant
                                • Topics: 25
                                • Replies: 160
                                • Total: 185
                                • ★★

                                I just name the globals in caps to keep track of them 🙂
                                Thanks for the link, will keep it in mind for the future.

                              Viewing 14 posts - 1 through 14 (of 14 total)
                              • The forum ‘Programming’ is closed to new topics and replies.
                              There is currently 0 users and 91 guests online
                              No users are currently active
                              Forum Statistics
                              Threads: 2,495, Posts: 17,374, Members: 77,605
                              Most users ever online was 12 on January 22, 2019 3:47 pm
                              Ctrlr