Programmers! Need your help with "unexpected text" error in X-Studio.

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
redagent
Posts: 41
Joined: Fri, 20. Feb 15, 05:29

Programmers! Need your help with "unexpected text" error in X-Studio.

Post by redagent » Thu, 26. Feb 15, 20:46

I am trying to run "STO 1.57 - overtake sectors" script in X3:AP 3.1.
Also trying to use X-Studio for editing some small things.

Loading my game folder X-studio failed to load t-file from this script.
X_Studio Compiler found this:
"Unable to merge the supplementary language file 'addon\t\7410-L044.xml' with the game data"

X-Studio couldn't open 7410-L044.xml
report:
Unexpexted text '//morale after takeover ' was detected on the line 214 of 7410-L044.xml

1. I am not a programmer and I do not understand what it means.
2. Is it critical error that could makes game crash/freez or it is just a minor (read-text) error and I can use this script in my game?
3. Or mayby I can fix it editing few symbols?
4. Is that conflict means that I cannot use this script in my game?
5. Is that compatible with X3:AP? Did somebody tested it?


Programmers please help me!

P.S. Also I am very interested in the fresh script that could replace this one - all I need is to claim xenon sector with spawn suppresion and rename unknown sectors.
For example Improved Races 2.0 do not stop xenon spawn in claimed sectors.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24962
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Thu, 26. Feb 15, 21:52

redagent wrote:1. I am not a programmer and I do not understand what it means.
The error means what it says: There's a text, and the error message says which text in which line, which X-Studio doesn't expect to be there. To elaborate this, in different programming and scripting languages everything behind a double slash "//" is considered to be a comment and a comment is ignored when the program / script code is executed. In xml files or more specifically in egosoft text files, there are however two other methods to write comments. One, the following, is to be used outside of text id and/or page id tags:

Code: Select all

<!--this is a comment-->


The other is to write a comment in parentheses within the actual text id tags:

Code: Select all

<t id="1">This is the normal text, which will be displayed in the game.(This is a comment, which won't be displayed in the game.)</t>
These two methods are the 'proper' way of commenting and show what X-Studio expects to find as a comment. While the comments in the STO text file are simply seen as text outside of the usual xml structure and are therfore unexpected.

So to answer your questions, no it's not a critical error and won't cause any crashes, freezes or other problems. You should be able to run the STO script just fine in X3AP, provided it's properly installed to the "addon" directory (see also this FAQ article for reference). I'm pretty sure that there are already reports about people using STO in X3AP in the STO topic. I don't know what you mean with regards to the "fresh script" though, as the support for STO is discontinued.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

User avatar
dizzy
Posts: 1019
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Thu, 26. Feb 15, 22:07

Did X-Studio finish loading successfully and you are able to open (from VFS) and edit scripts?

Was this X-Studio 1 or 2?

Anyway, if I were you, I would delete line 214 from 7410-L044.xml. Maybe X2-Illuminatus is right and the game XML parser/loader will ignore it anyway but it is invalid XML syntax nonetheless and should be fixed by converting it to a proper XML comment or remove it. Note that it's likely the file contains more similar broken comment lines that will need fixing/removal.
X3LU 1.5.2/1.7.0 Youtube series with: IEX 1.5b + LUVi, SIaF r7 (previously also used Phanon Plus 4.02, Revelation Plus 1.04, Diverse Game Starts - LU Edition)
[ external image ]

User avatar
solarahawk
Posts: 257
Joined: Sat, 22. Dec 07, 23:18
x4

Post by solarahawk » Thu, 26. Feb 15, 22:11

P.S. Also I am very interested in the fresh script that could replace this one - all I need is to claim xenon sector with spawn suppresion and rename unknown sectors.
For example Improved Races 2.0 do not stop xenon spawn in claimed sectors.
There aren't any "fresher/newer" scripts than STO. STO is about good as it gets though there are other alternative scripts than can allow you to tak eover sectors. You can't disable Xenon spawns though. That, unfortunately, is unchangeable. (Though maybe the changes under the hood that Litcube's Universe makes, might make it possible eventually to alter that for normal Xenon. I don't know about that yet.)

For now, if you takeover a Xenon sector, you will have to stage appropriate in-sector security/lasertowers to obliterate the new Xenon spawns that show up. Consider it a story opportunity. Even though you "took" that sector away from the Xenon, they refuse to give it up and continue to send ships looking for a way to reclaim it. (Of course it is a bit mysterious how these ships seem to appear from nowhere...)

redagent
Posts: 41
Joined: Fri, 20. Feb 15, 05:29

Post by redagent » Thu, 26. Feb 15, 23:42

Thanks for your replies X2-Illuminatus, memeics and solarahawk!
memeics wrote:Did X-Studio finish loading successfully and you are able to open (from VFS) and edit scripts?
Yes. And Yes - all of them except one - 7410-L044.xml.
memeics wrote: Was this X-Studio 1 or 2?
X-Studio 1.08 (14.02.14) - checked for updates - found nothing newer.
memeics wrote: Anyway, if I were you, I would delete line 214 from 7410-L044.xml.
And how the script will get the values it needs? there is references from two script files to this line.
memeics wrote: Maybe X2-Illuminatus is right and the game XML parser/loader will ignore it anyway but it is invalid XML syntax nonetheless and should be fixed by converting it to a proper XML comment or remove it. Note that it's likely the file contains more similar broken comment lines that will need fixing/removal.
Lets assume it is only comment issue - I would like to fix it.
May be you would help me at least with adwise?
(What to open? How and what to edit?)
Here is that part of code. And the mentioned line with phrase "morale after takeover". But it looks like the other ones - text commented like in the neigbour lines. Why then it causes error?

Code: Select all

<!-- STO planetary production 10000 - 49999 -->
       <t id="10000">begin of planetary production</t>
       <t id="10001">none</t>
       <t id="10002">0</t>// number of inhabitants after takeover (for common race)
       <t id="10003">100</t>// morale after takeover
       <t id="10005">\033GSTO\033X planetary production</t>
       <t id="10100">%s %s production facility</t>// name for production facilities
Apologize for Grammar! English is not my first language.
Played X2 for months. Played X3 for years. Played XR for one week. Now playing X3...

User avatar
dizzy
Posts: 1019
Joined: Sun, 26. Sep 10, 06:00
x4

Post by dizzy » Fri, 27. Feb 15, 00:10

Ah I see, then don't remove the whole line (you're right that at least part of it is useful) but you can remove any line contents after the first "//". But may be a pointless effort if X-Studio or the game don't mind it that much.

