Javascript API documentation

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

Re: Javascript API documentation

Post by aubergine »

Ah, you mean something that cross-references WZscript to JavaScript, so people editing a WZscript can see how to port to JavaScript?

I'd be happy to do that, but I might need some help. I'll get an initial draft of it done this week and post URL.
Last edited by aubergine on 15 Jan 2013, 20:54, edited 2 times in total.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Originway
Trained
Trained
Posts: 412
Joined: 08 Aug 2012, 06:22

Re: Javascript API documentation

Post by Originway »

aubergine wrote:Ah, you mean something that cross-references WZscript to JavaScript, so people editing a WZscript can see how to port to JavaScript?

I'd be happy to do that, but I might need some help. I'll get an initial draft of it done this week and post URL.
yeah, I think it would be helpful
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Javascript API documentation

Post by aubergine »

@originway: Here's the first bit I've done so far - is this the sort of thing you are after? https://warzone.atlassian.net/wiki/page ... d=18776189
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Originway
Trained
Trained
Posts: 412
Joined: 08 Aug 2012, 06:22

Re: Javascript API documentation

Post by Originway »

yeah :drinks:
your site is very well done, I think they should host that stuff for you so it becomes a official part of the site!
User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: Javascript API documentation

Post by Goth Zagog-Thou »

This will be EXTREMELY helpful to me. Thanks Aubergine! :)
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Javascript API documentation

Post by aubergine »

I've just added the events/triggers section, with a table that cross-references all <callback> wzscript triggers to their related events in JS API.

I found lots of missing events, however most are related to the tutorial mode and GUI buttons. I think those events should not be implemented yet, instead wait until we've got GUI API exposed as that will determine requirements much more clearly.

Anyway, let me know if the conversion guide is going in the right direction - I've never done any wzscript so you'll have to let me know if anything there isn't making sense.

I'll continue on with expressions and the other bits of the document posted by Originway now, might even be able to get this finished tonight!
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Javascript API documentation

Post by aubergine »

Now done pretty much everything -- a lot of it I could just link to internet resources about Javascript coding (big benefit of using JS for scripting!!) and existing documentation in the wiki: https://warzone.atlassian.net/wiki/page ... d=18776189

Please let me know what other stuff is required - either post here, PM me, comment on the wiki page, whatever you want. My Skype app is currently dead (stuuupid auto-update not checking OS version!).
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Originway
Trained
Trained
Posts: 412
Joined: 08 Aug 2012, 06:22

Re: Javascript API documentation

Post by Originway »

excellent work you have done!
have you ever thought about doing a pdf book/guide from your site then those can be read offline?
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Javascript API documentation

Post by aubergine »

You can export any page on that site to PDF (although possibly you need to create a user account on there first via the login link).
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

You can export javascript API documentation to pdf by calling

Code: Select all

make javascript-doc
in the game's source code directory (you need LaTeX installed).
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Javascript API documentation

Post by aubergine »

or just download the html of the 1-page JS API guide
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

Just realised that even though cyborg engineer's .droidType JS property is equal to DROID_CONSTRUCT, cyborg engineers don't get enumerated by enumDroid(me, DROID_CONSTRUCT), because enumDroid only considers C-style droid types (so it needs to be called with DROID_CYBORG_CONSTRUCT instead). Same applies to DROID_CYBORG_REPAIR, i think.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Javascript API documentation

Post by aubergine »

Is that the bug you mentioned on nullbot with 3.1.0 and earlier that's fixed in 3.1 master?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

No.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

Also, range parameter in enumRange() needs to be converted to world coordinates or something like that.
Post Reply