Parser error when modifying the monsters file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Glorfindel
    Apprentice
    • Mar 2019
    • 62

    Parser error when modifying the monsters file

    I don't know the first thing about coding, so I am a bit lost. I decided to try modifying the monster file today. Nothing elaborate, just a name change. When I first tried modifying it and opened Angband, I was told there was a parse error, and then the game closed down. I looked around the forum, and found that I might do better using Notepad++. So I downloaded that, and tried again. I didn't get the same error, which is perhaps an improvement, but I got another one saying "parser_getval error: name is name"; after I clicked OK the game again shut down. After further experimentation I found that there was no objection to my changing the monster description, but only the name. What am I doing wrong?
  • Glorfindel
    Apprentice
    • Mar 2019
    • 62

    #2
    Oops, this was not supposed to be in the AAR! How do I move this into general Angband?

    Comment

    • wobbly
      Prophet
      • May 2012
      • 2633

      #3
      Look in the user directory and see if you have a lore file (where monster memory is kept). Try deleting that. You'll get parser errors if you have monster memory for a non-existant monster.

      Comment

      • Nick
        Vanilla maintainer
        • Apr 2007
        • 9647

        #4
        Thread moved
        One for the Dark Lord on his dark throne
        In the Land of Mordor where the Shadows lie.

        Comment

        • Glorfindel
          Apprentice
          • Mar 2019
          • 62

          #5
          Thank you. Problem solved. I'll miss the lore for a while, though.

          Comment

          • Glorfindel
            Apprentice
            • Mar 2019
            • 62

            #6
            Here I am, resurrecting my old thread. I tried to do the same kind of modifications as I referred to above in the latest edition of Angband, and I got a new parse error which could not be solved by deleting the lore. It says 'Parse error in monster line 1 column 1.'

            Although someone could probably walk me through this and eventually solve my problems, I suspect it would take several botched attempts on my part, asking help on each one. I ca'n't help but think it would save time for all concerned if somebody was willing to make my changes for me and post the modified monster file. Would anybody be willing to bother? My thanks in advance to anyone who does.

            Comment

            • wobbly
              Prophet
              • May 2012
              • 2633

              #7
              Firstly what are you using as your text editor? Mearly opening and saving with notepad will give you a parser error. With a decent editor you'll have line numbers, the fact that your error is on line 1 makes me suspicious your using an editor thats not right for the job.

              Comment

              • wobbly
                Prophet
                • May 2012
                • 2633

                #8
                Originally posted by Glorfindel
                Although someone could probably walk me through this and eventually solve my problems, I suspect it would take several botched attempts on my part, asking help on each one. I ca'n't help but think it would save time for all concerned if somebody was willing to make my changes for me and post the modified monster file. Would anybody be willing to bother? My thanks in advance to anyone who does.
                We could make a deal where I edit your monster list for you and you do 100 push ups for me every morning but I suspect I wouldn't get any fitter and you'd be no better at changing edit files. I think I'll pass.

                Comment

                • Gauss
                  Adept
                  • Aug 2018
                  • 110

                  #9
                  Try using Atom or Vscode or some other proper editor. What i don't understand is that line 1 is a comment so theoretically it should be ignored by the parser, altough i don't know where the source file that contains the parser is.

                  Comment

                  • Glorfindel
                    Apprentice
                    • Mar 2019
                    • 62

                    #10
                    Originally posted by wobbly
                    Firstly what are you using as your text editor? Mearly opening and saving with notepad will give you a parser error. With a decent editor you'll have line numbers, the fact that your error is on line 1 makes me suspicious your using an editor thats not right for the job.
                    I am using a program called 'Notepad++', which is distinct from 'Notepad', and which was at one time generally recommended on this forum as the best text editor for file editing in Angband. Here is the link.

                    We could make a deal where I edit your monster list for you and you do 100 push ups for me every morning but I suspect I wouldn't get any fitter and you'd be no better at changing edit files. I think I'll pass.
                    I know that such a course of action as I have suggested would do nothing to improve my changing edit files, but all of my previous efforts have produced similarly incomprehensible errors. I am inclined to suspect that I am doing something so basically wrong that I would actually need some training in coding to even see what it is. At any rate, have no fear that I am looking on this as something I am entitled to. I just thought that

                    1) People on this forum are generally pretty helpful, and someone just might do it to be nice; and

                    2) I really do mess up so much trying to do this that whoever is instructing me would spend less time doing the whole thing himself than by telling me how to do so.

                    Anyway, there is certainly no pressure for you to do it. If I ever do go in for editing on a larger scale than a couple of names, I will of course have to get the hang of doing it for myself.

                    Try using Atom or Vscode or some other proper editor.
                    Do they have some advantage over Notepad++? I saw it being recommended in the first place as a 'proper editor' contrasting with Notepad in just the same way you seem to be advising Atom and Vscode, but I haven't had any real luck with it.

                    What i don't understand is that line 1 is a comment so theoretically it should be ignored by the parser, altough i don't know where the source file that contains the parser is.
                    If you don't know, I am certainly helpless. I am a regular infant in my knowledge of these things.

                    Comment

                    • wobbly
                      Prophet
                      • May 2012
                      • 2633

                      #11
                      All good. Apologises if I came over as lecturing. I suspect you'll have an easier time finding someone who'll point out where you are going wrong rather then someone who'll do it for you. Though I can only speak for myself.

                      I also use notepad++. As someone who had a lot of parser errors themselves I'm just trying to rule out the mistakes I made myself. It might help if you upload the broken monster.txt I'm not making any promises, not great at this myself but I'd be willing to look & see if I can spot where you are going wrong.

                      Comment

                      • Glorfindel
                        Apprentice
                        • Mar 2019
                        • 62

                        #12
                        I'm glad we're on a friendly footing.

                        I suspect you'll have an easier time finding someone who'll point out where you are going wrong rather then someone who'll do it for you.
                        Yeah, I never thought there was above a 50% chance of actually finding anyone who would do it all for me, but I thought it couldn't hurt to ask. I know that I probably wouldn't for someone else, just because it comes more naturally to tell someone how to do a thing like that then to do it oneself, even if it would actually be less work to do the latter.

                        It might help if you upload the broken monster.txt I'm not making any promises, not great at this myself but I'd be willing to look & see if I can spot where you are going wrong.
                        This is kind of you. Thank you very much. It certainly sounds like it will be simpler than trying to locate the problem by back-and-forth on the forum.

                        I seem to be running into a difficulty, though. The forum limits the size of .txt files it will upload to 19.5 KB, so I ca'n't upload the whole file. I tried uploading only the modified pieces (and the opening, as it contains line 1), but Notepad++ appears to be saving the pieces as 'All Files' by default, and when I try to upload them, the forum pronounces them to be invalid files. When I try to save them as .txt files, they still come out as merely 'Files', and are still invalid to upload. Whatever am I doing wrong this time?

                        Comment

                        • Pete Mack
                          Prophet
                          • Apr 2007
                          • 6883

                          #13
                          Recommend forgetting about trimming and just upload the file as a .zip archive. The size limit is bigger, and the file size will be smaller.

                          Comment

                          • Adam
                            Adept
                            • Feb 2016
                            • 194

                            #14
                            Originally posted by Glorfindel
                            I tried uploading only the modified pieces (and the opening, as it contains line 1), but Notepad++ appears to be saving the pieces as 'All Files' by default, and when I try to upload them, the forum pronounces them to be invalid files. When I try to save them as .txt files, they still come out as merely 'Files', and are still invalid to upload. Whatever am I doing wrong this time?
                            In notepad++ it's not enough if you choose the file type to be text, you need to manually add the .txt file extension to the file name. Yes, it's a stupid thing - i agree. But actually Pete is right that you should zip the whole file and upload.

                            I don't have much experience in C programming but the parse error can come from invalid bytes in any language I guess and no matter if it's a comment line.
                            I think line 1 column 1 may mean a BOM (byte order mark) which the parser does not tolerate. But it's just guessing without seeing the file itself (and not knowing the parser code).

                            Comment

                            • Glorfindel
                              Apprentice
                              • Mar 2019
                              • 62

                              #15
                              Thank you, Pete. Here is the zip file, wobbly. Thank you again.
                              Attached Files

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