Getting game version from JS API?

For AI and campaign script related discussions and questions
Post Reply
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Getting game version from JS API?

Post by aubergine »

Is it possible to get game version from the JS API?

This would allow me to make a mod that works across several versions of the game to make end-user experience better because it avoids the need for multiple versions of a mod - the mod can internally adapt to differences in API between game versions.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Getting game version from JS API?

Post by Per »

The global variable 'version' contains the version number of the game.

(Sorry to be so late to reply to this.)
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Getting game version from JS API?

Post by aubergine »

I think you replied already in another thread and it's in the JS API doc so no worries :)

BTW, is there a URL to get latest JS API pdf file? I'm not sure how it's created...
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
dak180
Trained
Trained
Posts: 288
Joined: 01 Nov 2009, 23:58
Location: Keeper of the Mac Builds

Re: Getting game version from JS API?

Post by dak180 »

aubergine wrote:I think you replied already in another thread and it's in the JS API doc so no worries :)

BTW, is there a URL to get latest JS API pdf file? I'm not sure how it's created...
You should be able to open the pdf from the help menu (mac build) from the most recent revision of master in git.

If you have Xcode installed you should be able to open the project and build it just by opening the project file and telling it to build (see CompileGuideMac for full details).
User:dak180
Keeper of the Mac Builds
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Getting game version from JS API?

Post by aubergine »

Help menu?

As for building the game, I'm not keen on installing too much stuff on my mac as I use it primarily for work. I'm pondering getting a mac mini and hosting it somewhere so that it can be used for nightly builds but it's quite an expensive option.

Perhaps veering off-topic, but would the devs be interested in an alternate approach to documenting the JS API?

I've set up a wiki to document my Util and Vault libraries (the vault does so much stuff I needed to start documenting it's features just so I could remember them as I have very bad memory like that blue fish in Finding Nemo) and also my EggPlant AI. Because I kept needed to refer to JS API in my I created another wiki space and created pages in it for every function, event, constant and global... which gave me the idea that a wiki might be a good approach to the docu as more people could work on it and put in examples and so on?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Getting game version from JS API?

Post by Emdek »

aubergine, probably HTML output similar to that done by Doxygen hosted somewhere, with ability to comment it (easy to enhance), would be best idea.
But I don't know which tool is used to extract current information (I could try to judge from layout of PDF file, but I've still didn't manage to get it :-D).
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Getting game version from JS API?

Post by Per »

The extraction tool is custom made. Actually, just a couple of lines of grep and sed... :-)

cybersphinx found a way to generate HTML output from it. We could look at a way to host that automatically.
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Getting game version from JS API?

Post by Emdek »

So... Should I add this to my wz TODO list? :-P
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Getting game version from JS API?

Post by aubergine »

So, I've continued on with manually writing up infos in my wiki (not publicly accessible yet) - my main reason being that the wiki pages make it much easier to add examples, links to other information and allow collaborative authoring + discussions which is always a good thing for docu.

While the wiki pages won't update automatically, I still feel they are a viable way to deliver the information because the API doesn't change fast enough to outpace edits to the wiki. Once in the wiki, quick reference guides can be created - for example, a page that gives me a quick overview of all droid related stuff with links to relevant API docs.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Getting game version from JS API?

Post by Emdek »

It is possible to integrate this with wiki, but will take more work. ;-)
For example dynamically extracted part could be put as variable to be substitute when parsing, like BBCode.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Getting game version from JS API?

Post by aubergine »

Uhm, that's part of the point though - I'm not sure any sort of integration is needed. If a PDF can already be output based on the code comments, then that PDF can just be uploaded to wiki from time to time (there is an API for uploading attachments). The wiki also allows PDF file to be embedded inside the wiki page so it can be viewed directly in the browser without downloading the PDF.

The wiki page versions of the docs will be completely different content, written in a different way with examples, images, videos, tables, etc. The extra flexibility gained this way allows much richer content to be created.

Note: The wiki is not the same as http://developer.wz2100.net - it's different software (Confluence) with Java back-end.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Getting game version from JS API?

Post by Emdek »

I prefer textual data (including HTML), PDF has a bit bigger requirements.
Also I would stick with wiki like in Trac or simple custom one.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
Post Reply