Conquest of Elysium 4

Conquest of Elysium 4

Marlin 25 Mar, 2016 @ 9:46am
CoE4 (& CoE3) language definitions for Gedit
I have now created CoE4 (& CoE3) mod and map language definitions for the Gedit text editor[wiki.gnome.org] – or presumably for any editor based on GtkSourceView.
________________________________________

Merely using the syntax highlighting of a Unix shell script (sh) works pretty well, of course (it will make comments and string literals stand out in your CoE4 mods and maps). My language definitions add slightly more color, though. All, correctly spelled, CoE4 commands should be highlighted as commands, so if, for instance, you erroneously use a CoE3 command, like wdmgtype, in a CoE4 mod, you should instantly see it.

Plus, not least, these definitions will be applied automatically to any .c4m or .coem file you open. (No need to manually select "sh" highlighting.)

(Note: Since map files of CoE3 and CoE4 have the same .coem file name extension, I didn’t bother with separate definitions for those two, even though they aren’t entirely compatible with each other.)
________________________________________


Installation (on Linux)
  1. Download the zip file[www.dropbox.com] and unpack it. It contains "lang" files (actually xml files) for CoE4 and CoE3 mods and maps (c4m, c3m and coem files).

  2. On Linux, move these files to the directory
    ~/.local/share/gtksourceview-3.0/language-specs/
    Create that directory if it doesn’t already exist. (The .local directory is hidden, of course.)
Done! Now when you start up Gedit and load some CoE4 or CoE3 mod or map, it should be automatically displayed with appropriate syntax highlighting.


Windows and Mac
Gedit is, of course, the default editor in the Gnome desktop environment for Linux, and until now I honestly didn’t think it even existed anywhere else. While looking for info on Gedit, however, I discovered there actually are some versions available for Windows and Mac too (see Gedit link above), not that I know if they will excite anybody who isn’t mainly a Linux user. In particular the available Windows binaries are based on pretty old Gedit versions. (Then, again, the Find Text box of that earlier version is actually better than it is in the latest Linux versions, in my opinion, and text editors mostly don’t need to be terribly advanced.)

Any curious Windows user trying out Gedit will probably find it most easy to just copy my language definition files to the appropriate place within the Gedit installation directory. Which should be something like
C:\Program Files (x86)\gedit\share\gtksourceview-2.0\language-specs\
(That’s where you’ll find all the preinstalled language definitions.)

On Mac, my guess would be that the language definitions go where they do on Linux. (It’s Unix, after all.) But I don’t know.
________________________________________

Some notes on Gedit (v2) on Windows:
  • While Gedit on Windows seems to run well enough, I did experience a significant delay when starting it. (Gedit on Gnome Linux starts instantly.) This might perhaps be due to Gedit being dependent on (GTK+) libraries that are native to Gnome on Linux but not to Windows.

  • I initially also experienced another problem on my UHD screen, a blurriness of the text, but that one turned out to be easily fixed – just a little change to the properties of the gedit exe file. Should you have the same problem, go to
    C:\Program Files (x86)\gedit\bin\gedit.exe
    (or some similar path). Right click on it, select Properties → Compatibility, and check the option “Disable display scaling on high DPI settings”.

  • One nice thing is that Unicode can be entered the GTK+ way in Gedit on Windows, just like on Linux. (Shift+Ctrl+U, release, enter code, finish with Return or Enter.) Unfortunately, for some reason, the Windows version seems unable to display characters beyond the 16-bit BMP (fails to display for instance 😀), but this shouldn’t matter while doing CoE4 modding.

  • You can obviously change the font used (Edit → Preferences → Font & Colors). The default used on Windows seems to be Courier New, but, at least on my high resolution screen, the Consolas font (default in Windows Notepad) looks better. The catch is, when a specific font is selected, Gedit on Windows seems to entirely lose any ability to display characters that aren’t in that font. Again, this shouldn’t matter much as far as CoE4 modding is concerned.

  • The keyboard shortcut for Redo in Gedit is Shift+Ctrl+Z. (It should probably have been Ctrl+Y, at least in the Windows version. Behind this are some competing standards[en.wikipedia.org].)

  • The character encoding of a currently loaded file will be shown when the mouse is moved over the tab (with the file name) for the file. If it’s UTF-8, it will be shown as “Unicode (UTF-8)”. If it’s some legacy codepage, it will be shown something like “CP1252” (if you are running a “Western” Windows edition). When you do a “Save as...”, you can select a different character encoding.

    The default for new files is obviously UTF-8. And Gedit doesn’t even recognize the concept of a UTF-8 BOM. Any such oddity will just be treated as an invisible, zero-width garbage character at the beginning of the file. (Delete it, save, and it’s mercifully gone.)
