Javascript API documentation

For AI and campaign script related discussions and questions

Re: Javascript API documentation

Postby NoQ » 01 Sep 2013, 11:03

Yeah, and also scavengers use different textures on urban/rockies.
Great, no more WRF hell for modders!
___________________
Just noticed that enableTemplate() doesn't do anything, neither on 3.1 nor on 3.2.
In both cases everything is controlled via templates.{txt,ini}.
User avatar
NoQ
Special
Special
 
Posts: 6068
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Postby Per » 01 Sep 2013, 19:26

Hmm. As far as I can tell, only urban used different baba textures, which is weird. Won't those rockies babas freeze? O_o I can fix this, but should I give rockies babas kevlar vests, while I'm at it?

I didn't realize that about enableTemplate(). Not sure what to do about it. templates.txt|ini sort of does everything you need, I think?
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: Javascript API documentation

Postby Goth Zagog-Thou » 01 Sep 2013, 22:47

I have encountered the same problem as NoQ, Per.
User avatar
Goth Zagog-Thou
Regular
Regular
 
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base

Re: Javascript API documentation

Postby NoQ » 02 Sep 2013, 05:57

In fact per-tileset textures (and maybe even per-tileset pies) are a very useful feature. Especially when custom tilesets are around (i had to recolor barbarian huts to fit the volcanic tileset gamma).

As for templates, i'd rather say deprecate templates.ini :3 (keep it only for wzscript) cause right now this is the only use case we have for it, and even this is duplicated. Probably make the js function actually work and add a component-based variant (?)
User avatar
NoQ
Special
Special
 
Posts: 6068
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Postby Per » 02 Sep 2013, 07:52

Maybe we should move some of the per-tileset-relevant textures into the terrain directories...

I'm not sure why you need enableTemplate() when you can control it all with greater granularity with enableComponent() already?
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: Javascript API documentation

Postby NoQ » 02 Sep 2013, 19:39

I'm not sure why you need enableTemplate() when you can control it all with greater granularity with enableComponent() already?
Well it all started when we tried to discriminate between necessity to research components and necessity to design a template out of existing components and found that the latter is not always trivially available.
User avatar
NoQ
Special
Special
 
Posts: 6068
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Postby NoQ » 12 Oct 2013, 06:43

Looking for a way of working with structure blueprints. Two specific problems:

  • Estimating allocated money. Unlike unit production or research, money is not spent instantly after the construction order is given. So i want to be able to know the net cost of all blueprints at any moment, or at least make it accounted for in queuedPower() (unless it already is).
  • Knowing what oil derricks are already being taken by me and allies. For example, I'd like to be able to cancel oil derrick construction order if my ally has just ordered it as well. It'd also simplify the code that makes sure i don't order the same derrick twice.

Not sure how to implement it. Probably enumBlueprints(player = me) and eventBlueprintAppeared(object).
User avatar
NoQ
Special
Special
 
Posts: 6068
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Previous

Return to Scripting