3.2 JS API Wishlist :)

For AI and campaign script related discussions and questions
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: 3.2 JS API Wishlist :)

Post by Per »

aubergine wrote:What about making getLabel() fulfil both needs? So if the parameter is a string, it returns object associated with that label, if the parameter is an object, it returns the label associated with it?
getLabel(object) would not get a label, as it says, it would get a game object with a label...

How about renaming label() to getObject(label | x, y), and allow it to also fetch a feature or structure if given a map position?
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: 3.2 JS API Wishlist :)

Post by aubergine »

Yes, love that idea!!!

And maybe it can have a 3rd syntax that absorbs hackGetObj(): getObject(type, player, id) ...?

One function, fulfils all your object getting needs :)
"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: 3.2 JS API Wishlist :)

Post by NoQ »

/me wishes for a orderDroid(droid, DORDER_RECYCLE).
Currently DORDER_RECYCLE doesn't pass through the whitelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: 3.2 JS API Wishlist :)

Post by aubergine »

enumLabels([type]) -- new 'type' param

Currently there's no way to filter labels to a specific type, for example if I just want a list of AREA labels. It would be nice to have an optional 'type' param that would filter the list of labels to those pointing to objects of the specified type. Currently, we have to get a list of all labels and then use label() or getObject() to retrieve each label to find out what type of object it is.
"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: 3.2 JS API Wishlist :)

Post by Per »

Filter parameter added to enumLabels(). DORDER_RECYLE added. getObject added as alias to label() as discussed above.
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: 3.2 JS API Wishlist :)

Post by Prot »

aww.. i find this topic at last ))
Hi Per, I start make my own bot on js for 3.1 a week ago, аnd I was faced with many challenges. But it is ok, only fueling interest.
I would like to have a function in 3.2+ that shows the distance between the points of computing on "pathfinder", not a stright line distance like distBetweenTwoPoints(). But it would be ideal if the function propulsionCanReach() refundable distance based on the propulsion.
And also, i spend many time to find out, why game is crash, then got it, if i try build not enabled buildings, (like not researched yet modules) with orderDroidBuild - 3.1 game is crash
..thanks to gdb debugging %)
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: 3.2 JS API Wishlist :)

Post by Per »

I cannot reproduce that crash. Can you post a backtrace in a ticket, please?
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: 3.2 JS API Wishlist :)

Post by Prot »

#3919 - ticket
But i'm little was wrong, the bug appear not while try to build not enabling module, but if variable is empty.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: 3.2 JS API Wishlist :)

Post by aubergine »

Move obj.range in to obj.weapons[<n>], add obj.sensorRange, deprecate obj.range

I assume .weapons[] only contains weapon turrets (otherwise things like .armed and .lastFired would be pointless) -- if so, would be very useful to know the range of each individual weapon, without having to getWeaponInfo().

But we'd also need to know what the sensor range of the object is, based on it's innate sensor ability or attached sensor turret (if applicable), hence desire for obj.sensorRange. Note: This would ignore any external sensors, even if obj is a droid set to DORDER_FIRESUPPORT.
"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: 3.2 JS API Wishlist :)

Post by aubergine »

NORMAL constant

It's confusing having MEDIUM used for both difficulty and <droidObj>.bodySize

Could we get a new NORMAL constant to use exclusively for difficulty, so that MEDIUM is used exclusively for .bodySize?

Assuming the two constants have the same value, the change would be backwards compatible.

NORMAL would also tie in with existing cheat codes, and it might even be worth tweaking text on AI difficulty selection panel.
"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: 3.2 JS API Wishlist :)

Post by NoQ »

Is there a fast way of finding the single nearest object (to a certain location, of a certain player, of a certain type) on the C++ side? If yes, could i use some? (:
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: 3.2 JS API Wishlist :)

Post by Per »

NoQ wrote:Is there a fast way of finding the single nearest object (to a certain location, of a certain player, of a certain type) on the C++ side? If yes, could i use some? (:
Maybe the pointtree code could be modified to use an iterator. If so, that would likely be the fastest option. Cyp could probably tell you.
User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: 3.2 JS API Wishlist :)

Post by Goth Zagog-Thou »

I have a request for something to add to the API:

Code: Select all

disableResearch("topic" [as string], player);
Literally does what it says. I actually have need of this for the Research Paths stuff.
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: 3.2 JS API Wishlist :)

Post by Shadow Wolf TJC »

If it hasn't already been implemented, could pickStructLocation() be given a direction parameter to correspond to orderDroidBuild()'s direction parameter? I'd imagine that AIs might have difficulty taking advantage of orderDroidBuild()'s direction parameter if pickStructLocation() can't find a suitable location for, say, a Cyborg Factory turned 90 degrees.

Edit: Might also be a good idea to add this to the next 3.1 version (if you guys are willing) since I doubt that AIs would be able to make orderDroidBuild()'s new direction parameter work. :P
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: 3.2 JS API Wishlist :)

Post by Per »

Don't you mean that pickStructLocation() should return a direction result? It taking a direction parameter seems backwards to me.
Post Reply