XSE - The XScriptEditor by Nuclear_Eclipse

The place to discuss scripting and game modifications for X²: The Threat.

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

User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

XSE - The XScriptEditor by Nuclear_Eclipse

Post by nuclear_eclipse »

** UPDATE - 2005-10-04
** The input / output of scripts to and from files has been completed and tseted as well as I could. I ran the system through all of the really complex script sets out there that I could find, such as Milling_Hordesman's Adv_Jumper scripts, the gunnery crews, and such other scripts.

--Original Content--

This is still highly a work in progress. I am using it for an in-class assignment for one of my software engineering courses, not only for the grade but for the betterment of the entire X2 community. I plan to keep the project alive and active long past it's grading due date. Anyways, on to the project itself.

XScriptEditor is my conception and implementation for an *external* script editor for the X series. It will be fully compatible with X2 scripts, either written ingame or from my editor. It will allow the user to work with an easy to learn GUI environment, including mouse support and normal windows functionality. It will have many features that go far beyond the capabilites of the ingame editor, simply because the interface is not tied directly to the game engine.

I have the entire framework of the program completed. It can now read a full egosoft script into memory and create a data object which can then be output directly to a file again and still work in X2. The only roadblock is that this has not been tested yet with really complex scripts, so I probably still have a lot of work ahead of me, but it's as start. Also, once I make sure that it can read even the most complex script in and then save it out again, I still need to get the program able allow the user to physically work with the script.

Here is a WIP screenshot:
[ external image ]

But from the above screenshot, you can still see the basic functionality I have planned for the program. Yes, that is a *tabbed* editor WITH AN UNDO/REDO FEATURE!!!! Wheeee! :twisted:

I will keep everything related to this project in this thread, and I am perfectly willing and glad to accept questions, ideas, criticism, etc. I will keep everyone updated as to my progress, and hopefully with this being aschool project as well as a for-fun project, it should hopefully move along pretty quickly.


Cheers
Last edited by nuclear_eclipse on Wed, 5. Oct 05, 03:23, edited 1 time in total.
Galaxy613
Posts: 3285
Joined: Tue, 28. Dec 04, 02:19
x4

Post by Galaxy613 »

Yey! Now I can make scripts and still chat online! :D
10,000 Lightyears of awesomeness
StormSinger
Posts: 89
Joined: Tue, 15. Mar 05, 18:04
x4

Post by StormSinger »

The fact that this hasn't been done before now (that I know of), makes me wonder if maybe there isn't a stumbling block somewhere down the road that makes a program like this less useful than it should be?

Not to rain on anyone's parade, I hope this all goes well as it would be a great tool to have, and a long time in coming.
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

Nope, no known pitfalls. No one as far as I know has attempted to tackle the project before this.
Good luck, this would be so incredibly useful to have.
Cheers.
"Nature's first green is gold" . . . stay golden.
User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

Post by nuclear_eclipse »

StormSinger wrote:The fact that this hasn't been done before now (that I know of), makes me wonder if maybe there isn't a stumbling block somewhere down the road that makes a program like this less useful than it should be?

Not to rain on anyone's parade, I hope this all goes well as it would be a great tool to have, and a long time in coming.
Well, the only pitfalls that I foresee would be how to deal with variables that include specific ships, sectors and wares that may or may not be a part of the default setup, so I have a fealing I will simply treat them as something special without attempting to name them. Eg. Instead of listing something like 'Argon Discoverer' as the ship ware, I'll simply list it as 'Custom Ship: xxxxxx' where the x's correspond to the ware numbers or somesuch.

Beyond that, pitfalls are pretty much limited to the really, insanely weird way in which the scripting language is stored, which defies all logic in my opinion, but there IS a definate way in which it is stored, which means there is most certainly a way of reading and storing to it externally. It simply comes down to making sure me AND my program both fully understand the way in which the scripts are stored.
RagX
Posts: 552
Joined: Fri, 23. Sep 05, 08:04

Post by RagX »

Maybe the real in-game script editor programmers can give a hoot about this? *hinthint*

I'd LOVE to see an external editor finally make it out of testing phase so I can learn how to script without being tempted to go pirate- or khaak/xenon-hunting while I try to do so :(
Galaxy613
Posts: 3285
Joined: Tue, 28. Dec 04, 02:19
x4

Post by Galaxy613 »

RagX wrote:Maybe the real in-game script editor programmers can give a hoot about this? *hinthint*
If Egosoft's programmers rarely read the main forums, I think it's even rare that the devs will look in here. One of the only reasons why the devs know about commuity mods and scripts are through mods like Burianek who talks on DevNet and etc.
10,000 Lightyears of awesomeness
RagX
Posts: 552
Joined: Fri, 23. Sep 05, 08:04

