Exscriptor - new external script editor

The place to discuss scripting and game modifications for X³: Reunion.

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

Post Reply
Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Exscriptor - new external script editor

Post by Whimsy » Sat, 26. Jul 08, 18:10

==========
EXSCRIPTOR
==========

Summary
----------------
The Exscriptor is an (unofficial) external script editor for X2, X3, X3TC, and X3AP that allows you to:

- Open existing X2/X3/TC/AP scripts in both .XML and .PCK format
- Create new X2/X3/TC/AP scripts (.XML)
- Compile the script to check for any syntax errors
- Save scripts as .XML or in simple .TXT format

The editor uses the X2, X3, X3TC, and/or X3AP data files, so all the possible commands, wares, ships, stations and so forth will be available, including those present in unpacked mods or patches (but not files in the 'mods' directory). The program also supports the use of data files in different languages (though the editor's interface and the script commands themselves are only in English). Since X3 offers a large number of commands and objects, these are visible in a list onscreen, so you do not have to remember them all.

You will need Windows and the Microsoft .NET Framework for the program to run. You will also need either X2 or X3 or X3TC or X3AP installed (or all of them) as the editor uses the game's data files - it will ask you where to find them when it first runs.

Screenshot of interface: screenshot

Features of current version includes:

- Command Line version
- Preprocessor macros like foreach, for loops, and inline array initialisation.
- Prototype Script comparator, highlighting differences between two scripts.
- Checking of scripts for things like use of unassigned variables, invalid expressions, and if/while commands not matching up with corresponding else/ends.
- Backs up scripts (copying as a .bak) before overwriting them.
- Conflict viewer: view ID conflicts in language files.
- Change appearance - colours and fonts etc
- Check to see if script file has changed since you loaded it
- Lots and lots of bug fixes!

Current version is:
Version 1.2.43 - X3AP support, several more bug fixes and a few other minor improvements


Alternatively, why not try out mr.bear's X-Studio - a newer script editor with even more features? :)


Downloads:

V1.2.43 (For X3AP, X3TC, X3, and X2)
-------------------------------------
Use at your own risk and make regular backups!

From Blackpanthergroup (courtesy of Blacky_BPG - thanks!)
Available as an installer here or as a zip here.

From Mediafire:
Available as an installer here or as a zip here.


Thanks to all the people who have pointed out bugs and suggested improvements so far! :)

[Edited to update links to V1.2.43]
Last edited by Whimsy on Wed, 24. Jul 13, 01:01, edited 84 times in total.

Draakon
Posts: 218
Joined: Mon, 21. Jul 08, 16:02

Post by Draakon » Sat, 26. Jul 08, 18:15

Does this support EMP?

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Sat, 26. Jul 08, 18:30

Does this support EMP?
It should do. It checks the Type files for wares and then looks up their names in the language files, so if it appears in those then it should be in the editor. But I'm not 100% certain.

I know it works with XTM, though, and I think that uses the EMP?

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Post by Blacky_BPG » Sat, 26. Jul 08, 22:06

Ok, the idea is great, i love external SE for use with X3.
I used the X3-ExternalScriptEditor by Cool_SnipeR ... and i like it.
I wanted to test yours now because he reads the data directly from the X3 directory there.
But now the Problem:

Code: Select all

Unhandled Exception: System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 18961, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean prese
rveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at X3_Script_Editor.XData.loadLanguageFiles()
   at X3_Script_Editor.XData.initialise(String pathToX3, String lang)
   at X3_Script_Editor.Editor.Initialise()
   at X3_Script_Editor.Editor..ctor()
   at X3_Script_Editor.Editor.Main()
My configuration of X3:
- RAW-Mode (all cat/dat unpacked -> NO cat/dat in X3 dir)
- ONLY 49xxxx textfiles in t directory (yes, i changed the config.dat language to 49)
- XTM installed

QUESTION 1:
Can you add a advanced ErrorMessage with the file name to find the invalid character. Line 18961, position 1 file???

QUESTION 2:
I could not try it out yet but reads your program the script commands from the <codearray> or from the <sourcetext> section of a Script?

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sat, 26. Jul 08, 23:55

*Blinks* I wish I had heard of one of these sooner..
Dont suppose anyone could link me to the other so I can compare them?

Btw, how come neither are listed in the tutes + resources sticky



*Edit*
I'm having troubles running it, I'm running on Windows XP Service pack.. something with Net framework 3.5 and it wont open. When I start it goes to the command prompt black screen, I select my install directories, then that closes and it gives a generic error message
Exscriptor.exe has encountered a problem and needs to close. We are sorry for this inconvenience.

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Sun, 27. Jul 08, 00:42

