Difference between revisions of "Global Functions"

From theFarWilds
Jump to: navigation, search
(New page: Scripting Global Functions that you can call from your scripts: Entity createEntity(string CardName, int x_coord , int y_coord,Player controller ); Entity createEntity(string CardNa...)
 
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Scripting]]
+
[[Category:Scripts]]
Global Functions that you can call from your scripts:
+
'''Global functions''' can be called from anywhere in your scripts.
  
  Entity createEntity(string CardName, int x_coord , int y_coord,Player controller );
+
  [[Entity_Functions|Entity]] '''createEntity'''( string CardName, int x_coord, int y_coord, Player controller );
  Entity createEntity(string CardName ,Location loc,Player controller);
+
  [[Entity_Functions|Entity]] '''createEntity'''( string CardName,Location loc, Player controller );
  Entity createEntity(string CardName ,Location loc);
+
  [[Entity_Functions|Entity]] '''createEntity'''( string CardName,Location loc );
  Location createLocation(int x,int y);
+
  Player getAIPlayer(int index)
+
  Location '''createLocation'''( int x, int y );
  Player getHumanPlayer(int index)
+
  void setTerrain(Location loc,int topo,int veg)
+
int getMapWidth();
  int getTopo(Location loc);
+
int getMapHeight();
  int getVeg(Location loc);
+
  // topo: ocean=1, soggy=2, flat=3, hills=4, mountain=5
+
  Player '''getAIPlayer'''( int index );
  // veg: desert=1 ,grass=2 ,forest=3
+
 +
  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 ,TREES=3
 +
 +
[[Entity_Functions|Entity]] '''getFigure'''( Location loc );
 +
 +
void '''forEachEntity'''();
 +
// call [[Hook Functions|entityCallback()]] once for each [[Entity_Functions|Entity]] in the game.
 +
 +
void '''enchantEntity'''( [[Entity_Functions|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'''();
 +
 +
void '''fogMap'''();
 +
// All spaces are returned to deep fog for all players
 +
 +
void '''lightFog'''(Player player,int x1 ,int y1,int x2,int y2);
 +
// sets the a range of spaces to light fog. A box from x1,y1 to x2,y2
 +
// wont have any effect if called in configGame or beforeStart
 +
 +
// Functions for persisting data from game to game for a particular user
 +
// Talk to Altren or Grug if you want to use these
 +
// this is not going to work until campaigns are manually registered by Altren or Grug
 +
int '''getCampID()''';
 +
void '''saveData'''(Player,int key,int value);
 +
int '''loadData'''(Player,int key);

Latest revision as of 03:21, 27 October 2013

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

int getMapWidth();
int getMapHeight();

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 ,TREES=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();

void fogMap();
// All spaces are returned to deep fog for all players

void lightFog(Player player,int x1 ,int y1,int x2,int y2);
// sets the a range of spaces to light fog. A box from x1,y1 to x2,y2 
// wont have any effect if called in configGame or beforeStart

// Functions for persisting data from game to game for a particular user
// Talk to Altren or Grug if you want to use these
// this is not going to work until campaigns are manually registered by Altren or Grug
int getCampID();
void saveData(Player,int key,int value);
int loadData(Player,int key);