X4 - UI and scripting

This forum is the ideal place for all discussion relating to X4. You will also find additional information from developers here.

Moderator: Moderators for English X Forum

xirsoi
Posts: 9
Joined: Thu, 26. Mar 15, 00:18
xr

Post by xirsoi » Tue, 29. Aug 17, 06:00

j.harshaw wrote:yes. but i'm still curious.
Almost anything else? Honestly, XML is ugly and repetitive and hard to read. Of course, I don't expect you to go and roll your own DSL like Paradox does for Clauswitz (even though it is much nicer to work with), but maybe you could convert to using JSON?

There are a thousand libraries for dozens of languages for parsing JSON (i'm fond of Newtsonoft.JSON myself, use the C# implementation at work a lot) and it's super easy to work with.
stodi no na ka cenba

User avatar
JSDD
Posts: 951
Joined: Fri, 21. Mar 14, 21:51
x3tc

Post by JSDD » Tue, 29. Aug 17, 10:23

Observe wrote:Mission Director XML is good with me. I am happy to hear they are keeping it. While I used it to the extent I needed, I was never a big fan of X3 scripting and was happy to see it dropped.
md scripting was hard to understand at first, and once you've understood the workflow, the next big problem was to keep the "overview": the bigger the script, the more likely you loose the context and make some mistakes. in msci scripting, you can easily keep parts a bit in order, for example with "gosub / endsub". besides that, there were no <xml-tags/> and you didnt had to reload the game in order to test your stuff

xirsoi wrote:Honestly, XML is ugly and repetitive and hard to read.
exactly, X3 msci scripting was also internally stored as xml, but you never had to deal with that because there was an ingame editor which displayed the script very well (procedural, kind of C-style), we could easily make changes and test them immediately, without having to reload


these posts were cut out from this topic into the S&M forum:
https://forum.egosoft.com/viewtopic.php?t=395980
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.


Mission Director Beispiele

User avatar
YorrickVander
Posts: 2682
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Tue, 29. Aug 17, 10:32

Thanks for confimring both scripting systems :) Time to dust off the knowledge in antcipation of tinkering to come!
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

User avatar
JSDD
Posts: 951
Joined: Fri, 21. Mar 14, 21:51
x3tc

Post by JSDD » Tue, 29. Aug 17, 10:51

what we know now is that there wont be "MSCI"-style scripting, only "MD"-style
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.


Mission Director Beispiele

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 02:43
x4

Post by Shimrod » Sat, 11. Nov 17, 19:13

XML wouldn't be my first choice as an end-user language.

They used it for WIX installer but that felt like they probably planned to put a UI over the top and use it as a save format, but never got round to writing the UI.

gbjbaanb
Posts: 636
Joined: Sun, 26. Dec 10, 00:07
x3ap

Post by gbjbaanb » Sun, 12. Nov 17, 02:50

Shimrod wrote:XML wouldn't be my first choice as an end-user language.

They used it for WIX installer but that felt like they probably planned to put a UI over the top and use it as a save format, but never got round to writing the UI.
There are UIs for Wix. I think they made it XML so it was a standardised "command line" type interface that could be generated by something else.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13949
Joined: Sun, 20. Nov 05, 23:45
x4

Post by UniTrader » Sun, 12. Nov 17, 12:49

JSDD wrote: and you didnt had to reload the game in order to test your stuff
...
without having to reload
If you just changed already existing Scripts Loading a Savegame is enough, or even faster: use the Debug Commands "reloadai" "reloadmd" and "reloadui". If new Files are added this doesnt work though, i guess because Files are indexed on Startup..
i am also pretty sure i gave you that hint multiple times already. (i even mentoined them on the previous Page)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

plamen
Posts: 7
Joined: Sun, 8. Sep 13, 20:24
x4

Post by plamen » Thu, 30. Nov 17, 18:20

Maybe someone should make a C# / Python / JavaScript / Whatever-Language compiler to XML MD.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13949
Joined: Sun, 20. Nov 05, 23:45
x4

Post by UniTrader » Thu, 30. Nov 17, 20:07

plamen wrote:Maybe someone should make a C# / Python / JavaScript / Whatever-Language compiler to XML MD.
because its very unlikely it would properly utilize the mechanics of MD (Event-Based, Namespaces, MD-Instances, Expression Chains...) this would probably result in weird and inefficient code...
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

SirNukes
Posts: 488
Joined: Sat, 31. Mar 07, 23:44
x4

Post by SirNukes » Sat, 2. Dec 17, 03:55

Conservatively compiled MD code wouldn't lose anything, unless the compiler were half baked. In general, a compiler is just a translator from some format to another format, the latter generally being closer to execution ready. If you take the trivial case of the input and output formats being matched (eg. the compiler takes MD xml code as input, and spits it back out), every MD capability would be preserved.

Xml has a lot of excess cruft that could be trimmed off, so a rudimentary compiler input format might just be a 1:1 mapping of MD nodes with an alternate syntax. Eg. a python-like syntax for block indentation would allow removal of the block closing tags like </do_all>, most of the node start/end tags ('<', '/>') could be trimmed (when not multi-lined), and most of the quotation marks could be omitted (when a space isn't present in the string).

Once the syntax is cleaned up a bit, the compiler could be expanded with extra coder convenience features, eg. function calls to be inlined at compile time, support for splitting code across multiple source files, etc. It could even have an editor built for it, similar to Exscriptor for X3, though it might be better to try to integrate into an existing developed editor, eg. setting up a custom language format for Notepad++.


On the other end of the spectrum would be a compiler that could take generic C++/Python/etc. code and process its AST into MD nodes. That would be an effort to get functional, and hard to make efficient, so it is probably too much effort for anyone to put into modding a niche spaceships game for no pay.

Post Reply

Return to “X4: Foundations”