Draakon wrote:Does this support EMP?
Okay, update on this - I tested it on a fresh install (X3 v2.5) with just the EMP and yes, it does work - but only wares that have been given names in a language file will show up. So if you want to use an EMP ware in the editor you need to give it a name first.
Blacky_BPG wrote:Can you add a advanced ErrorMessage with the file name to find the invalid character. Line 18961, position 1 file???
I've updated the program to beef up the error reporting - it should be better at reporting errors and now a log file (errorlog.txt) is made too. You can get the new version here - just unzip and copy over the old one (I'll edit the first post to update the links in a minute).

I'm a bit confused by your error though - I'm pretty sure it's having trouble loading your 490001.xml (that's the one I forgot to add the filename to). Could you open up that file and check that location to see if there's anything weird there? It shouldn't be the raw/unpacked stuff that's the problem - I tested that and it seems to work okay.
Blacky_BPG wrote:I could not try it out yet but reads your program the script commands from the <codearray> or from the <sourcetext> section of a Script?
It reads from the codearray. The program basically ignores the sourcetext when loading a script; when saving a new script it will generate both the codearray and the sourcetext so it should be visible both in and out of the game.
s9ilent wrote:I'm having troubles running it, I'm running on Windows XP Service pack.. something with Net framework 3.5 and it wont open.
It sounds like you might not have the latest .NET Framework installed. You can obtain it from Microsoft here - see if that fixes the problem. :)

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 27. Jul 08, 00:50

