Difference between revisions of "Hook Functions"
From theFarWilds
m (Script Functions moved to Hook Functions: "Script Functions" is kind of vague -- all functions are script functions, no?) |
(→Implemented) |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | [[ | + | [[Category:Scripts]] |
− | + | The scripts you write interact with the game via a collection of hook functions. These functions are called by the game at the appropriate times and execute your code. [[Hook Timeline]] | |
+ | == Implemented == | ||
void '''configGame'''(); | void '''configGame'''(); | ||
// Sets up the game state such as # of players, Map Size, if they need to set a deck or not, etc | // Sets up the game state such as # of players, Map Size, if they need to set a deck or not, etc | ||
[[Config Functions]] | [[Config Functions]] | ||
+ | |||
+ | bool '''isDeckValid'''([[Player Functions|Player]] player); | ||
+ | // if you want to implement non-standard deck requirements | ||
+ | // use statusMsg to tell them why their deck is invalid | ||
void '''beforeStart'''(); | void '''beforeStart'''(); | ||
// Do things here before any action. Place creatures and buildings, change their decks etc. | // Do things here before any action. Place creatures and buildings, change their decks etc. | ||
+ | |||
+ | bool '''duringStart'''(); | ||
+ | // return true if you want the normal fog | ||
+ | // Should only need this to change the starting fog. | ||
void '''afterStart'''(); | void '''afterStart'''(); | ||
Line 15: | Line 24: | ||
// called after all the new round events | // called after all the new round events | ||
− | void '''onPlayersTurn'''(Player player); | + | void '''onPlayersTurn'''([[Player Functions|Player]] player); |
+ | |||
bool '''entityCallback'''(Entity entity) | bool '''entityCallback'''(Entity entity) | ||
// called for each entity in the game if you call forEachEntity(); | // called for each entity in the game if you call forEachEntity(); | ||
− | void '''onDialogResponse'''(Player player,int resp); | + | void '''onDialogResponse'''([[Player Functions|Player]] player,int resp); |
− | + | ||
− | + | ||
− | + | bool '''canPass'''([[Player Functions|Player]] player); | |
− | bool '''canPass'''(Player player); | + | // called when the real players try to pass. |
− | // called when the real players try to pass. | + | |
// This is so you can ensure they do a particular action before passing. | // This is so you can ensure they do a particular action before passing. | ||
+ | |||
+ | bool '''canAct'''([[Player Functions|Player]] player,Action action); | ||
+ | |||
+ | void '''afterAction'''(Action action); |
Latest revision as of 16:38, 23 April 2010
The scripts you write interact with the game via a collection of hook functions. These functions are called by the game at the appropriate times and execute your code. Hook Timeline
Implemented
void configGame(); // Sets up the game state such as # of players, Map Size, if they need to set a deck or not, etc Config Functions bool isDeckValid(Player player); // if you want to implement non-standard deck requirements // use statusMsg to tell them why their deck is invalid void beforeStart(); // Do things here before any action. Place creatures and buildings, change their decks etc. bool duringStart(); // return true if you want the normal fog // Should only need this to change the starting fog. void afterStart(); // Send any welcome messages here void onNewRound(); // called after all the new round events void onPlayersTurn(Player player); bool entityCallback(Entity entity) // called for each entity in the game if you call forEachEntity(); void onDialogResponse(Player player,int resp); bool canPass(Player player); // called when the real players try to pass. // This is so you can ensure they do a particular action before passing. bool canAct(Player player,Action action); void afterAction(Action action);