HISE Logo Forum
    • Categories
    • Register
    • Login

    Syntax Error || Help? ||

    Scheduled Pinned Locked Moved Solved Scripting
    8 Posts 2 Posters 55 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.
    • ChazroxC
      Chazrox
      last edited by Chazrox

      Any ideas? Getting "7:13 Syntax Error"

      	if (presetFile.isFile())
      	{
      		ArpNotesPresets = presetFile.loadAsObject(); // "7:13 Syntax Error"
      	
      		// Manually extract keys
      		var keyList = [];
      		for (k in ArpNotesPresets)
      			keyList.push(k);
      	
      		ArpPresetList.set("items", keyList.join("\n"));
      	}
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • ChazroxC Chazrox marked this topic as a question
      • d.healeyD
        d.healey @Chazrox
        last edited by

        @Chazrox does your preset file contain valid json data?

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

        ChazroxC 3 Replies Last reply Reply Quote 0
        • ChazroxC
          Chazrox @d.healey
          last edited by Chazrox

          @d-healey it writes to it and populates the combobox so I assume its declared properly.

          but...ArpNotesPresetsA doesnt show up like the other files...clue?

          Screenshot 2025-07-11 at 8.01.46 PM.png

          **EDIT File icon is the same now.

          Upon recompiling thats when I get the Errror.

          Its lets me save as many items until I recompile then I get Syntax Errror.

          1 Reply Last reply Reply Quote 0
          • ChazroxC
            Chazrox @d.healey
            last edited by Chazrox

            @d-healey I fixed it....

            // I had this....
            
            const var ArpNotesPresets = {};
            
            // Should've been this....
            
            reg ArpNotesPresets = {};
            
            // Lesson learned 
            
            

            **EDIT See Below....

            1 Reply Last reply Reply Quote 0
            • ChazroxC Chazrox has marked this topic as solved
            • ChazroxC
              Chazrox @d.healey
              last edited by Chazrox

              @d-healey

              Im still having a problem with Syntax error. Im not changing the object but when I start testing if its writing values, after recompiling or saving a preset, it show 'Syntax Error'.

              Can you spot it? 🙏

              namespace ArpeggiatorPresetsSubMenu
              {
              	
              	//---------------------------COMPONENT DECLARATIONS--------------------------
              	
              	// COMBOBOX
              	const var ArpPresetList = Content.getComponent("ArpPresetList");
              	
              	// LABEL TEXT INPUT 
              	const var ArpPresetNameToSave = Content.getComponent("ArpPresetNameToSave"); 
              	
              	// SAVE OK BUTTON
              	const var ArpSaveOk = Content.getComponent("ArpSaveOk"); // SAVE OK BUTTON
              
              	//--------------------------FILE & OBJECT DECLARATION ------------------------
              	
              	// File path for saving/loading
              	const var presetFile = FileSystem.getFolder(FileSystem.Desktop).getChildFile("ArpNotesPresetsA.json");
              
              	// Declare object to hold presets
              	reg ArpNotesPresets = {};
              	
              	
              	//------------------------POPULATE COMBOBOX --------------------------------
              	if (presetFile.isFile())
              	{
              			
              		ArpNotesPresets = presetFile.loadAsObject();
              	
              		// Manually extract keys
              		var keyList = [];
              		for (k in ArpNotesPresets)
              			keyList.push(k);
              	
              		ArpPresetList.set("items", keyList.join("\n"));
              	}
              
              	//------------------------ SAVE PRESET ---------------------------------------
              	
              	inline function onArpSaveOkControl(component, value)
              	{		
              		if (!value)
              			return;
              		
              		local ArpPresetNameNOW = ArpPresetNameToSave.get("text").trim();
              		
              		// If no text entered, use current selected name
              		
              		if (ArpPresetNameNOW == "")
              		{
              			local selectedIndex = ArpPresetList.getValue();
              			if (selectedIndex <= 0)
              				return;
              		
              			ArpPresetNameNOW = ArpPresetList.getItemText(); // Use selected preset name
              		}
              	
              		
              		local TempoNOW = knbArpSpeed.getValue();
              		local NumStepsNOW = knbNumSliders.getValue();
              		local SwingNOW = knbArpShuffle.getValue();
              		local OctaveNOW = knbOctaveRange.getValue();	
              		
              		local NumSliders = knbNumSliders.getValue();
              	
              		ArpNotesPresets.Tempo = TempoNOW;
              		ArpNotesPresets.NumSteps = NumStepsNOW;
              		ArpNotesPresets.Swing = SwingNOW;
              		ArpNotesPresets.Octave = OctaveNOW;
              
              		
              		// Save to file
              		presetFile.writeObject(ArpNotesPresets);
              		
              		// Update ComboBox
              		local keyList = [];
              		for (k in ArpNotesPresets)
              			keyList.push(k);
              		
              		ArpPresetList.set("items", keyList.join("\n"));
              		ArpPresetList.setValue(keyList.indexOf(ArpPresetNameNOW) + 1);
              		ArpPresetNameToSave.set("text", "");
              	
              	};		
              	ArpSaveOk.setControlCallback(onArpSaveOkControl);
              	
              	//------------------ COMBOBOX PRESETS CONTROLS --------------------------------
              	
              	
              	
              }
              
              
              
              ChazroxC 1 Reply Last reply Reply Quote 0
              • ChazroxC
                Chazrox @Chazrox
                last edited by

                @Chazrox Leave us alone, we're learning alot tonight. 🤣

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

                  @Chazrox open the file in a text editor, make sure it contains what you expect

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

                  ChazroxC 1 Reply Last reply Reply Quote 1
                  • ChazroxC
                    Chazrox @d.healey
                    last edited by

                    @d-healey I got this working. I just need that loop. haha.

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

                    20

                    Online

                    1.8k

                    Users

                    12.1k

                    Topics

                    105.4k

                    Posts