bunkerprivate wrote:Heh, it sounds really attractive as you explained the features. The menus especially I'm looking forward to, since I think the UI in Reunion really let the game down. Of course I play it like an RTS really so maybe I'm outside the use-case. But I'm not sure my PC can even run it anyway -- It barely runs Reunion, tbh ^^.
You might be okay with it, but you probably will need a faster computer then; X3TC is a pretty demanding game, especially memory-wise. But the more I play the game, the more new things I find that I really like (and I don't just mean in the script language). The custom script menus are indeed brilliant - LV posted a tutorial so you can see how they work, and they're very simple. A massive step forwards, I think. Playing these games like an RTS gets a bit risky at times though; one time I gave up on an X3R+XTM game in disgust after I lost a fully-armed Python to a Xenon Q in five seconds of out-of-sector combat. If they made RTS games like that, where 100 million credit units get wiped out in a second if they were offscreen at the time, nobody would play them!
bunkerprivate wrote:This normally isn't an issue with dbm databases.
It's not just the database that's the issue though, it's also the UI and the rest of the innards: multiple selection lists of objects etc would then be needed too, for instance, displaying the appropriate one depending on which script of which project you have open at the time. I think one project at a time is a sensible constraint (and more importantly, saves me effort

), and if need be I suppose the user could always open up multiple instances of the Exscriptor.
bunkerprivate wrote:Great! From my point of view, it would actually be quite unlikely that inline template functions would really be necessary, `script-pointers' certainly are for reasonably maintainable code.
Agreed - the 'script pointers' are definitely useful. You can also see them in action in Cycrow's cool new command queue scripts if you're interested.
Templating... well, we'll see.
bunkerprivate wrote:It seems I didn't quite communicate exactly what I was after though -- or at least my motivation, so I'll try and remember some code I was working on. It's basically just a simple event handler loop (apologies if I get this a bit wrong):
I see what you mean, and I'll admit something like that could well be handy for building up libraries of data types and associated functions that you can include/import for use in different scripts. In that case, I would think something like this:
- a 'type' or 'struct' definition for user-defined data types (like queues etc). May or may not be generic/templated (probably not), depending on how complex that proves.
- a 'define' for constants etc. Probably wouldn't convert to an actual variable assignment.
- some kind of 'global' variable declaration; I was planning this anyway as a way of supporting the existing global variables in the MSCI.
- a 'shared function' or 'inline function' definition, which can be imported and inlined. I think I would restrict these to prevent recursion etc and probably prevent any form of script call too. This would end up as a sort of decorated gosub in the MSCI I suppose.
- an 'exported function' definition, which ends up as its own script file and thus resolves to just an normal script call in the MSCI.
- some kind of 'import'/'include' directive that allows you to load all of the above from a named file. Any other code in them would be ignored and in fact I might make it so that includeable files can only contain the above, to keep things tidy; almost like headers, really.
That way you could have a "Queue" library script file, say, which would include the definition of the queue type plus the associated utility functions (add, remove, insert etc). Your "import Queue" idea, basically.
bunkerprivate wrote:Anyway, you see I long for the day when I can #include <x3.h>

If only...
bunkerprivate wrote:It's a shame I was rather hoping there was hidden ability to do this kind of stuff. Especially to set the program counter to a value obtained from a variable. It's something I probably would have put in just for completeness, heh.
Remember that it's just a game's built-in scripting language - I think it already offers pretty impressive capabilities, especially considering the improvements since the X2 version, but I don't think it was ever envisaged as a true programming language. Assembly with access to program counters and greater access to the underlying functions might be nice, but would probably be irrelevant to 99.99% of the game's users and thus wasted effort on Egosoft's part... I suppose they could have gone down the route of using an existing language to do it, Lua or Python or something, but that would have meant even larger changes to the engine and would have lost the simplicity of the existing MSCI which makes it so popular. Come to think of it, I believe they did have a C-like language they used internally for mission programming etc, but it was a development tool and never meant to be available to players of the game.
Actually I wonder what percentage of X players use the script editor, or even make use of other people's scripts?
bunkerprivate wrote:I've found that tweaking things in the game is never really sufficient to fix bugs anyway; I never touch scripts in-game, except ones I have specifically designed to be user editable. I find I need to go in and put in a massive set of logging commands, or I need to tab out and analyse an old log and the X3 environment doesn't really cut it -- I honestly can't make head nor tail of the integrated debugger! Probably this is because I skipped MSCI and went directly to Exscriptor, though.
To be honest I've never used the in-game debugger much either, though it can be useful at times. The extra information you can view on ships etc to see what scripts they're running is probably the most helpful for debugging, I find. Anyway, I think being convertible to/from MSCI will be useful for the HLL, if only to save time of dropping out and reloading the game each time, but if it proves too complicated then I'll drop it; like you say, if necessary we can make the changes to the original source HLL anyway.
bunkerprivate wrote:In fact the only place I would really use a preprocessor is in the case of logging statements, of which my files usually have a massive amount and a `release' build would perform somewhat better if the dead code when $DEBUG=[FALSE] could be removed.
That sounds like a good idea, I agree. The debug statements can then just be commented out when compiling in "release" mode, I suppose, or even removed altogether (though that would break the reverse compatibility).
bunkerprivate wrote:I'm probably over thinking it, really, how it is implemented just seemed have a dis-proportionally large affect on the rest of the design.
I haven't got far enough yet to think in any detail about the implementation (the HLL is still low priority), but I agree that it will almost certainly be complicated! That's why I'm trying to keep the language itself simple, otherwise Exscriptor 2 may well take two years again to finish...
bunkerprivate wrote:I was thinking of optimisation again: you need to number variables anyway so you can reuse the ones which are out of scope or aren't being referenced anymore. For a stack, you just reset the numbers to zero when you get to a function and use them as array indices; inlining just adds an offset to the base var number of the function. (I'm sure it wouldn't turn out so simple though ^^)
We might have our wires crossed here, but with the variable renaming, I was thinking more along the lines of namespacing, just so that imported vars don't get confused with ones already present. I think what you're talking about is a bit beyond the scope of the scripting language - that level of optimisation would presumably belong in whatever interpreter runs the scripting language in-game. If you tried to do some of this stuff in the MSCI - like recursive gosubs - I think the very fabric of reality would rip open and suck you through into some nameless void beyond...
bunkerprivate wrote:Again, I'm not sure how it would turn out but I think that having any kind of declaration in the imports boils down to the same problem, if you handle all script generically of course. I suppose I good hack would be just to specifically parse a bunch of assignments.
I'm not sure what you mean here; surely simple variable declarations would be no problem, since they'd map directly into either standard or global MSCI variable declarations? In some cases (like constants) the variable could be skipped altogether and the value just substituted. Even types are simple enough if they work along those lines. Inlined functions would be more tricky because they could potentially introduce dependencies on other parts of the script code (whether imported or not), which is why I think it would be neatest to make sure they're self-contained and can't call anything.
bunkerprivate wrote:The `project-level' defining doesn't really appeal to me since it's a very specific implementation which could be done more flexibly by the functionality "include global.h". (This in particular is useful for distributing library code of course.)
When I said that, I was thinking more along the lines of importing files into a project rather than into a specific script, so that you would just select a bunch of libraries to include and then you can use the defs in any script in the project. However, that does mean me checking to see whether things are used in every file, and thus whether or not to actually include them, so maybe shifting the burden onto the scripter isn't such a bad idea after all.
bunkerprivate wrote:When I mentioned some things which are common to the project, my assumption was really that it would be a neat user-interface for the general concept of parameters to the compiler. So, say you wanted to have a debug build and a release build you would define a macro RELEASE_FLAGS and DEBUG_FLAGS, then when you pess `build' in the compiler, Exscriptor could run "cmdline-compiler ${${buildtype}_FLAGS} script.exs -o whatever.xml".
I had this in mind too, but I wasn't thinking of this as part of the language (except possibly an #if DEBUG style directive) and more as just simple project options. Incidentally the plan is to have both a built-in compiler (which is tightly integrated, so it can provide feedback to the UI) and a separate cmd line one, which would still provide error reports but would not need the extra interfacing capabilities.
bunkerprivate wrote:I think this is really the `right' philosophy, though it's always a matter of opinion -- it's interesting to see the differences in assumptions between windows developers and unix developers. When I implement stuff like this my preference is normally just to dump the problem on the user and give them a box for "command to run", which for me would usually be `/usr/bin/make'.
In general, I agree with you - it's neater to have some general underlying functionality and then just pop a more specialised interface to it on top; that way you can tailor your interfaces without needing to duplicate what's underneath. Also personally I too prefer to have the ability to customise things and do things my own way. But some people don't, hence the existence of things like "wizards".
I suppose any differences in assumptions between Windows and UNIX developers might stem from the differences in typical Windows and UNIX users.

