In Xpilot-AI, 0 degrees is to the right and 90 degrees is up.
Please note that many of the item related functions simulate keypresses. So, for example, if pressing Tab would not place a mine (say, because you have none), dropMine will not either.
ID functions refer to a specific ship's ID, while IDX functions refer to the ship's index within your buffer.
headlessMode() - Execute this before start to run windowless.
start(int argc, char* argv[]) - [C] Initializes the AI interface and starts Xpilot
Class var = new Class(String[] args); - [Java] Initializes the AI interface and starts Xpilot
start(func, ["listof","args"]) - [Python] Initializes the AI interface and starts Xpilot
(start func '("listof" "args") - [Racket] Initializes the AI interface and starts Xpilot
int ballX() - Returns the x position of the first ball found on the map. Returns -1 if no balls are found.
int ballY() - Returns the y position of the first ball found on the map. Returns -1 if no balls are found.
int connectorX0() - Returns the X position of the point that is one end of the connector. Returns -1 if no connectors are found.
int connectorX1() - Returns the X position of the point that is the other end of the connector. Returns -1 if no connectors are found.
int connectorY0() - Returns the Y position of the point that is one end of the connector. Returns -1 if no connectors are found.
int connectorY1() - Returns the Y position of the point that is the other end of the connector. Returns -1 if no connectors are found.
int closestRadarX() - Returns the closest ship's X radar coordinate. (0-256) Returns -1 if there are no ships on the radar.
int closestRadarY() - Returns the closest ship's Y radar coordinate. (0-256) Returns -1 if there are no ships on the radar.
int closestItemX() - Returns the closest item's X radar coordinate. Returns -1 if there are no items on the screen.
int closestItemY() - Returns the closest item's Y radar coordinate. Returns -1 if there are no items on the screen.
int closestShipId() - Returns the closest ship's ID. Returns -1 if there are no ships on the screen.
double enemySpeedId(int id) - Returns the speed of the specified enemy in pixels per frame. Returns -1 if the specified id could not be found.
double enemyTrackingRadId(int id) - Returns the direction in which the specified enemy is moving in radians. Returns 0.0 if the specified id could not be found.
double enemyTrackingDegId(int id) - Returns the direction in which the specified enemy is moving in degrees. Returns 0.0 if the specified id could not be found.
int enemyReloadId(int id) - Returns the specified enemy's reload time remaining. Returns -1 if the specified id could not be found.
int screenEnemyXId(int id) - Returns the specified enemy's X coordinate on the map. Returns -1 if the specified id could not be found.
int screenEnemyYId(int id) - Returns the specified enemy's Y coordinate on the map. Returns -1 if the specified id could not be found.
double enemyHeadingDegId(int id) - Returns the direction the specified enemy is facing in degrees. Returns -1 if the specified id could not be found.
double enemyHeadingRadId(int id) - Returns the direction the specified enemy is facing in radians. Returns -1 if the specified id could not be found.
int enemyShieldId(int id) - Returns 1 if the specified enemies shield is up, 0 if it is down, or -1 if the specified id could not be found.
int enemyLivesId(int id) - Returns the specified enemy's remaining lives (if there is a limit) or the number of lives spent. Returns -1 if the specified id could not be found.
char* enemyNameId(int id) - Returns the specified enemy's name. Returns NULL if the specified id could not be found.
double enemyScoreId(int id) - Returns the specified enemy's score. Returns -1 if the specified id could not be found.
int enemyTeamId(int id) - Returns the specified enemy's team ID. Returns -1 if the specified id could not be found. Returns -1 if there are no teams.
double enemyDistanceId(int id) - Returns the distance between the ship and the specified enemy. Returns -1 if the specified id could not be found.
Ships are sorted from near (nearest at index 0) to far. Only ships that are on screen should be accessible.
double enemyDistance(int idx) - Returns the distance between the ship and the specified enemy.
double enemySpeed(int idx) - Returns the speed of the specified enemy.
int enemyReload(int idx) - Returns the specified enemy's reload time remaining.
double enemyTrackingRad(int idx) - Returns the specified enemy's tracking in radians.
double enemyTrackingDeg(int idx) - Returns the specified enemy's tracking in degrees.
int screenEnemyX(int idx) - Returns the specified enemy's X coordinate on the map.
int screenEnemyY(int idx) - Returns the specified enemy's Y coordinate on the map.
double enemyHeadingDeg(int idx) - Returns the direction the specified enemy is facing in degrees.
double enemyHeadingRad(int idx) - Returns the direction the specified enemy is facing in radians.
int enemyShield(int idx) - Returns the specified enemy's shield status.
int enemyLives(int idx) - Returns the specified enemy's remaining lives. Returns -1 if the corresponding object cannot be found within the Others array.
int enemyTeam(int idx) - Returns the specified enemy's team. Returns -1 if the corresponding object cannot be found within the Others array.
char* enemyName(int idx) - Returns the specified enemy's name. Returns empty string if the corresponding object cannot be found within the Others array.
double enemyScore(int idx) - Returns the specified enemy's score. Returns 0.0 if the corresponding object cannot be found within the Others array.
void tankDetach() - Detaches a fuel tank from the ship.
void cloak() - Cloaks the ship from sight.
void ecm() - Launches an ECM to temporarily blind opponents.
void transporter() - Uses the transporter item to steal an opponent's item or fuel supply.
void tractorBeam(int flag) - Uses the ship's tractor beam to pull in enemy ships. Flag is either 1, to virtually hold down the key, or 0, to release the key.
void pressorBeam(int flag) - Uses the ship's pressor beam to push away enemy ships. Flag is either 1, to virtually hold down the key, or 0, to release the key.
void phasing() - Uses the phasing item to allow the ship to pass through walls.
void shield(int flag) - Turns on or off the ship's Shield. Flag is either 1, to virtually hold down the key (shields up), or 0, to release the key (shields down).
void emergencyShield() - Uses the emergency shield item to protect your ship from damage for a period of time.
void hyperjump() - Uses the hyper jump item to warp the ship to a random location on the map.
void nextTank() - Switches to the ship's next fuel tank.
void prevTank() - Switches to the ship's previous fuel tank.
void toggleAutopilot() - Uses the autopilot item to stop the ship's movement.
void emergencyThrust() - Uses the emergency thrust item to increase the ship's movement speed for a period of time.
void deflector() - Uses the deflector item to push everything away from the ship.
void selectItem() - Selects the ship's item to be dropped.
void loseItem() - Drops the ship's selected item.
void lockNext() - Locks onto the next ship in the ship buffer.
void lockPrev() - Locks onto the prev ship in the ship buffer.
void lockClose() - Locks onto the closest ship.
void lockNextClose() - Locks-on to the next closest ship.
void loadLock1() - Load a saved lock-on enemy ship
void loadLock2() - Load a saved lock-on enemy ship
void loadLock3() - Load a saved lock-on enemy ship
void loadLock4() - Load a saved lock-on enemy ship
void connector(int flag) - Connects the ship to the ball in Capture the Flag Mode. Flag is either 1, to virtually hold down the key, or 0, to release the key.
void dropBall() - Drops the ball in Capture the Flag Mode.
void refuel(int flag) - Refuels the ship. Flag is either 1, to virtually hold down the key, or 0, to release the key.
void toggleNuclear() - Toggles the option to have the ship fire Nuclear weapons instead of regualar weapons, takes up five mines or seven missiles per shot.
void togglePower() - Toggles the power levels of the ship's weapons.
void toggleVelocity() - Modifies the explosion velocity of mines and missiles.
void toggleCluster() - Toggles the option to have the ship fire Cluster weapons instead of regular weapons.
void toggleMini() - Toggles the option to have the ship fire Mini weapons instead of regular weapons.
void toggleSpread() - Toggles the option to have the ship fire Spread weapons instead of regular weapons.
void toggleLaser() - Toggles between the LS stun laser and the LB blinding laser.
void toggleImplosion() - Toggle the option to have mines and missiles implode instead of explode, the explosion will draw in players instead of blowing them away.
void toggleUserName() - Toggles the displayed information on the HUD on the left of the screen.
void loadModifiers1() - Loads Modifiers.
void loadModifiers2() - Loads Modifiers.
void loadModifiers3() - Loads Modifiers.
void loadModifiers4() - Loads Modifiers.
void clearModifiers() - Clears Modifiers.
void turnLeft(int flag) - Turns the ship left. Flag is either 1, to virtually hold down the key, or 0, to release the key.
void turnRight(int flag) - Turns the ship right. Flag is either 1, to virtually hold down the key, or 0, to release the key.
void turn(int deg) - Turns the ship in the specified number of degrees.
void turnToDeg(int deg) - Turns the ship towards the specified heading in degrees.
void thrust(int flag) - Turns the ship's thrusters on or off. Flag is either 1, to virtually hold down the key, or 0, to release the key.
void setTurnSpeed(double s) - Sets the speed the ship will turn by. The minimum power level is 4.0 and the maximum power level is 64.0.
void setTurnSpeedDeg(int s) - Ship turns to input degree.
void setPower(double s) - Sets the amount of power the ship will use for thrusting, the minimum power level is 5.0 and the maximum power is 55.0.
void fasterTurnrate() - Increases the ship's turn rate.
void slowerTurnrate() - Decreases the ship's turn rate.
void morePower() - Increases the ship's thrusting power.
void lessPower() - Decreases the ship's thrusting power.
void keyHome() - Changes the ship's home base or respawn location.
void selfDestruct() - Triggers the ship's self destruct mechanism.
void pauseAI() - Pauses the game for the ship, does not affect other ships.
void swapSettings() - Swaps between the ship's settings for turn rate and thrusting power.
void quitAI() - Quits Xpilot.
void talkKey() - Opens up the chat window.
void toggleCompass() - Toggles the ship's Compass.
void toggleShowMessage() - Toggles messages on the HUD on the left side of the screen.
void toggleShowItems() - Toggles items on the HUD on the left side of the screen.
void repair() - Repairs a target.
void reprogram() - Reprograms a modifier or lock bank.
void talk(char* talk_str) - Sends a message.
char* scanMsg(int id) - Returns the specified player message. ID 0 is the most recent occurring message. If the id is past the max numbers of messages it returns empty string.
char* scanGameMsg(int id) - Returns the specified game message. ID 0 is the most recent occurring message. If the id is past the max numbers of messages it returns empty string.
double degToRad(int deg) - Converts degrees to radians.
double radToDeg(double rad) - Converts radians to degrees.
double angleDiff(int angle1, int angle2) - Calculates the difference between two angles. Output range [-180,180] degrees. Returns the smallest angle which angle1 could add to itself to be equal to angle2.
double angleAdd(int angle1, int angle2) - Calculates the sum of two angles. Takes and returns in degrees. Output range [0,360).
int selfX() - Returns the ship's X position on the map.
int selfY() - Returns the ship's Y position on the map.
int selfRadarX() - Returns the ship's X radar coordinate. If the ship is hidden from the radar returns -1.
int selfRadarY() - Returns the ship's Y radar coordinate. If the ship is hidden from the radar returns -1;
int selfVelX() - Returns the ship's X velocity.
int selfVelY() - Returns the ship's Y velocity.
int selfSpeed() - Returns the ship's speed.
double lockHeadingDeg() - Returns in degrees the direction of the ship's lock-on of an enemy. (Direction from ship to target ship)
double lockHeadingRad() - Returns in radians the direction of the ship's lock-on of an enemy. (Direction from ship to target ship)
short selfLockDist() - Returns the distance of the enemy that the ship has locked-on to. Need to check this.
int selfReload() - Returns the player's reload time remaining, based on a call to fireShot(). 0 means that the ship is able to fire again.
int selfID() - Returns the ID of the ship.
int selfAlive() - Returns 0 if the ship is dead or 1 if alive.
int selfTeam() - Returns an integer corresponding to the ship's team.
int selfLives() - Returns how many lives are left for the ship (if there is a life limit). Otherwise it returns the number of lives spent.
double selfTrackingRad() - Returns the ship's tracking (direction it is moving in) in radians. If the ship is not moving it returns the direction the ship is facing.
double selfTrackingDeg() - Returns the ship's tracking (direction it is moving in) in degrees. If the ship is not moving it returns the direction the ship is facing.
double selfHeadingDeg() - Returns the direction the ship is facing in degrees.
double selfHeadingRad() - Returns the direction the ship is facing in radians.
char* hud(int i) - Returns the name of the object with index i in the score_objects list.
char* hudScore(int i) - Returns the score of object at index i of score_objects on the HUD.
double hudTimeLeft(int i) - Returns the remaining time left on the HUD for a score of object at index i of score_objects in seconds.
double getTurnSpeed() - Returns the ship's turn speed.
double getPower() - Returns the ship's power level.
int selfShield() - Returns 1 if the player's shield is on, 0 if it's down, or -1 if the player is not alive.
char* selfName() - Returns the ship's name.
double selfScore() - Returns the ship's score.
int wallFeeler(int dist, int angle) - takes a distance to search from the ship (dist), and an angle to search in degrees (angle). If no wall is felt it returns dist. If a wall is felt it returns the wall's distance from the ship.
int wallFeelerRad(int dist, double a) - takes a distance to search from the ship (dist), and an angle to search in radians (a). If no wall is felt it returns dist. If a wall is felt it returns the wall's distance from the ship.
int wallBetween(int x1, int y1, int x2, int y2) - If there is a wall between the given points it returns the distance from point 1 to the first found wall. If no wall is found it returns -1.
void fireShot() - Fires a shot from the ship's main cannon.
void fireMissile() - Fires a missile from the ship.
void fireTorpedo() - Fires a torpedo from the ship.
void fireHeat() - Fires a heat seeking missile from the ship.
void dropMine() - Drops a stationary mine from the ship.
void detachMine() - Releases a mine from the ship that will have the same velocity as the ship upon point of detachment.
void detonateMines() - Detonates mines previously released from the ship.
void fireLaser() - Fires a laser from the ship.
These will return -1 if the buffer has no shot at the given index. Buffer is sorted near (nearest at 0) to far. Shots that are not on the screen should not be in the buffer.
int shotAlert(int idx) - Returns a danger rating of a shot, the smaller the number the more likely the shot is to hit the ship.
int shotX(int idx) - Returns the X coordinate of a shot on the map.
int shotY(int idx) - Returns the Y coordinate of a shot on the map.
int shotDist(int idx) - Returns the distance of a shot from the ship.
int shotVel(int idx) - Returns the velocity of a shot. (Technically speed, velocity is a vector, not a scalar)
int shotVelDir(int idx) - Returns the direction of the velocity of a shot. (in degrees)
int aimdir(int idx) - Returns the direction that the ship needs to turn to in order to face the enemy in degrees. Fails and returns -1 under a few conditions.