:( That's the Net framework that I have :(
I don't suppose your program makes an error log somewhere?

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Sun, 27. Jul 08, 02:03

s9ilent wrote:I don't suppose your program makes an error log somewhere?
It does now I've updated it. I improved the error detection too so hopefully it'll give us more information about why its crashing. :( It sounds like something is probably going wrong when loading the data files - what sort of mods/scripts do you have installed, if any? Maybe it's getting confused by one of them.

If the new version doesn't help, I might try adding in some sort of option to temporarily disable loading of extra/mod files, to help narrow it down.

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 27. Jul 08, 03:02

Ok, I've run the new version now (1.001) and it opens, but it says...

Error Log
---------

Exception occurred:
Message: Could not read from the main language XML file, 440001.xml: '.', hexadecimal value 0x00, is an invalid character. Line 18794, position 1.
Stack Trace: at X3_Script_Editor.XData.loadLanguageFiles()
at X3_Script_Editor.XData.initialise(String pathToX3, String lang)
at X3_Script_Editor.Editor.Initialise()
Source: X3 Script Editor V3
Target: Void loadLanguageFiles()

-------------------------------------------



I'm making my own mod atm, so I've got a few extra scripts and my own cat/dat (but its a mod and uses 447042 or something like that, and not false patched or anything)
My x3 directory is very messy thou as its actually 8 gb, (i'm guessing 3 from the game, 5 from me unpacking all the games files)
Where is it trying to read the file from?

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Sun, 27. Jul 08, 12:36

s9ilent wrote:I'm making my own mod atm, so I've got a few extra scripts and my own cat/dat (but its a mod and uses 447042 or something like that, and not false patched or anything)
My x3 directory is very messy thou as its actually 8 gb, (i'm guessing 3 from the game, 5 from me unpacking all the games files)
Where is it trying to read the file from?
As far as I'm aware (I use doubleshadow's library to open the files), it should try to load an unpacked file first, then a packed one if it can't find that, then the one in the cat/dat as a last resort, so if you have 440001.xml or 440001.pck in your "\t" directory it should load that one. If your directory is really complex though I'm not sure which versions of all the different files will get loaded in the end...

I've uploaded a new version (1.002) that should hopefully fix the hexadecimal value 0x00 problem though, so try that.

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Post by Blacky_BPG » Sun, 27. Jul 08, 13:01

@s9silent
Here the link for the ExternalScriptEditor by Cool_SnipeR:
Version 0.9.9.0 RC1
Hotfix 0.9.9.1
But I think if the Exscriptor running fine it would be better to use this tool because the Exscriptor reads the data directly from the X3 directory.

Version 1.003(*) can't read & in text files, but this is a smaller error. I fixed the & to an +. But now I have this error at programm start:

Code: Select all

Exception occurred: 
Message: Object reference not set to an instance of an object.
Stack Trace:    at X3_Script_Editor.XData.loadLanguageFiles()
   at X3_Script_Editor.XData.initialise(String pathToX3, String lang)
   at X3_Script_Editor.Editor.Initialise()
Source: X3 Script Editor V3
Target: Void loadLanguageFiles()
And yes, the 0x00 error is fixed up now.

Second test: I've made a cat/dat with the t and types directory and start Exscriptor again, the error is the same.

(*) The new Version in the program (Help -> About) is 1.003 not 1.002.

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Sun, 27. Jul 08, 14:17

Blacky_BPG wrote:Version 1.003(*) can't read & in text files, but this is a smaller error. I fixed the & to an +
Which text file? If it's a .XML file then the & sign will cause problems, but you can get around it by replacing an & with &amp;. It'll load in Internet Explorer then too. Similarly if you need to use < or >, which have the same problem, you can replace them with &lt; and &gt;.
But now I have this error at programm start:
Exception occurred:
Message: Object reference not set to an instance of an object.
Hmm. I've tried to figure out what's causing this, so let's see if I've guessed right with the new version. If I'm right, it was trying to load from a page id that wasn't there.
Blacky_BPG wrote:But I think if the Exscriptor running fine it would be better to use this tool because the Exscriptor reads the data directly from the X3 directory.
"If" being the important word! The other editor has some cool features though, like the autocomplete, and I think it likely has a better command parser.
Blacky_RPG wrote:(*) The new Version in the program (Help -> About) is 1.003 not 1.002.
Oops... :oops: The new one definitely is 1.003 now! Though thinking about it, I forgot to change the manual...

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Post by Blacky_BPG » Sun, 27. Jul 08, 21:34

Yes, I mean an xml text file. Thats right, I can change it to & :headbang:

Now I have the file for the error:

Code: Select all

Error while loading: E:\X3\t\498400.xml: Object reference not set to an instance of an object.
What do you mean with it was trying to load from a page id that wasn't there? The ID is not in text file or a not existing reference in a types file?
The 498400.xml is my test text file with many different data in it. If you wish you can download the file for testing: 498400.xml (in RAR)


Yeah, "IF" is important, thats right. But I am confident that the Exscriptor works soon.

Exscriptor ABOUT Menu wrote:Version 1.003 - for real this time
LOL, thats cool :D



AAARRGGGHH, the invalid hex 0x00 error for script files is back.

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Sun, 27. Jul 08, 23:47

Blacky_BPG wrote:Now I have the file for the error:

Code: Select all

Error while loading: E:\X3\t\498400.xml: Object reference not set to an instance of an object.
I checked the file and figured out what it was - it was trying to read an ID from a comment and was getting confused. :roll:
What do you mean with it was trying to load from a page id that wasn't there? The ID is not in text file or a not existing reference in a types file?
I thought it was still the xx0001 language file, and maybe trying to read a page that didn't exist in the file.
AAARRGGGHH, the invalid hex 0x00 error for script files is back.


Hopefully I managed to fix it (again). New version here and I'll update the first post (again).

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Post by Blacky_BPG » Mon, 28. Jul 08, 00:14

Ok, Version 1.004 has a text file comment detection included ... IT WORKS FINE WITH NO ERROR ... at the moment [ external image ]

Great Work, I have opend a large script file (470kb only codearray) without problems (a little slow maybe but I think that is my weak machine here :evil:)
  • [EDIT]
    Yeah, its my machine, ExSE open the script in same time
And what I said? -> If it running fine... -->> [And its running fine.] :thumb_up: [ external image ] :thumb_up:

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Mon, 28. Jul 08, 01:19

Blacky_BPG wrote:And what I said? -> If it running fine... -->> [And its running fine.] :thumb_up: [ external image ] :thumb_up:
For now, at least! Thanks very much by the way, you've been a great help in fixing these bugs! :)

Erilaz
Posts: 161
Joined: Mon, 8. May 06, 13:49
x4

Post by Erilaz » Mon, 28. Jul 08, 01:25

Thanks, sounds brilliant Whimsy. Definitely going to give this a whirl during the week.

Best news (the cherry on top), would be if you have similar intensions for X3-TC.

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Post by Blacky_BPG » Mon, 28. Jul 08, 04:46

Yeah, for now, but when I found an error I report it immediately :P

I know that even. I also program a little bit. The tool for the XSP-database was more than 4 weeks in version 2 and nobody asked me about an error. Until someone has dared ... now I am at 2.2.0.3.
Unknown author wrote:I can live with criticism, negative as positive. But nothing is worse than that nobody says something about my work.

I hope that I translated the quote correct

Whimsy
Posts: 167
Joined: Mon, 9. Feb 04, 20:32
x3tc

Post by Whimsy » Mon, 28. Jul 08, 18:49

Erilaz wrote:Best news (the cherry on top), would be if you have similar intensions for X3-TC.
That depends on how much changes. But given that the files and scripting engine didn't change much from X2 to X3, hopefully it will only take a few minor modifications for Exscriptor to work with X3TC.
Blacky_BPG wrote:Yeah, for now, but when I found an error I report it immediately :P
True - I prefer to know that it's not working than to go on thinking it is when it isn't. If that makes sense... :D

ThatGuyBob
Posts: 48
Joined: Thu, 9. Dec 04, 18:10
x3tc

Post by ThatGuyBob » Mon, 28. Jul 08, 20:40

I'm loving the app, Whimsy!

Found an issue in CommandList.txt:

Code: Select all

@<RetVar/IF>wait randomly for <Var/Number> to <Var/Number>ms
should actually be

Code: Select all

@<RetVar/IF>wait randomly from <Var/Number> to <Var/Number> ms
Keep up the great work. This is exactly what I needed to get me excited again about X3, aside from TC.

Post Reply

Return to “X³: Reunion - Scripts and Modding”