Page 19 of 25
Re: Javascript API documentation
Posted: 21 Jan 2013, 09:32
by aubergine
Everything else in JS API uses tile co-ordinates. Why would you want to use world coordinates for enumRange?
Re: Javascript API documentation
Posted: 21 Jan 2013, 09:33
by NoQ
It's the opposite. I don't want to use them, but currently the function forces me to.
Re: Javascript API documentation
Posted: 21 Jan 2013, 09:37
by aubergine
Ah, sorry, my misunderstanding. Yes, it should certainly use tiles like everything else.
Re: Javascript API documentation
Posted: 21 Jan 2013, 10:25
by NoQ
JS allows placing non-VTOL weapons on VTOLs in buildDroid().
Re: Javascript API documentation
Posted: 21 Jan 2013, 10:49
by Per
NoQ wrote:Also, range parameter in enumRange() needs to be converted to world coordinates or something like that.
Ouch. Please make a bug ticket for this, so I do not forget.
Re: Javascript API documentation
Posted: 21 Jan 2013, 10:55
by NoQ
Made
#3896 for four easy issues found today

Re: Javascript API documentation
Posted: 21 Jan 2013, 11:02
by Reg312
NoQ wrote:Made
#3896 for four easy issues found today (:
Why you think this is bug "JS allows placing non-VTOL weapons on VTOLs in buildDroid()." ?
is that wrong?
i worked with droid design code in my experiments. imo many things should be reviewed. So i think adding new restrictions to droid templates is not good.
curious how cyborgs templates will be handled in scripts...
Re: Javascript API documentation
Posted: 21 Jan 2013, 11:04
by NoQ
Why you think this is bug "JS allows placing non-VTOL weapons on VTOLs in buildDroid()." ?
is that wrong?
The game runs certain checks (at least, validTemplateForFactory()) before producing stuff (good for, at least, disallowing AI cheating), so i thought this thing should be checked as well, for consistency.
Re: Javascript API documentation
Posted: 21 Jan 2013, 11:58
by Per
Reg312 wrote:Why you think this is bug "JS allows placing non-VTOL weapons on VTOLs in buildDroid()." ?
is that wrong?
buildDroid() is meant to check if the template is valid (all components researched, for example), to aid debugging scripts so that they do not inadvertently cheat. addDroid(), on the other hand, deliberately skips such checks, so that you can add all kinds of interesting droids on the map.
Re: Javascript API documentation
Posted: 21 Jan 2013, 12:02
by aubergine
Indeed, this would be fun to play with for custom campaign/challenge scripts. In particular, I would be very keen to see a Seraph Missile VTOL, even if just to play with as a curiosity.
Re: Javascript API documentation
Posted: 26 Jan 2013, 12:11
by NoQ
It seems to me that supercyborgs are DROID_WEAPON. Was it intentional?
Re: Javascript API documentation
Posted: 26 Jan 2013, 14:18
by Per
NoQ wrote:It seems to me that supercyborgs are DROID_WEAPON. Was it intentional?
I don't remember
It seems to me that droid type gives a mix of function and shape information. If you go by type, then DROID_CYBER_SUPER and DROID_CYBORG both are weapon droids. But for symmetry's sake, I've changed it so that super cyborgs are DROID_CYBORG, and that enumDroid() with DROID_CYBORG also gives you super cyborgs (but it will not give you eg repair cyborgs...).
Re: Javascript API documentation
Posted: 26 Jan 2013, 14:57
by NoQ
Per wrote:I've changed it so that super cyborgs are DROID_CYBORG
Emm ... not pushed yet? Also, will it be in 3.1? Cause most of my scripts wrongly believe that super cyborgs are DROID_CYBORG.
Re: Javascript API documentation
Posted: 27 Jan 2013, 14:04
by Per
It has been pushed. The fix would not work in 3.1, I'm afraid.
Re: Javascript API documentation
Posted: 31 Jan 2013, 14:17
by NoQ
I'm still having troubles with using labels to replace my little pieces of objFromId-based code.
When label is not found, the game throws a debug message, and getObject() returns undefined, which is fine. When the label exists, but the object doesn't, it gets worse: the script crashes and doesn't proceed further.
What is the intended behaviour? Is it a good idea to make the game (on the C++ side) remove labels associated with the object when the object is destroyed? Probably it's a good idea to make getObject() return null when the label exists, while the object doesn't? If not, how should we deal with outdated labels on the script side?