Page 1 of 1

Can't begin Ionics missions - SOLVED

Posted: Sat May 02, 2009 4:08 pm
by Diziet Sma
Today I installed the Ionics v1.2.2 oxp. The ships are in the game, but no matter how often I go to Zaria the mission won't launch. Checking through the archives I see potential conflicts with Thargoid wars and Military Fiasco, but I don't have those installed.

I'm running Oolite v1.72.2 on Win XP, and have just now thought to check the log files, where I found the following entry:

Code: Select all

[plist.parse.foundation.failed]: Failed to parse AddOns/ionics-1.2.2.oxp/Config/script.plist as a property list using Foundation. Retrying using homebrew parser. WARNING: the homebrew parser is deprecated and will be removed in a future version of Oolite.
Parse failed at line 1 (char 19385) - reached end of string in comment
  [plist.homebrew.parseError]: Property list isn't in XML format, homebrew parser can't help you.
Line 1 char 19385 turns out to be the final character in the file, and I'm assuming that "reached end of string in comment" indicates that the parser is treating the entire script.plist as a comment. But where I go from here, I have no idea...

Can anyone help?

Posted: Sat May 02, 2009 10:10 pm
by Eric Walch
Very weird. A few weeks ago I changed quite a bit in the structure of this script and re-uploaded it as version 1.2.2 . The version you now have. This version should now even work well in combination with the ones you mention. Both my syntax checkers said it was a valid plist and I even played the mission twice before uploading.

I am on a mac. It would be interesting if other window users have a similar problems with this file. Never had it before but the "script.plist" could contain a hidden character that only affects windows and not mac?

Posted: Sat May 02, 2009 11:43 pm
by _ds_
Eric Walch wrote:
Very weird. A few weeks ago I changed quite a bit in the structure of this script and re-uploaded it as version 1.2.2 . The version you now have. This version should now even work well in combination with the ones you mention. Both my syntax checkers said it was a valid plist and I even played the mission twice before uploading.

I am on a mac. It would be interesting if other window users have a similar problems with this file. Never had it before but the "script.plist" could contain a hidden character that only affects windows and not mac?
You have C++-style comments in that file. You have Mac-specific line endings, i.e. CR as opposed to CRLF or LF. Evidently, GNUstep on Windows isn't coping with this.

Here, nano recognises the line ending type correctly, but joe doesn't; it thinks that the file's content is a single, 19K-long line. (I've not checked other text editors.)

The following incantation¹, uttered in the presence of GNU grep and findutils, will fix the problem (so long as MacOS handles plain LF line endings without problems, which AFAIK is indeed the case):

Code: Select all

grep -PlrIZ '\r(?!\n|$)' AddOns | xargs -0r sed -i -e 's/\r/\n/g'
Various files here show Mac line endings, though in some cases not exclusively so. (Those which contain XML are fine, but should really be fixed anyway.)

Executive Spaceways v2.2.oxp/Models/strelka.dat
Executive Spaceways v2.2.oxp/Models/trident.dat
Executive Spaceways v2.2.oxp/Models/gemini.dat
RandomHits275.oxp/AIs/randomhitsshieldnodeAI.plist
Saleza v2.oxp/Models/bellatrixturret.dat
Saleza v2.oxp/Models/bellatrix.dat
Saleza v2.oxp/Config/shipyard.plist
caduceus.oxp/Config/shipdata.plist
ionics-1.2.2.oxp/Config/script.plist
hammer.oxp/Config/shipdata.plist
hammer.oxp/Config/shipyard.plist
thargoid_wars 4.3.oxp/Config/missiontext.plist

¹ Candles, chalk markings, specialised clothing and sacrifices are not required. This is not a hardware problem. ;)

Posted: Sun May 03, 2009 2:01 am
by Diziet Sma
Thanks Eric Walch & _ds_ !

That was enough info to get it working again! Good ol' TextPad to the rescue... When I choose "Save As" I get the option to save with Mac, PC or Unix style line endings. Mac was preselected, unlike with the other plists in the config folder, so it certainly looked as if that was the problem. So I changed it to PC line endings, shift-started, and, sure enough, when I dropped in to Zaria again, I got the announcement about Ionics Corp supplying ships to Ramaza, so I'd say I'm on my way!

