Why does this Library not load?

Freeform discussion about anything related to modding Transcendence.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

https://dl.dropboxusercontent.com/u/381 ... tility.xml

And why are there no useful error messages for people trying to create libraries?
Literally is the new Figuratively
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

line 139 has a missing parenthesis at the end of the line.

line 149 has a missing parenthesis at the end of the line.

line 179 has a missing parenthesis at the end of the line. (setq angle (add (item configList repeat) fireAngle) should be (setq angle (add (item configList repeat) fireAngle))

line 274 has a "(block nil)" while it should be "(block nil"


I made a paste with the modifications:
http://paste.neurohack.com/view/Y8nmx/
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

When I tried it, I at least got a useless error:

1. I copied the library to Extensions
2. I added a reference to it from SomeExtension.xml (e.g., <Library unid="0xDA7AE000"/>)
3. On load I got: "Line 286: = expected"

The problem, I believe is that the code in <Globals> has embedded tags. E.g., on line 286 it reads:

Code: Select all

; Use in <OnUpdate with AU_AmmoBoxHandler in <OnFireWeapon>
The <OnUpdate and <OnFireWeapon> comments are using XML tags, which are confusing the parser (because the XML parser doesn't know about TLisp comments).

The easiest solution is to wrap the whole thing in a CDATA block:

Code: Select all

<Globals>
<![CDATA[

....

]]>
</Globals>
A better fix is to have the game automatically assume that <Globals> is a CDATA block.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

All I was getting was that the extension that referenced it referenced a disabled library. That's not a helpful error message.
Literally is the new Figuratively
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

The <OnUpdate and <OnFireWeapon> comments are using XML tags, which are confusing the parser (because the XML parser doesn't know about TLisp comments).
oh, wow, didn't notice that at all.

I better make sure not to use <> into any comments in my Globals.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

digdug wrote:
The <OnUpdate and <OnFireWeapon> comments are using XML tags, which are confusing the parser (because the XML parser doesn't know about TLisp comments).
oh, wow, didn't notice that at all.

I better make sure not to use <> into any comments in my Globals.
George's <![CDATA[]]> solution lets me at least start getting actual error messages.
Literally is the new Figuratively
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

Unfortunately, the <![CDATA[ ... ]]> solution is not without flaw. When enclosing you tLisp code in a CDATA-block, the parser does not correctly parse &foo; entities :(

~Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

pixelfck wrote:Unfortunately, the <![CDATA[ ... ]]> solution is not without flaw. When enclosing you tLisp code in a CDATA-block, the parser does not correctly parse &foo; entities :(

~Pixelfck
Ugh--I forgot about that.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Well, I found a better way to rewrite the only thing that was using a entity so that's not crippling in this case.
Literally is the new Figuratively
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

Also, I suppose that in this case we can use straight UNID numbers to avoid the problem.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Perhaps it would help to have a universal Transcendence interpreter comment that's chopped out before the file goes to the xml interpreter.
Literally is the new Figuratively
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

I honestly will never understand, why would anyone comment like this:

Code: Select all

; this is a comment, and devious potential bug if white-spacing isn't correct
When you can use:

Code: Select all

<!-- Anything between these marks is ignored by the XML parser -->
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

And yet enough people find cr/lf terminated comments easier to use that C++ implemented them where C lacked them.
Literally is the new Figuratively
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

; comments only comment out anything that is behind them, and on the same line.

<!-- --> comments will comment out everything between the first set of symbols, and the second. This has a few minor disadvantage: Every time you type it down, the code editor will, if it have highlighting features, highlight the WHOLE file starting from the <!-- to the end. Another disadvantage is that if you forget to type in the --> at the end of your comment, it can take a chunk of your code as comments as well.

To put it shortly, the ; comment is more specific and easier to control, and the <!-- --> is for longer comments spanning multiple lines, but is harder to control.
Yes, look at my avatar, I have a wyvera type ship.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

The ; comment is also far handier for commenting out single lines of code.
Literally is the new Figuratively
Locked