weird error when using // outside structures in code

 // test comment
 <type name="sometype">
   <testattribute type="string"></testattribute>
 </type>
</asl>

This will produce that extremely annoying error:

Failed to load game due to the following errors:

  • Error: Object reference not set to an instance of an object.

if I remove the comment Quest runs fine.
if I move the comment like so:

 <type name="sometype">
   <testattribute type="string"></testattribute>
 </type>
 // test comment
</asl>

Quest runs fine.

I realized this has been a source of many of the problems I have come across. I am very new to coding. Is this an improper way to document code?


// is used to put comments in a script. It is treated as a script instruction that does nothing. So you can only put it where you can put a script instruction. You can't put it outside a script; and I believe you also can't put it directly in a switch block.

Comments in the XML should be XML comments: <!-- comment goes here -->


Log in to post a reply.

Support

Forums