Now I guess I ought to do the same for the Caduceus, Hammer and RandomHits files you listed, although I've yet to see any problems with RH that I'm aware of.

Thanks again guys.. I love how quickly the talent on this board can pinpoint the source of problems.

Posted: Sun May 03, 2009 11:46 am
by Eric Walch
_ds_ wrote:
You have C++-style comments in that file. You have Mac-specific line endings, i.e. CR as opposed to CRLF or LF. Evidently, GNUstep on Windows isn't coping with this.
The C++ style comment has always been in the file. It was even the reason I did not use my plist editor, like I usually do. The plist editor ignores the comment on reading in and on saving the comment is gone.

Therefor I only used text-editor. I only used the plist editor for syntax checking. The missing linefeeds are normally no problem. The computer does not need the linefeeds to interpret the code. All code on a single line is just as good for him. The MAIN problem was probably my addition of "// comment" as a comment. This comment definition means to ignore the remainder of the line. For windows it was now interpret as to skip the remainder of the code. ouch! :cry:

The other comment type: "/** comment **/" has an end defined and was no problem. This comment type has always been in this code.

Anyhow I now used the X-code editor to save it. There I can explicit set line endings at window style (RCLF). Uploaded it again as Ionics.oxp 1.2.3

Posted: Sun May 03, 2009 1:25 pm
by Diziet Sma
Eric Walch wrote:
The missing linefeeds are normally no problem. The computer does not need the linefeeds to interpret the code. All code on a single line is just as good for him. The MAIN problem was probably my addition of "// comment" as a comment. This comment definition means to ignore the remainder of the line. For windows it was now interpret as to skip the remainder of the code. ouch! :cry:
To be honest, Eric, I suspect the issue actually was the CRLF thing more than the comments, because I never changed the comments or anything in the body of the file. All I did was re-save the file with PC style CRLF line endings, and that was enough for the parser to be able to read the file correctly. Once windows had something it recognised as a proper line-ending, it regarded the comment as terminated, and proceeded to treat the rest as code.

The whole CR or LF or CRLF thing has some interesting history behind it, worth reading for those curious about such things. Basically, the carriage return + linefeed that Windows insists on using is a holdover from the days of teletype machines and serial terminals.

Posted: Sat May 16, 2009 8:49 pm
by Eric Walch
Diziet Sma wrote:
The whole CR or LF or CRLF thing has some interesting history behind it, worth reading for those curious about such things. Basically, the carriage return + linefeed that Windows insists on using is a holdover from the days of teletype machines and serial terminals.
Very interesting that background story. I think even at the C64 you had to use CRLF. At least when addressing the matrix printer I had. As long-time mac user I was always aware of this difference between Mac and dos/windows. In your "interesting story" however I read that Mac uses CR until OS9. This line suggested that OSX does it different. It is true that OSX is UNIX based and UNIX uses LF only as line-endings.

So I loaded a program that showed the file content as hex-code and I noticed that the simple text-editor that ships with OSX does indeed use LF only as line endings. (Same does the mac plist editor) And as 90% of my uploads was saved with one of those two, and nobody complained about my earlier uploads, I may conclude that the windows version of oolite has no problem with LF alone.

The special thing with the ionics file was that is was saved with mac endings. Old OS style mac endings I must say. (But it still needed both items together for the bug being there).

I have learned something new with this: Mac now uses UNIX endings.

Posted: Sat May 16, 2009 9:20 pm
by DaddyHoggy
I think even at the C64 you had to use CRLF. At least when addressing the matrix printer I had
You remember correctly - I had this very issue printing the in-game maps I had built into my home coded turned based RPG - I owned a C= MPS 801 at the time. (7 pin dot matrix - so funny 'f', 'g', 'j', etc...)

Posted: Wed Jun 24, 2009 9:04 pm
by Capt. Slog
Eric Walch wrote:

So I loaded a program that showed the file content as hex-code and I noticed that the simple text-editor that ships with OSX does indeed use LF only as line endings. (Same does the mac plist editor) And as 90% of my uploads was saved with one of those two, and nobody complained about my earlier uploads, I may conclude that the windows version of oolite has no problem with LF alone.
Am playing Oolite on Windows and have no problems with LF. However when I was experimenting with Galactic Navy, I introduced CRLF to some plists creating a mixture. These plists did not work.