Post by RagX »

Egosoft very well knows that the true way to keep a game alive (and selling) is through its fanbase and letting them have a say in what they want, and so this should be right up their interest (though then again, maybe not since X3's coming)
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

You're not going to get an official support on this, sorry. :)
Sounds like nuclear_eclipse is doing just fine however.

As regards variables that refer to specific ships etc. I assume you mean honest to God specific ships, like the disco currently sitting in Argon Prime at coords (x,y,z)? The way the in game script editor handles them is to refuse to save the script if any specific objects (ships, stations, sectors even) are referenced, since these are not guaranteed to be in every game.

If you're talking about the ship type, Argon Discoverer, then the codearray refers to the language files in the /t directory to give appropriate names in the editor to the object types referenced.

Does that make sense?
"Nature's first green is gold" . . . stay golden.
User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

Post by nuclear_eclipse »

Burianek wrote:You're not going to get an official support on this, sorry. :)
Sounds like nuclear_eclipse is doing just fine however.

As regards variables that refer to specific ships etc. I assume you mean honest to God specific ships, like the disco currently sitting in Argon Prime at coords (x,y,x)? The way the in game script editor handles them is to refuse to save the script if any specific objects (ships, stations, sectors even) are referenced, since these are not guaranteed to be in every game.

If you're talking about the ship type, Argon Discoverer, then the codearray refers to the language files in the /t directory to give appropriate names in the editor to the object types referenced.

Does that make sense?
I meant ship types. I know that a script con only reference specific ships that they gather from either a create ship or find ship command, so specific ships are never stored in the script. I was talking about how to generally list ware types and ship types in the program, which I had originally intended to set up a simple database of wares/shiptypes from the normal X2 universe and if it finds a script that references a non-default ware or ship, itll list it the same way the internal script editor does when it doesnt have the corresponding language entries: ReadText-bull =]
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

I'd be carful of setting up any default lists, unless you want to rewrite this thing when X3 comes out. :)
I'd imagine it can't be too difficult to figure out how the codearray references the language files and pulls text in from them. Text IDs (tid) must be referred to in the codearray somewhere. Or actually object ids, which then have a unique text id associated with them.
When you start the editor, you could load in a language file, and then allow the loading of scripts.
That might be much much easier in the long run.
Cheers.
"Nature's first green is gold" . . . stay golden.
Galaxy613
Posts: 3285
Joined: Tue, 28. Dec 04, 02:19
x4

Post by Galaxy613 »

It'll be sooooo neat of X3's scripts used this same setup. Then before anyone can find the in-game script editor we'll already be able to make and edit scripts! :D
10,000 Lightyears of awesomeness
User avatar
SteelRush
Posts: 548
Joined: Wed, 6. Nov 02, 20:31
x4

Post by SteelRush »

StormSinger wrote:The fact that this hasn't been done before now (that I know of), makes me wonder if maybe there isn't a stumbling block somewhere down the road that makes a program like this less useful than it should be?

Not to rain on anyone's parade, I hope this all goes well as it would be a great tool to have, and a long time in coming.
It's been attempted before, and there was a very early release made of an external script editor, but the author lost interest as far as I knew. It is a monumental task, but if it is accomplished, it would make alot of X2 scripters very happy. :D
Galaxy613
Posts: 3285
Joined: Tue, 28. Dec 04, 02:19
x4

Post by Galaxy613 »

SteelRush wrote:
StormSinger wrote:The fact that this hasn't been done before now (that I know of), makes me wonder if maybe there isn't a stumbling block somewhere down the road that makes a program like this less useful than it should be?

Not to rain on anyone's parade, I hope this all goes well as it would be a great tool to have, and a long time in coming.
It's been attempted before, and there was a very early release made of an external script editor, but the author lost interest as far as I knew. It is a monumental task, but if it is accomplished, it would make alot of X2 scripters very happy. :D
And MAYBE just maybe, the early X3 scripters! :twisted:
10,000 Lightyears of awesomeness
Harlock776
Posts: 2261
Joined: Wed, 9. Mar 05, 21:53
x2

been there done that

Post by Harlock776 »

You do know of something called Peter's xml editor" don't you??? I used it sometimes for messing with scripts especially the init script for my mod. I forgot where I got it from but I remember that I started looking for it with google.
User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

Re: been there done that

Post by nuclear_eclipse »

