Difference between revisions of "Scripting"
From theFarWilds
Line 5: | Line 5: | ||
Functions you can implement: | Functions you can implement: | ||
− | void setupGame(); // Sets up the game state such as # of players, Map Size, if they need to set a deck or not, etc | + | void setupGame(); |
− | + | // Sets up the game state such as # of players, Map Size, if they need to set a deck or not, etc | |
− | void beforeStart(); // Do things here before any action. Place creatures and buildings, change their decks etc. | + | |
− | + | void beforeStart(); | |
− | void afterAction(); // not yet | + | // Do things here before any action. Place creatures and buildings, change their decks etc. |
− | + | ||
− | void playersTurn(IPlayer player); // not yet | + | void afterAction(); // not yet |
− | + | ||
− | bool canPass(IPlayer player); // not yet | + | void playersTurn(IPlayer player); // not yet |
− | // called when the real players try to pass. This is so you can ensure they do a particular action before passing. | + | |
+ | bool canPass(IPlayer player); // not yet | ||
+ | // called when the real players try to pass. This is so you can ensure they do a particular action before passing. | ||
Functions you can call: | Functions you can call: | ||
− | IEntity createEntity(string CardName, int x_coord , int y_coord,IPlayer controller ); | + | IEntity createEntity(string CardName, int x_coord , int y_coord,IPlayer controller ); |
− | IEntity createEntity(string CardName ,ILocation loc,IPlayer controller); | + | IEntity createEntity(string CardName ,ILocation loc,IPlayer controller); |
− | IEntity createEntity(string CardName ,ILocation loc); | + | IEntity createEntity(string CardName ,ILocation loc); |
− | ILocation createLocation(int x,int y); | + | ILocation createLocation(int x,int y); |
− | IPlayer getAIPlayer(int index) | + | IPlayer getAIPlayer(int index) |
− | void addAIPlayer(string PlayerName,string Avatar,int teamID); | + | void addAIPlayer(string PlayerName,string Avatar,int teamID); |
− | // can only call this from configGame() | + | // can only call this from configGame() |
− | // all parameters are ignored for now | + | // all parameters are ignored for now |
Revision as of 15:43, 16 March 2010
This is the start of the scripting API. It will be expanded over time. If you want something ask for it in the forum.
Functions you can implement:
void setupGame(); // Sets up the game state such as # of players, Map Size, if they need to set a deck or not, etc void beforeStart(); // Do things here before any action. Place creatures and buildings, change their decks etc. void afterAction(); // not yet void playersTurn(IPlayer player); // not yet bool canPass(IPlayer player); // not yet // called when the real players try to pass. This is so you can ensure they do a particular action before passing.
Functions you can call:
IEntity createEntity(string CardName, int x_coord , int y_coord,IPlayer controller ); IEntity createEntity(string CardName ,ILocation loc,IPlayer controller); IEntity createEntity(string CardName ,ILocation loc); ILocation createLocation(int x,int y); IPlayer getAIPlayer(int index) void addAIPlayer(string PlayerName,string Avatar,int teamID); // can only call this from configGame() // all parameters are ignored for now
Example Scripts:
// Fortified AI void configGame() { addAIPlayer("Evil Fish","Crypt Doctor",0); } void beforeStart() { IPlayer aiPlayer=getAIPlayer(0); createEntity("Earthworks",6,6,aiPlayer); createEntity("Earthworks",10,10,aiPlayer); createEntity("Axe Captain",6,7,aiPlayer); createEntity("Attrition",-1,-1,aiPlayer); }