Javascript API documentation
Javascript API documentation
I am starting to generate the API documentation for the new scripting system based on Javascript. It is in a PDF where most of its content is automatically generated from documentation inside the source code. This is a work in progress - it is not recommended to start working with this scripting system yet.
However, if you have any feedback on the documentation or the API design, feel free to post your thoughts in this thread.
The new scripting system is already being used to determine winners and losers, set up bases and starting techs, and control scavengers. I am also in the process of converting the Semperfi AI to the new system -- it currently builds some trucks and does some research, and that is about it. Be patient, please
Master docs autogenerated by the buildbot:
One page: http://buildbot.wz2100.net/files/javasc ... cript.html
Multi page table of contents: http://buildbot.wz2100.net/files/javasc ... index.html
However, if you have any feedback on the documentation or the API design, feel free to post your thoughts in this thread.
The new scripting system is already being used to determine winners and losers, set up bases and starting techs, and control scavengers. I am also in the process of converting the Semperfi AI to the new system -- it currently builds some trucks and does some research, and that is about it. Be patient, please
Master docs autogenerated by the buildbot:
One page: http://buildbot.wz2100.net/files/javasc ... cript.html
Multi page table of contents: http://buildbot.wz2100.net/files/javasc ... index.html
Re: Javascript API documentation
/aside: LaTeX reminds me of my school days
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: Javascript API documentation
Yay!!!!!! just what I've been waiting for
I think I shall go start the Per fan club
I think I shall go start the Per fan club
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
-
- Inactive
- Posts: 1695
- Joined: 01 Sep 2006, 19:17
Re: Javascript API documentation
Don't know about the formatting needs, but since we use that anyway it could be in asciidoc format instead of latex.
We want information... information... information.
Re: Javascript API documentation
Hmm, so all those "secondaries" are now deprecated? Also, what about some "DORDER_REARM" for VTOLs? (a wrong place to ask?)DORDER_PATROL
Well, anyway, that's nice to hear! I don't care about format as long as it's searchable (:
(:/aside: LaTeX reminds me of my school days
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
There are some orders missing. I am mostly adding stuff as needed at the moment. Not sure how much of the underlying complexity that should be exposed, as some of it is rather painful. If you read carefully, you'll see that I've removed templates from the scripting system -- you now just pass the list of components directly to the factory, and the underlying code handles the templates stuff for you.
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: Javascript API documentation
It would be really nice if some cam oriented stuff got in sometime... The biggest need would be unit spawning.
Other than the missing stuff it looks very well done, reading the docs is like reading a Christmas list of things I wanted
Is there any way to list a JavaScript script in a wrf at this time?
Other than the missing stuff it looks very well done, reading the docs is like reading a Christmas list of things I wanted
Is there any way to list a JavaScript script in a wrf at this time?
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: Javascript API documentation
Yes. Just use the "JAVASCRIPT" keyword.milo christiansen wrote:Is there any way to list a JavaScript script in a wrf at this time?
Ok, then I just added unit spawning. See addDroid() in the new version of the doc attached below. It creates a unit out of the supplied components. Does that look ok?milo christiansen wrote:It would be really nice if some cam oriented stuff got in sometime... The biggest need would be unit spawning.
Anything else you need - just ask.
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: Javascript API documentation
Cool, Thanks!
Well everything that's in WZScript might be nicePer wrote:Anything else you need - just ask.
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: Javascript API documentation
Typo or actually overriden function? Cause "eventStructureBuilt" looks right here.3.4 eventDroidBuilt
...
3.5 eventDroidBuilt
For some time I've been curious: what is the "droid" parameter good for?pickStructLocation(droid, structure type, x, y)
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
Yeah, typo. Will fix. The droid parameter for pickStructLocation() is to make sure we suggest a placement that is (at least theoretically) reachable by that droid.
- Goth Zagog-Thou
- Regular
- Posts: 1582
- Joined: 06 Jan 2007, 08:08
- Location: Delta Base
- Contact:
Re: Javascript API documentation
How are INTMESSAGE's going to be handled? Same way as before?
Re: Javascript API documentation
Maybe. Got any better ideas?Goth Zagog-Thou wrote:How are INTMESSAGE's going to be handled? Same way as before?
- Goth Zagog-Thou
- Regular
- Posts: 1582
- Joined: 06 Jan 2007, 08:08
- Location: Delta Base
- Contact:
Re: Javascript API documentation
Actually.. yeah. At least partially.
Let's take beacons, for example. You know, the ones on missions that are dropped onto the map to show the player mission objectives and things? Currently requires:
1.) an entry in the .vlo
2.) an entry in the .slo
3.) a PROX.txt file of some sort, containing all the particulars of that beacon
4.) another .txt file that mirrors it (and it IS required to be there for some reason)
5.) yet ANOTHER .txt file that shows what the beacon is named when the player clicks on it.
All of the above should be handled by a single command in the script.
My proposal:
and of course, the command to remove it:
For other messages, we can simply use console(string) and do any text output needs that way.
That's my idea.
Let's take beacons, for example. You know, the ones on missions that are dropped onto the map to show the player mission objectives and things? Currently requires:
1.) an entry in the .vlo
2.) an entry in the .slo
3.) a PROX.txt file of some sort, containing all the particulars of that beacon
4.) another .txt file that mirrors it (and it IS required to be there for some reason)
5.) yet ANOTHER .txt file that shows what the beacon is named when the player clicks on it.
All of the above should be handled by a single command in the script.
My proposal:
Code: Select all
addMarker (internalName, location[x], location[y], location[z], color[red, green, blue, and perhaps yellow too?], soundFile[something.ogg], "[message(in quotes)]")
Code: Select all
removeMarker (internalName)
That's my idea.
Re: Javascript API documentation
They had a reason for all that ugliness... Not sure that can be done like that.
Also, I did a quick fastplay tutorial conversion to JS to see how it was like, it did work IIRC, but I don't think any of that code made it into the codebase with all the changes that were needed.
(It was a 1:1 conversion more or less, not the "correct" way so to speak)
Also, I did a quick fastplay tutorial conversion to JS to see how it was like, it did work IIRC, but I don't think any of that code made it into the codebase with all the changes that were needed.
(It was a 1:1 conversion more or less, not the "correct" way so to speak)
/facepalm ...Grinch stole Warzone contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.
Super busy, don't expect a timely reply back.