Harlock776 wrote:You do know of something called Peter's xml editor" don't you??? I used it sometimes for messing with scripts especially the init script for my mod. I forgot where I got it from but I remember that I started looking for it with google.
That still doesnt do too much since all of the script information is inside the <codearray> tags, and is VERY cryptic indeed... It would be much nicer te be able to, for example, select thhe return command, then select null for its argument rather than remember that the return command with null argument is the following xml code:

<sval type="array" size="3"><sval type="int" val="103" /><sval type="int" val="0" /><sval type="int" val="0" /></sval>
Galaxy613
Posts: 3285
Joined: Tue, 28. Dec 04, 02:19
x4

Re: been there done that

Post by Galaxy613 »

nuclear_eclipse wrote:
Harlock776 wrote:You do know of something called Peter's xml editor" don't you??? I used it sometimes for messing with scripts especially the init script for my mod. I forgot where I got it from but I remember that I started looking for it with google.
That still doesnt do too much since all of the script information is inside the <codearray> tags, and is VERY cryptic indeed... It would be much nicer te be able to, for example, select thhe return command, then select null for its argument rather than remember that the return command with null argument is the following xml code:

<sval type="array" size="3"><sval type="int" val="103" /><sval type="int" val="0" /><sval type="int" val="0" /></sval>
It is? Wowie, thats a pain. :o I would really like to know how this Script Editor is going to work...
10,000 Lightyears of awesomeness
User avatar
Serial Kicked
Posts: 3823
Joined: Fri, 12. Aug 05, 20:46
x3tc

Post by Serial Kicked »

Exactly what i wanted, a tabbed script editor. But i haven't the time to build it myself. Thanks nuclear_eclipse for trying to achieve this. :)

@others, give a look at this thread. You'll know why it's absolutly not possible to modify scripts with a standard XML editor :

http://www.egosoft.com/x2/forum/viewtopic.php?t=89990
X3:TC/AP Pirate Guild 3 - Yaki Armada 2 - Anarkis Defense System

Anarkis Gaming HQ
Independent Game Development
X3 Scripting and Modding Station
User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

Post by nuclear_eclipse »

** UPDATE - 2005-10-04

* The input / output of scripts to and from files has been completed and tseted as well as I could. I ran the system through all of the really complex script sets out there that I could find, such as Milling_Hordesman's Adv_Jumper scripts, the gunnery crews, and such other scripts.

-- Normal Content --

Thus far, all scripts can be read into my editor and then saved back to a file, which then works completely with X2. The only caveat is that (at least for right now), scripts cannot be viewed in web browsers like they can straight from the in game editor. The reasoning for this is that the egosoft editor outputs all of the xml code for browser viewing for the reason that there is no other way of externally viewing the script, and the code necessary for viewing the script in a browser is superfluous and has no bearing on the actual script itself.

Therefore, I have decided that for the time being, in order to make everything easier for me and to move along to further development, I have simply made the outputted browser code succint and only show the most essential parts, which does not include any lines of code. The name of the script, description, and arguments are still visible, but there are no actual lines of code.

Perhaps when I get the primary functionality of the program completed, I can go back and make some nice pretty output for the scripts, but until then, it's pointless since you can always view the scripts with my editor once it's released ;)

** Feedback **

What I am curious to know, and would like to hear back from everyone here is this:

I have made the framework of the editor a tab-based environment. I now have the choice of how to design the actual part of the editor that will show the script and allow the user to make changes. No matter what I do, the editor will by necessity use an editing process similar to the one utilized by the ingame editor (as in a menu-driven, fill-in-the-blanks type of editing). There is no other simple way around it without giving *everybody* a really bad headache.

My current idea for the design is to simply have a bunch of blank lines in the editor, and the user will be able to right-click a blank line, and then choose a command from a popup menu that offers all of the available editor commands. Then each 'blank entry' can in turn be right-clicked to choose from variables, wares, etc similar to how it is done ingame, instead with a mouse and windows.

If there are any other ideas you all have on how this could be implemented, that would be a great contribution so that I can take that all into account before I get too far with building the scripting interface.

Cheers
Galaxy613
Posts: 3285
Joined: Tue, 28. Dec 04, 02:19
x4

Post by Galaxy613 »

nuclear_eclipse wrote:...My current idea for the design is to simply have a bunch of blank lines in the editor, and the user will be able to right-click a blank line, and then choose a command from a popup menu that offers all of the available editor commands. Then each 'blank entry' can in turn be right-clicked to choose from variables, wares, etc similar to how it is done ingame, instead with a mouse and windows...
That would be kick-@$$ if you could do even that! :O Maybe other people will be more help, but I think thats a great idea!
10,000 Lightyears of awesomeness

Return to “X²: The Threat - Scripts and Modding”