Difference between revisions of "Global Functions"
From theFarWilds
Line 1: | Line 1: | ||
− | [[ | + | [[Category:Scripts]] |
− | Global | + | '''Global functions''' can be called from anywhere in your scripts. |
− | Entity '''createEntity'''(string CardName, int x_coord , int y_coord,Player controller ); | + | Entity '''createEntity'''( string CardName, int x_coord, int y_coord, Player controller ); |
− | Entity '''createEntity'''(string CardName ,Location loc,Player controller); | + | Entity '''createEntity'''( string CardName,Location loc, Player controller ); |
− | Entity '''createEntity'''(string CardName ,Location loc); | + | Entity '''createEntity'''( string CardName,Location loc ); |
− | Location '''createLocation'''(int x,int y); | + | Location '''createLocation'''( int x, int y ); |
− | Player '''getAIPlayer'''(int index) | + | Player '''getAIPlayer'''( int index ); |
− | + | ||
− | void '''setTerrain'''(Location loc,int topo,int veg) | + | Player '''getHumanPlayer'''( int index ); |
− | int '''getTopo'''(Location loc); | + | |
− | int '''getVeg'''(Location loc); | + | void '''setTerrain'''( Location loc, int topo, int veg ); |
+ | int '''getTopo'''( Location loc ); | ||
+ | int '''getVeg'''( Location loc ); | ||
// topo: ocean=1, soggy=2, flat=3, hills=4, mountain=5 | // topo: ocean=1, soggy=2, flat=3, hills=4, mountain=5 | ||
// veg: desert=1 ,grass=2 ,forest=3 | // veg: desert=1 ,grass=2 ,forest=3 | ||
− | Entity '''getFigure'''(Location | + | Entity '''getFigure'''( Location loc ); |
void '''forEachEntity'''(); | void '''forEachEntity'''(); | ||
− | // | + | // call [[Hook Functions|entityCallback()]] once for each Entity in the game. |
− | + | ||
− | void '''enchantEntity'''(Entity toEnchant,string enchantName,Player enchantController); | + | void '''enchantEntity'''( Entity toEnchant, string enchantName, Player enchantController ); |
− | + | ||
− | void '''endGame'''(Player winner); | + | void '''endGame'''( Player winner ); |
− | void '''flipTheScript'''(int scriptID); | + | |
+ | void '''flipTheScript'''( int scriptID ); | ||
// changes what script is being used for the game | // changes what script is being used for the game | ||
// doesn't preserve global variables yet | // doesn't preserve global variables yet | ||
− | int rand(int max); | + | int rand( int max ); |
− | // | + | // return an integer from 0 to max-1 |
− | + | ||
− | + | ||
− | void '''infoBox'''(string title,string text); | + | bool randChance( float chance ); |
− | // | + | // return true with probability equal to chance |
− | void '''statusMsg'''(Player from,string msg); | + | |
+ | void '''infoBox'''( string title, string text ); | ||
+ | // display text in a pop up box to all the players | ||
+ | |||
+ | void '''statusMsg'''( Player from, string msg ); | ||
// Prints a message from a player in the battle log. | // Prints a message from a player in the battle log. | ||
// just pass an empty player to make the message from the server | // just pass an empty player to make the message from the server | ||
+ | |||
void '''wipeEffect'''(); | void '''wipeEffect'''(); |
Revision as of 19:16, 3 April 2010
Global functions can be called from anywhere in your scripts.
Entity createEntity( string CardName, int x_coord, int y_coord, Player controller ); Entity createEntity( string CardName,Location loc, Player controller ); Entity createEntity( string CardName,Location loc ); Location createLocation( int x, int y ); Player getAIPlayer( int index ); Player getHumanPlayer( int index ); void setTerrain( Location loc, int topo, int veg ); int getTopo( Location loc ); int getVeg( Location loc ); // topo: ocean=1, soggy=2, flat=3, hills=4, mountain=5 // veg: desert=1 ,grass=2 ,forest=3 Entity getFigure( Location loc ); void forEachEntity(); // call entityCallback() once for each Entity in the game. void enchantEntity( Entity toEnchant, string enchantName, Player enchantController ); void endGame( Player winner ); void flipTheScript( int scriptID ); // changes what script is being used for the game // doesn't preserve global variables yet int rand( int max ); // return an integer from 0 to max-1 bool randChance( float chance ); // return true with probability equal to chance void infoBox( string title, string text ); // display text in a pop up box to all the players void statusMsg( Player from, string msg ); // Prints a message from a player in the battle log. // just pass an empty player to make the message from the server void wipeEffect();