The average Windows user probably wouldn't know what to do if presented with a blank "command" box; imagine if there was nothing in the Start menu apart from the Run box - there'd be uproar! Yet UNIX users are probably at least as comfortable with a CLI as they are with a GUI, if not more so. Developers have to target their users, so their thinking will reflect that, I suppose.
In this case, I'm trying to stay close to the simplicity of the original MSCI (and however long-winded it can be at times, it
is brilliantly simple to use) and add on any extra, more powerful functionality after that as another option so that you're not forced to use it. Someone who just wants to write a cheat script to create a free ship is not going to be interested in the HLL or the capabilities it offers, for instance. Though having said that, I suppose most of the people using the tool are unlikely to be casual scripters anyway.
bunkerprivate wrote:But optimisation is so cooool! (And doubly pointless since there's no tool to benchmark the results, but never mind that!)
I'm not sure that much optimisation is possible anyway; clearly, some commands will be more costly than others, e.g. "get pilot name" will no doubt be quicker than "fire lasers on target", but it's not as if there are any alternatives if you want to shoot someone. The only real meaningful scope for optimisation is at the algorithm-level, I think, and that's in the scripter's hands.
bunkerprivate wrote:I look forward to it! Seems X3TC is on steam so it's not a big deal to impulse buy it at some point, and I can lend a hand testing.
Well, there's no hurry on the testing Exscriptor part, believe me, but it's well worth playing for its own merits.
