Callbacks

From ASSS Wiki
Revision as of 23:40, 11 November 2008 by Initrd.gz (talk | contribs) (Created a Callbacks page, which is a reference to callbacks.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page contains a list of callbacks and arguments for functions. I have tried to format them as well as I can in C. Currently, they are listed in alphabetical order of filenames, but that needs to be changed. Correct parameter names are given. In Python, all variables with "inout" after the type need to be returned from the function. In C you can just ignore it.

  • CB_ARENAACTION(Arena *target, int *action): This callback is called whenever the arena is created, changed, destroyed, or configuration files changed. target is the arena being affected, and action is what the arena is doing (AA_*). Gotten from arenaman.h
  • CB_BALLPICKUP(Arena *arena, Player *p, int bid): This callback is called whenever a player picks up a ball. arena is the arena it happened in, p is the player who picked up the ball, and bid is the ID of the ball picked up. Gotten from balls.h
  • CB_BALLFIRE(Arena *arena, Player *p, int bid): Like the CB_BALLPICKUP command, except this is called when the ball is thrown. arena is the arena it happened in, p is the player who picked up the ball, and bid is the ID of the ball. Gotten from balls.h
  • CB_GOAL(Arena *arena, Player *p, int bid, int x, int y): This is called when the ball goes into the goal. arena is the arena it happened in, p is the person who had the ball last, bid is the ID of the ball scored, and x and y is the last position of the ball (PLEASE CONFIRM!). Gotten from balls.h
  • CB_SET_BANNER(Player *p, Banner *banner): This is called when a player sets his/her banner. p is the player (Ship will always be SHIP_SPEC), and banner is the banner that has been set. Gotten from banners.h
  • CB_CHATMSG(Player *p, int type, int sound, Player *target, int freq, const char *text): Called whenever a player sends a message. p is the player, type is the type of message, which is not just zone, arena, freq, or private (see chat.h), target is the target of a private message, freq is the frequency of a team chat message, and of course, text is the message. Gotten from chat.h
  • CB_REWRITECOMMAND(int initial, char *buf, int len): I have no idea what this does, but the file states that "this isn't for general use", so... Gotten from chat.h
  • CB_GLOBALCONFIGCHANGED(void): Called when the global configuration file(s) have been changed. The function does not take any parameters. Gotten from config.h
  • CB_PLAYERACTION(Player *p, int action, Arena *arena): Called when a player does a miscellaneous function, such as enter an arena. p is the player, action is the action (PA_*, see core.h), and arena is the arena being entered/left, depending on what the player is doing. Gotten from core.h
  • CB_TURFTAG(Arena *a, Player *p, int fid, int oldfreq, int newfreq): Called whenever a turf flag is tagged. CB_FLAGONMAP will also run, but this provides more info. a is the arena, p is the player, fid is the flag ID, and old- and newfreq are the old and new frequencies of the flag owners. Gotten from fg_turf.h
  • CB_WARZONEWIN(Arena *a, int freq, int *points): Called to figure out the points rewarded from a won warzone-style game. a is the arena, freq is the winning freq, and points is the points rewarded (PLEASE CONFIRM!), and must be incremented. Gotten from fg_wz.h
  • CB_FLAGGAIN(Arena *a, Player *p, int fid, int how): Called when a player gains a flag. a is the arena, p is the player that got the flags, fid is the ID of the flag(s) gotten (dunno how it works with multiple flags though), and how is how the player got the flags. Gotten from flagcore.h (see that for "how" values)
  • CB_FLAGLOST(Arena *a, Player *p, int fid, int how): The opposite of CB_FLAGGAIN. All parameters are the same, except p is the player that lost the flags. Gotten from flagcore.h
  • CB_FLAGONMAP(Arena *a, int fid, int x, int y, int freq): Called when a flag is placed on the map (dropped, neuted, moved, ect). a is the arena, fid is the flag ID, x and y it the position of the flag, and freq is the frequency of the flags. Gotten from flagcore.h
  • CB_FLAGRESET(Arena *a, int freq, int points): Called when a flag game is reset, including when it is won. a is the arena, freq is the winning frequency (PLEASE CONFIRM!), and points is the points won (PLEASE CONFIRM!). Gotten from flagcore.h
  • CB_KILL(Arena *arena, Player *killer, Player *killed, int bounty, int flags, int inout *pts, int inout *green): Called when a player is killed. arena is the arena, killer is the killer, killed is the killed player, bounty is the bounty displayed in the kill message, flags is the number of flags the killed person was carrying, points is the points the kill is worth, and green is the prize that will be placed after the callback. Gotten from game.h

MORE COMING!