________________________________________

Edit 1: Download link updated for v4.18.
Edit 2: Download link[www.dropbox.com] changed from Mediafire to Dropbox, since Mediafire seems to be now blocked by Steam.
Last edited by Marlin; 20 Oct, 2017 @ 9:17am
< >
Showing 1-7 of 7 comments
Franknfurter 26 Mar, 2016 @ 11:00am 
Hi Marlin, I found your tip to change the dispaly language a great help and a custom language sounds great. I wondered if you considered making a User defined language file for Notepad++? It's more commonly used by windows users, doesn't have the start-up delay you mentioned... I actually find Notepad++ uses tiny amounts of system resources 1/10 firefox 1/3 dropbox even with all my mods loaded as tabs/cloned to other view (- a nice feature so you can edit in two places in the same file at once. Also FYI turning on and off word wrap is handy for editing long descriptions).

[Edit] Just noticed that FangoWolf has a language file for Notepad++ CoE4... I suppose the best way to get colours I like is probably to do it myself... something closer to shell I think. (Personally I'm not a fan of changing font/pinks/etc.)

I tried simply renaming the files back to xml (worth a try) but no luck.
Notepad++ allows custoim languages with I think 8 keyword groups. (though I'm really unfamiliar with editing such things) UDL 2.0 (there's a link from within Notepad++ to it but steam doesn't like it for some reason). I'd make it myself but I'm not sure which colours/styles to use as well as any intricacies... I assume copy pasting the keyword list and matching the styles to your Gedit one would work... but with a limit of 8 groups some would have to be merged. Not a big problem, perhaps the following keyword groups?
1. Monsters commands
2. Rituals
3. Weapons
4. Events
5. Terrain
6. GUI
7. Other CoE4 commands
8. Old CoE3 commands (so they show up as invalid commands)

Not sure about numbers/comments/operators and delimiters...
Operators:
& * + (I'm not sure what all the operators CoE4 recognises actually are...)

[Edit 2] Removed link to SageThumbs, although it does let you view .tga files in explorer it has other issues for some, probably not a good idea to use.
Also, again for Windows users... this morning I found via GIMP chat that
SageThumbs 2.0.0.22 allows both .tga files and .xcf files in windows explorer. Which makes it *Much* easier to look through a folder full of .tga files without having to open up GIMP check each file if you're unsure which unit has a missile launcher or catachan pattern camaouflage for example. Although for some reason it gets confused with some .xcf files and displays the file... strangely. it works perfectly with the .tga files and that's the important part for me. (it also makes it easier to spot errors, I've noticed a few incorrect sizes and unused .tga files already).
Last edited by Franknfurter; 26 Mar, 2016 @ 1:22pm
Marlin 27 Mar, 2016 @ 2:17pm 
The editor I tend to use myself is Gedit – out of laziness perhaps; it’s the default in Gnome where I mostly am. Notepad++ runs well under Wine on Linux (and that’s actually where the Notepad++ screenshots in my guide are from, I’ll admit). But it is a Windows-only application really, runs natively only on Windows.

Plus there was an annoying little inconsistency in the display of the command free in Gedit, but not in Notepad++. This CoE4 command also happens to be an actual command in GNU/Linux, so Gedit displays it highlighted as such when shell highlighting is chosen, making it oddly stand out against other CoE4 commands. The Unix shell highlighting of Notepad++ doesn’t do that, because free is a Linux-specific command, doesn’t occur in general Unix.

So Gedit is where I started. And when I saw there are Gedit versions available for Windows too, I felt I had to check that possibility out as well, and tell about it. I didn’t really expect I would convince any Windows user to ditch Notepad++ for Gedit (v2).

Originally posted by Franknfurter:
Just noticed that FangoWolf has a language file for Notepad++ CoE4... I suppose the best way to get colours I like is probably to do it myself... something closer to shell I think. (Personally I'm not a fan of changing font/pinks/etc.)
His post no doubt served as an incentive for me to now do this for Gedit, perhaps also made me feel I didn’t have to worry about Notepad++, because it had “already been done”. But, looking at his definition, he does seem to have made some unconventional choices – regarding colors, use of a font (Comic Sans) that isn’t monospaced, and having comments not defined through the ‘#’ character syntactically used by the game for it but rather through markers of his own choice.

So, I have now posted a (somewhat more conservative) Notepad++ version anyway, of these language definitions. Pick what you like, or make your own. 😊
________________________________________

Regarding operators, the only one for which I provide highlighting support is the ASCII circumflex used for newlines in (most) strings. Other CoE4 operators (within strings) are highly dependent on what command they are used with, and I didn’t even try to figure out how to correctly mark those. (An equals sign, for instance, could sometimes be a CoE4 operator, at other times an ordinary part of the text.)
________________________________________

As for thumbnails of TGA images, this is one problem I don’t have with Gnome Nautilus on Linux (the counterpart to Windows Explorer), since it does this natively. :steamhappy:

Currently no thumbnails of XCF files though. I remember that it earlier did, but XCF files are tricky, highly GIMP-specific, basically (which is no doubt why the application you tried fails with some of them). The idea is that XCF eventually, in some distant future, is to be replaced with a more standardized file format, OpenRaster[en.wikipedia.org] (file name extension '.ora'), to be the default for many image editors besides GIMP. But it’s understandably a daunting task to figure out how all kinds of image editing features are to be sensibly handled, when not all image editors support those features. (It is possible already now to have GIMP export to – some kind of – ora files, but since the format isn’t even finalized, support can be expected to be a bit shaky.)
Last edited by Marlin; 27 Mar, 2016 @ 2:21pm
Althaea 15 Oct, 2017 @ 4:19am 
The links in the OP have been removed. Marlin, if you're still around and have a link to those files I'd appreciate it if you shared them anew.

(Considered trying to make .lang files of my own but while I think I can do it, it's a pain in the butt to learn from scratch and it would save me a lot of time and effort if you could provide access to yours again.)
Xelos 15 Oct, 2017 @ 12:35pm 
Originally posted by alguLoD:
The links in the OP have been removed. Marlin, if you're still around and have a link to those files I'd appreciate it if you shared them anew.

(Considered trying to make .lang files of my own but while I think I can do it, it's a pain in the butt to learn from scratch and it would save me a lot of time and effort if you could provide access to yours again.)

I added the 3 lang files I have into the latest populum version I just released (0.7).
Althaea 15 Oct, 2017 @ 10:50pm 
Those are for the Windows version, if I'm not mistaken. (I use Linux.) Still, might be I can make something out of them.
Marlin 20 Oct, 2017 @ 6:37am 
Sigh! Seems Steam has again decided to block all MediaFire links. As I recall, this happened earlier with some CoE3 stuff I linked to, but then those links started working again without me doing anything. And my MediaFire links worked fine in 2016.

I have now changed link in first post to Dropbox. Hopefully that’ll work better. Sorry for not seeing this earlier (have been away for a long while). Assuming Dropbox works, I guess I’ll now have to copy the rest of my stuff to Dropbox as well.
Althaea 20 Oct, 2017 @ 8:09am 
No worries, I understand completely.

The link works fine for me. Much obliged, thank you.
< >
Showing 1-7 of 7 comments
Per page: 1530 50