HISE Logo Forum
    • Categories
    • Register
    • Login

    Hoping this is an easy one! Version number with 2 decimal places

    Scheduled Pinned Locked Moved Scripting
    19 Posts 2 Posters 427 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DanHD
      DanH
      last edited by DanH

      I'm trying to compare version numbers of my software but if I type a number with 2 decimal places:

      if (data.version < 2.0.1)
      

      I get the error:

      Interface:! Line 702, column 28: Found literal when expecting ')'
      

      One decimal place works just fine

      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
      https://dhplugins.com/ | https://dcbreaks.com/
      London, UK

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @DanH
        last edited by

        @DanH Try a string ""

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        DanHD 1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @d.healey
          last edited by

          @d-healey I did, it doesn't produce an error but nor does the callback fire....

          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
          https://dhplugins.com/ | https://dcbreaks.com/
          London, UK

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @DanH
            last edited by

            @DanH And data.version is definitely less than 2.0.1?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            DanHD 1 Reply Last reply Reply Quote 0
            • DanHD
              DanH @d.healey
              last edited by DanH

              @d-healey yes indeed!

              I remember I tried this yonks ago and it didn't work

              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
              https://dhplugins.com/ | https://dcbreaks.com/
              London, UK

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @DanH
                last edited by d.healey

                @DanH

                Works here (I'm using it for Rhapsody also). Both numbers need to be strings.

                f260dc5d-109f-45db-bfdf-d0956da24148-image.png

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                DanHD 2 Replies Last reply Reply Quote 0
                • DanHD
                  DanH @d.healey
                  last edited by

                  @d-healey said in Hoping this is an easy one! Version number with 2 decimal places:

                  @DanH

                  Both numbers need to be strings.

                  This might be where I'm going wrong in the data.... thanks

                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                  https://dhplugins.com/ | https://dcbreaks.com/
                  London, UK

                  1 Reply Last reply Reply Quote 0
                  • DanHD
                    DanH @d.healey
                    last edited by

                    @d-healey the data in the version file is simply

                    {
                      "version": "2.0.0"
                    }
                    

                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                    https://dhplugins.com/ | https://dcbreaks.com/
                    London, UK

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @DanH
                      last edited by

                      @DanH What do you see with

                      Console.print(data.version < "2.0.1");

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      DanHD 2 Replies Last reply Reply Quote 0
                      • DanHD
                        DanH @d.healey
                        last edited by

                        @d-healey said in Hoping this is an easy one!:

                        Console.print(data.version < "2.0.1");

                        I get "0"...

                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                        https://dhplugins.com/ | https://dcbreaks.com/
                        London, UK

                        1 Reply Last reply Reply Quote 0
                        • DanHD
                          DanH @d.healey
                          last edited by

                          @d-healey the below gives me an error though

                          Console.print(data.version);
                          

                          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                          https://dhplugins.com/ | https://dcbreaks.com/
                          London, UK

                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @DanH
                            last edited by

                            @DanH said in Hoping this is an easy one! Version number with 2 decimal places:

                            the below gives me an error though

                            You need to tell me what the error is.

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            DanHD 1 Reply Last reply Reply Quote 0
                            • DanHD
                              DanH @d.healey
                              last edited by

                              @d-healey

                              API call with undefined parameter 0
                              

                              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                              https://dhplugins.com/ | https://dcbreaks.com/
                              London, UK

                              d.healeyD 1 Reply Last reply Reply Quote 0
                              • d.healeyD
                                d.healey @DanH
                                last edited by

                                @DanH So data.version is undefined.

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

                                DanHD 1 Reply Last reply Reply Quote 0
                                • DanHD
                                  DanH @d.healey
                                  last edited by

                                  @d-healey yup struggling to figure out why though.... Here's a longer version of the script

                                  inline function loadVersionFile() {
                                  	local appDataDir = FileSystem.getFolder(FileSystem.AppData);
                                  	return appDataDir.getChildFile("Version.js");
                                  }
                                  
                                  inline function checkOnLoadSettings()
                                      {
                                  		local HVersion = loadVersionFile();
                                  		
                                      		if (HVersion.isFile())
                                      			{
                                  					local data = Engine.loadFromJSON("..//Version.js");
                                  					
                                  					if (data.version <"2.0.4")
                                  		   				 {
                                  								HUpdate_Panel.showControl(1);
                                  						 }
                                  			
                                  						else 
                                  							{
                                  								HUpdate_Panel.showControl(0);
                                  							}
                                  				 }
                                  		
                                  		else
                                  		{
                                  			HUpdate_Panel.showControl(1);
                                  		}
                                  		
                                  	}
                                  	
                                  checkOnLoadSettings();
                                  

                                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                  https://dhplugins.com/ | https://dcbreaks.com/
                                  London, UK

                                  d.healeyD 1 Reply Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey @DanH
                                    last edited by

                                    @DanH Use File.loadAsObject()

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    DanHD 1 Reply Last reply Reply Quote 0
                                    • DanHD
                                      DanH @d.healey
                                      last edited by

                                      @d-healey instead of ...?

                                      Also how do you get the red text in here? 😆

                                      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                      https://dhplugins.com/ | https://dcbreaks.com/
                                      London, UK

                                      d.healeyD 1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @DanH
                                        last edited by

                                        @DanH Code tags for red text (a single backtick at the start and end. `

                                        Instead of Engine.loadFromJSON() - You already went to the trouble to get the file object so you might as well use it.

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        DanHD 1 Reply Last reply Reply Quote 0
                                        • DanHD
                                          DanH @d.healey
                                          last edited by

                                          @d-healey Righto, thanks!

                                          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                          https://dhplugins.com/ | https://dcbreaks.com/
                                          London, UK

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post

                                          15

                                          Online

                                          1.8k

                                          Users

                                          12.1k

                                          Topics

                                          105.6k

                                          Posts