No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
− | ''' |
+ | '''In newer Glests (3.2.0 beta and newer) lua scripting gives us a new possibilities.''' |
'''Scripted Scenarios!''' |
'''Scripted Scenarios!''' |
||
The game includes 2 tutorial scenarios and one scripted normal scenario(storming) now. |
The game includes 2 tutorial scenarios and one scripted normal scenario(storming) now. |
||
− | These demo scenarios show a bit |
+ | These demo scenarios show a bit what's possible now. Have a look at them if you want to learn it. |
− | == |
+ | == Useful Lua Links: == |
*[http://www.lua.org/pil/ Programming in Lua] |
*[http://www.lua.org/pil/ Programming in Lua] |
||
*[http://lua-users.org/wiki/TutorialDirectory lua tutorials] |
*[http://lua-users.org/wiki/TutorialDirectory lua tutorials] |
||
− | *[http://lua-users.org/wiki |
+ | *[http://lua-users.org/wiki Lua-Users.org Wiki] |
== The available functions == |
== The available functions == |
||
− | '''As there is no |
+ | '''As there is no list of the possible commands now, here a copy of some things from script_manager.h (from the glest sourcecode) which should contain/show all possible Glest lua-commands.''' |
− | === |
+ | === Message Box Functions === |
Line 31: | Line 31: | ||
− | === |
+ | === Events === |
Line 53: | Line 53: | ||
− | === |
+ | === Wrappers, Commands === |
Line 83: | Line 83: | ||
− | === |
+ | === Wrappers, Queries === |
Line 109: | Line 109: | ||
− | === |
+ | === Callbacks, Commands === |
Line 139: | Line 139: | ||
− | === |
+ | === Callbacks, Queries === |
Revision as of 01:28, 3 September 2008
In newer Glests (3.2.0 beta and newer) lua scripting gives us a new possibilities. Scripted Scenarios!
The game includes 2 tutorial scenarios and one scripted normal scenario(storming) now. These demo scenarios show a bit what's possible now. Have a look at them if you want to learn it.
Useful Lua Links:
The available functions
As there is no list of the possible commands now, here a copy of some things from script_manager.h (from the glest sourcecode) which should contain/show all possible Glest lua-commands.
Message Box Functions
bool getMessageBoxEnabled() const {return !messageQueue.empty();}
GraphicMessageBox* getMessageBox() {return &messageBox;}
string getDisplayText() const {return displayText;}
bool getGameOver() const {return gameOver;}
const PlayerModifiers *getPlayerModifiers(int factionIndex) const {return &playerModifiers[factionIndex];}
Events
void onMessageBoxOk();
void onResourceHarvested();
void onUnitCreated(const Unit* unit);
void onUnitDied(const Unit* unit);
private:
string wrapString(const string &str, int wrapCount);
Wrappers, Commands
void showMessage(const string &text, const string &header);
void clearDisplayText();
void setDisplayText(const string &text);
void setCameraPosition(const Vec2i &pos);
void createUnit(const string &unitName, int factionIndex, Vec2i pos);
void giveResource(const string &resourceName, int factionIndex, int amount);
void givePositionCommand(int unitId, const string &producedName, const Vec2i &pos);
void giveProductionCommand(int unitId, const string &producedName);
void giveUpgradeCommand(int unitId, const string &upgradeName);
void disableAi(int factionIndex);
void setPlayerAsWinner(int factionIndex);
void endGame();
Wrappers, Queries
Vec2i getStartLocation(int factionIndex);
Vec2i getUnitPosition(int unitId);
int getUnitFaction(int unitId);
int getResourceAmount(const string &resourceName, int factionIndex);
const string &getLastCreatedUnitName();
int getLastCreatedUnitId();
const string &getLastDeadUnitName();
int getLastDeadUnitId();
int getUnitCount(int factionIndex);
int getUnitCountOfType(int factionIndex, const string &typeName);
Callbacks, Commands
static int showMessage(LuaHandle* luaHandle);
static int setDisplayText(LuaHandle* luaHandle);
static int clearDisplayText(LuaHandle* luaHandle);
static int setCameraPosition(LuaHandle* luaHandle);
static int createUnit(LuaHandle* luaHandle);
static int giveResource(LuaHandle* luaHandle);
static int givePositionCommand(LuaHandle* luaHandle);
static int giveProductionCommand(LuaHandle* luaHandle);
static int giveUpgradeCommand(LuaHandle* luaHandle);
static int disableAi(LuaHandle* luaHandle);
static int setPlayerAsWinner(LuaHandle* luaHandle);
static int endGame(LuaHandle* luaHandle);
Callbacks, Queries
static int getStartLocation(LuaHandle* luaHandle);
static int getUnitPosition(LuaHandle* luaHandle);
static int getUnitFaction(LuaHandle* luaHandle);
static int getResourceAmount(LuaHandle* luaHandle);
static int getLastCreatedUnitName(LuaHandle* luaHandle);
static int getLastCreatedUnitId(LuaHandle* luaHandle);
static int getLastDeadUnitName(LuaHandle* luaHandle);
static int getLastDeadUnitId(LuaHandle* luaHandle);
static int getUnitCount(LuaHandle* luaHandle);
static int getUnitCountOfType(LuaHandle* luaHandle);