Difference between revisions of "Hook Functions"

From theFarWilds
Jump to: navigation, search
m (Script Functions moved to Hook Functions: "Script Functions" is kind of vague -- all functions are script functions, no?)
m
Line 1: Line 1:
[[Scripting]]
+
[[Category:Scripts]]
These are functions you can implement in your scripts. They are call at the appropriate times by the game.
+
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.
  
 +
== 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
Line 15: Line 16:
 
  // called after all the new round events
 
  // called after all the new round events
 
   
 
   
  void '''onPlayersTurn'''(Player player);  
+
  void '''onPlayersTurn'''(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();
Line 21: Line 23:
 
  void '''onDialogResponse'''(Player player,int resp);
 
  void '''onDialogResponse'''(Player player,int resp);
  
  void '''afterAction'''(); // not yet
+
== Not implemented yet ==
 +
  void '''afterAction'''();
 
   
 
   
+
  bool '''canPass'''(Player player);
  bool '''canPass'''(Player player); // not yet
+
  // 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.

Revision as of 18:51, 3 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.

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

void beforeStart(); 
// Do things here before any action. Place creatures and buildings, change their decks etc.

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);

Not implemented yet

void afterAction();

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.