[b]What is Empires API?:[/b]
Empires API has been provided to create some easy to use and more natrual functions/classes for empiresmod instead of using playerprops etc directly.
In addition, it is supposed to provide some convience functions for features which might be used a lot during scripting for empires.
As of now it only features a PYTHON import version, but a ESS script is in the works. That ESS script can be loaded by es_load empapi.
[b]Which naming convention are you following?:[/b]
All functions in the script follow the follwing convention:
[list]
[*]Each part of the function name is captilised (ex. [i]game.GetCurrentResearchName[/i])
[*]Incase a function returns multiple values it will use Get<name> (ex. [i]player.GetTurretsAllotted[/i])
[*]If possible, each get funciton also provides a Set function (ex. [i]player.SetTurretsAllotted)[/i]
[*]Functions returning a boolean will use Is or Has instead of Get (ex. [i]player.IsProne[/i], [i]game.HasRadar[/i])
[*]Functions setting a boolean will use Set<name>State (ex. [i]building.SetBuiltState[/i])
[*]Dict keys ingore captilaisation (ex. [i]player['class'][/i], [i]player['CLASS'][/i], [i]player['ClAsS'][/i] will work)
[*]Dict keys equal to the function names with Get/Set stripped (ex. [i]player['health'][/i])
[*]Dict keys using Is/Has functions will have their name stripped aswell, however Has/Is is provided, too ([i]player['prone'][/i] and [i]player['isprone] [/i]possible)
[*]Classes are lower case (except for Help class to prevent overriding python's help)
[/list]
[b]Which features are planned?:[/b]
Since this is an Alpha release there are more upcoming features. These features include, but are not limited to:
[list]
[*]ESS Support
[*]Optimised python code
[*]Improved error checking/handling in the python module
[*]More features
[*]Possible support for attribute usage
[*]Extended help feature
[/list]
Installation
Extract the zip into your Empires folder.
Incase you are upgrading from an old version, a server restart is recommended.
However, as of 0.10 it is possible to reload the api scripts manually. To do so please execute [i]es_load empapi/update[/i].
In addition, you'll need to reload any script that uses empires_api.
Version Notes For 0.10 Alpha
Updated on: 2009-06-09 08:54:53 EST by Omega_K2 (View Zip Contents)
[b]0.10 Alpha Changelog:[/b]
[list][*]Added a check whether empires mod is running upon api load
[*]Added support for using the classes like dicts
[*]Added SetHealth and GetHealth functions to player class
[*]Added GetOrigin/SetOrigin/GetOriginString/GetOriginString aliases; supported in tank and building class
[*]Added several ([b]around 50![/b]) new functions to the player class
[*]Added Helper class provding some help features
[*]Added a empapi/update script allowing to update the script without having to restart server
[*]Improved script struture; added several comments (tank class)
[*]Improved handling sides in tank armor functions; they automatically lower the input to avoid captilisaiton issues
[*]Improved handling of inputs that are required to be a boolean (Supports strings, too)
[*]Changed researchdata in the gameclass to be automatically parsed upon the first class init (Should have eleminated the need of updating the list manually upon new mod version; might cause issues if you directly used researchdata before)
[*]Changed tank armor functions to retrieve the side data from class properties instead
[*]Changed classes to retrieve manager entity indexes upon class init only once
[*]Changed classes to store manager entity indexes in a manager dict
[*]Changed player class to set userindex console var upon class init only once
[*]Changed GetOrigin/SetOrigin in the building class to be inherited from the shared object instead
[*]Fixed the error raised in game.__VerifyRearchItem; it won't output a list of valid research items anymore (caused a BufferOverflow)
[*]Fixed SetSabotageState missing the function parameter "state"
[*]Fixed script's header information to be shown properly when calling python's help() function
[/list]