At least from the lines you have shown ("// ..." may still be important content but only if it's inside quotes and such). Seems like whomever wrote these files was too used to C++ coding :)
X3LU 1.5.2/1.7.0 Youtube series with: IEX 1.5b + LUVi, SIaF r7 (previously also used Phanon Plus 4.02, Revelation Plus 1.04, Diverse Game Starts - LU Edition)
[ external image ]

redagent
Posts: 41
Joined: Fri, 20. Feb 15, 05:29

Post by redagent » Fri, 27. Feb 15, 01:22

Ok. I am trying to comment all that text beginning from "//..."
After commenting

Code: Select all

<t id="10003">100</t>// morale after takeover 
X-Studio reported the same error about next string with "//..."

Code: Select all

 <t id="10100">%s %s production facility</t>// name for production facilities
But I did not get just one thing - why X-studio skipped the string

Code: Select all

 <t id="10002">0</t>// number of inhabitants after takeover (for common race) 
It comes earlier than the other strings with the same "comment" issue.

I found that X-Studio skips ANY first string with "//..." and reports only about next.

EDIT. I commented all strings with "//..." in MS Visual Studio and X-Studio agreed to open the file.
Success!
Last edited by redagent on Fri, 27. Feb 15, 05:02, edited 1 time in total.
Apologize for Grammar! English is not my first language.
Played X2 for months. Played X3 for years. Played XR for one week. Now playing X3...

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Fri, 27. Feb 15, 03:26

Everything in an XML document must be inside a valid pair of tags.

XML comments are in the form:

Code: Select all

<!-- This is a comment -->



X3 further allows parentheses as comment tags, but only inside of a valid tag pair:

Code: Select all

<t id="1234">42(This is a comment)</t>



The "//" marks are not valid comment characters in XML. (They are valid in C-style languages.)

Text *outside* of valid tag pairs are also invalid in XML.

So the way to fix the bad comments is:

Code: Select all

<t id="1234">stuff(This is a valid entry)</t> <!-- // This is NOT valid until we wrap it inside of comment tags. -->

In other words, add <!-- before the "//" and --> at the end of the comment.

redagent
Posts: 41
Joined: Fri, 20. Feb 15, 05:29

Post by redagent » Fri, 27. Feb 15, 05:01

DrBullwinkle wrote:Everything in an XML document must be inside a valid pair of tags............
Why your reply wasn't the first one - it is the most suitable for barbarian like me :lol:

If you went to work as a teacher, you would definitely be able to succeed in this
Apologize for Grammar! English is not my first language.
Played X2 for months. Played X3 for years. Played XR for one week. Now playing X3...

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”