Removed META_LUA script writings, they are not used

This commit is contained in:
mr-russ 2004-05-19 00:57:01 +00:00
parent 18252ba9ad
commit fc638b882b
6 changed files with 0 additions and 721 deletions

View file

@ -1,37 +0,0 @@
#!/usr/bin/env python
"Update the script index in script-index.html."
import os, string
commands = []
reffiles = {}
sep = "<!-- SCRIPT -->"
for infile in os.listdir('.'):
if not infile.endswith('.html'): continue
if (infile == "script-index.html"): continue
x = open(infile).read()
if string.find(x, sep) == -1: continue
head, stuff, tail = x.split(sep)
loclist = []
for y in stuff.split("<a name=")[1:]:
loclist.append("<a name=" + y)
y = y.split('"')[1].split('"')[0]
commands.append(y)
reffiles[y] = infile
loclist.sort()
f = open(infile, 'w')
f.write(head + sep + stuff.split("<a name=")[0])
for y in loclist:
f.write(y)
f.write(sep + tail)
head, trash, tail = open('script-index.html').read().split(sep)
f = open('script-index.html', 'w')
f.write(head + sep)
for command in commands:
f.write('<dt><a href="' + reffiles[command] + '#' + command + '">' + command + '</a></dt>\n')
f.write(sep + tail)

View file

@ -1,195 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<!--
---- (c) Copyright 2004 by Crestez Leonard
---- This program is free software; you can redistribute it and/or modify
---- it under the terms of the GNU General Public License as published by
---- the Free Software Foundation; only version 2 of the License.
----
---- This program is distributed in the hope that it will be useful,
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
---- GNU General Public License for more details.
----
---- You should have received a copy of the GNU General Public License
---- along with this program; if not, write to the Free Software
---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
---- 02111-1307, USA.
-->
<title>Stratagus Scripting Language Description: Content</title>
<meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
<meta name="Author" content="cleonard@go.ro">
<meta name="Keyword" content="scripting">
<meta name="Description" content="Documentation for Stratagus.MissileTypes.*">
</head><body>
<h1>Stratagus Scripting Language: Stratagus.MissileTypes.*</h1>
<p><b>
(C) Copyright 1998-2004 by The Stratagus Project. Distributed under the
<a href="../gpl.html">"GNU General Public License"</a>
</b></p>
<hr>
<a href="../faq.html">FAQ</a>
<a href="script.html">Script main</a>
<a href="script-index.html">Script index</a>
<hr>
<a href="stratagus.html">Stratagus.*</a>
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
<a href="players.html">Stratagus.Players.*</a>
<hr>
<dl>
<!-- SCRIPT -->
<a name="Stratagus.MissileTypes">
<dt><b>Stratagus.MissileTypes</b></dt>
<dd><b>Type:</b> missile collection </dd>
<dd>This is the collection of missile types. every missile type has a name,
generally prefixed with "missile-". You have to use .Create to create a new
missile type.</dd>
<a name="Stratagus.MissileTypes[].CanHitOwner">
<dt><b>Stratagus.MissileTypes[].CanHitOwner</b></dt>
<dd><b>Type:</b> boolean </dd>
<dd>This is true if the missile can hit it's owner (unit that fired it most
of the time) or false otherwise. Do not confuse this with
<a href="missiletypes.html#Stratagus.MissileTypes[].FriendlyFire">FriendlyFire</a></dd>
<a name="Stratagus.MissileTypes[].Class">
<dt><b>Stratagus.MissileTypes[].Class</b></dt>
<dd><b>Type:</b> string, special values only </dd>
<dd>This is probably the most interesting part of the MissileType. It can receive a
number of string values, that influence the exact behaviour and trajectory of the
missile when it is fired. Here is a list of possible values.</dd>
<dl>
<dt><i>missile-class-none</i></dt>
<dd>Missile does nothing. Shouldn't really be used.</dd>
<dt><i>missile-class-point-to-point</i></dt>
<dd>Missile flies straight to destination animating on the way</dd>
<dt><i>missile-class-point-to-point-with-hit</i></dt>
<dd>Missile flies straight to destination keeping the first frame and
the finishes the animation when hitting</dd>
<dt><i>missile-class-point-to-point-cycle-once</i></dt>
<dd>Missile flies straight to destination and animates ONCE from first
to last and back again. To be used for catapult and the like to make a
projectile bigger mid-way to the target</dd>
<dt><i>missile-class-point-to-point-bounce</i></dt>
<dd>Missile flies straight to destination, and the "bounces" by hitting
every other tile on the path onward. This is requires to make
<a href="missiletypes.html#Stratagus.MissileTypes[].NumBounces">NumBounces</a> work.</dd>
<dt><i>missile-class-stay</i></dt>
<dd>Missile will just go through it's animation once and vanish. booooring.</dd>
<dt><i>missile-class-cycle-once </i></dt>
<dd>Missile will just go through it's animation from start to and and back
again, then vanish.</dd>
<dt><i>missile-class-fire</i></dt>
<dd>Missile is used for fire. More documentation?</dd>
<dt><i>missile-class-parabolic</i></dt>
<dd>Missile flies to destination with a parabolic path. It used the same
animation as cycle-once.</dd>
<dt><i>missile-class-land-mine</i></dt>
<dd>Missile is a landmine, it will sit quietly and wait for someone to step
on it. You can use time-to-live as a timeout.<b>FIXME more configurable</b></dd>
<dt><i>missile-class-whirlwind </i></dt>
<dd>Missile for the whirlwind effect <b>FIXME more configurable</b></dd>
<dt><i>missile-class-flame-shield </i></dt>
<dd>Missile rotates around target unit and damages everything it touches
<b>FIXME more configurable</b></dd>
<dt><i>missile-class-death-coil</i></dt>
<dd>Missile is death coil, will drain health from target or enemy units
in the area and feed it to the caster.<b>FIXME more configurable</b></dd>
</dl>
<a name="Stratagus.MissileTypes[].DrawLevel">
<dt><b>Stratagus.MissileTypes[].DrawLevel</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Drawing level. Missiles and units are sorted by this value. We need to
add details on the actual implementation of the sort.</dd>
<a name="Stratagus.MissileTypes[].File">
<dt><b>Stratagus.MissileTypes[].File</b></dt>
<dd><b>Type:</b> string (filename) </dd>
<dd>Filename with missile graphics. Relative to
<a href="stratagus.html#Stratagus.LibraryFilePath">Stratagus.LibaryFilePath</a></dd>
<a name="Stratagus.MissileTypes[].FiredSound">
<dt><b>Stratagus.MissileTypes[].FiredSound</b></dt>
<dd><b>Type:</b> string, sound-ident </dd>
<dd>Sound to be played when the missile is fired. Can also be nil, to disable it.</dd>
<a name="Stratagus.MissileTypes[].FriendlyFire">
<dt><b>Stratagus.MissileTypes[].FriendlyFire</b></dt>
<dd><b>Type:</b> boolean </dd>
<dd>This is false if the missile can hit units that are allied with the owner. This
includes units of the missile's owner. It also makes
<a href="missiletypes.html#Stratagus.MissileTypes[].CanHitOwner">CanHitOwner</a>
useless if it's false.</dd>
<a name="Stratagus.MissileTypes[].Height">
<dt><b>Stratagus.MissileTypes[].Height</b></dt>
<dd><b>Type:</b> int </dd>
<dd>This is the height of one frame in the graphic file.</dd>
<a name="Stratagus.MissileTypes[].Ident">
<dt><b>Stratagus.MissileTypes[].Ident</b></dt>
<dd><b>Type:</b> string </dd>
<dd>The missile type's name. By tradition you should use something like
"missile-small-arrow". Read-only.</dd>
<a name="Stratagus.MissileTypes[].ImpactMissile">
<dt><b>Stratagus.MissileTypes[].ImpactMissile</b></dt>
<dd><b>Type:</b> string, missile-ident </dd>
<dd>This string is the name of a missile to be spawned when the unit hits. It will
spawn multiple times for
<a href="missiletypes.html#Stratagus.MissileTypes[].NumBounces">NumBounces</a>.
Can also be nil, to disable it.
<a name="Stratagus.MissileTypes[].ImpactSound">
<dt><b>Stratagus.MissileTypes[].ImpactSound</b></dt>
<dd><b>Type:</b> string, sound-ident </dd>
<dd>Sound to be played the missile hits it's target. Can be nil to disable it.</dd>
<a name="Stratagus.MissileTypes[].NumBounces">
<dt><b>Stratagus.MissileTypes[].NumBounces</b></dt>
<dd><b>Type:</b> int </dd>
<dd>You can make missiles bounce, the obvious example is fireballs in warcraft 2.
After hitting it's destination point, the missile will "bounce" and keep going
hitting "NumBounces" times every tile and a half(haredcoded, sorry)</dd>
<a name="Stratagus.MissileTypes[].NumDirections">
<dt><b>Stratagus.MissileTypes[].NumDirections</b></dt>
<dd><b>Type:</b> int </dd>
<dd>The number of the directions for the missile. Inside the graphic file
sprites are arranged first by frame then by direction. Line x is for frame
x, column y for dirrection y. Directions are considered to be equally spaced.</dd>
<a name="Stratagus.MissileTypes[].Range">
<dt><b>Stratagus.MissileTypes[].Range</b></dt>
<dd><b>Type:</b> int </dd>
<dd>This is <b>NOT</b> the maximum range you can fire the missile at. It's the
range for splash damage. 0 affects a single unit, otherwise it's the number of
tiles around the hit that get affected.</dd>
<a name="Stratagus.MissileTypes[].Sleep">
<dt><b>Stratagus.MissileTypes[].Sleep</b></dt>
<dd><b>Type:</b> int </dd>
<dd>This are the number of game cycles to wait between two animation steps.
All animation steps are equally spaced.</dd>
<a name="Stratagus.MissileTypes[].SmokeMissile">
<dt><b>Stratagus.MissileTypes[].SmokeMissile</b></dt>
<dd><b>Type:</b> string, missile-ident </dd>
<dd>This string is the name of a missile to be spawned every "once in a while" as
smoke. Can also be nil, to disable it. NOT TESTED</dd>
<a name="Stratagus.MissileTypes[].Speed">
<dt><b>Stratagus.MissileTypes[].Speed</b></dt>
<dd><b>Type:</b> int </dd>
<dd>This is the number of pixels the missile moves for every animation frame.</dd>
<a name="Stratagus.MissileTypes[].SplashFactor">
<dt><b>Stratagus.MissileTypes[].SplashFactor</b></dt>
<dd><b>Type:</b> int </dd>
<dd>This is the factor for splash damage. The first tile gets full damage,
a tile x away from the center get damage / (x * SplashFactor)</dd>
<a name="Stratagus.MissileTypes[].SpriteFrames">
<dt><b>Stratagus.MissileTypes[].SpriteFrames</b></dt>
<dd><b>Type:</b> int </dd>
<dd>The number of the frames for this sprite. Missile animation is trivial,
It will go through the Sprite frames in order</dd>
<a name="Stratagus.MissileTypes[].Transparency">
<dt><b>Stratagus.MissileTypes[].Transparency</b></dt>
<dd><b>Type:</b> int (byte) </dd>
<dd>This is the transparency value for the missile. Value should be between
0(completely transparent) and 256(completely opaque). NOT TESTED</dd>
<a name="Stratagus.MissileTypes[].Width">
<dt><b>Stratagus.MissileTypes[].Width</b></dt>
<dd><b>Type:</b> int </dd>
<dd>This is the width of one frame in the graphic file.</dd>
<!-- SCRIPT -->
</dl><hr>
Last changed: $Id$<br>
All trademarks and copyrights on this page are owned by their respective owners.
<address>(c) 2002-2004 by <a href="http://stratagus.org">The Stratagus Project</a></address>
</body></html>

View file

@ -1,148 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<!--
---- (c) Copyright 2004 by Crestez Leonard
---- This program is free software; you can redistribute it and/or modify
---- it under the terms of the GNU General Public License as published by
---- the Free Software Foundation; only version 2 of the License.
----
---- This program is distributed in the hope that it will be useful,
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
---- GNU General Public License for more details.
----
---- You should have received a copy of the GNU General Public License
---- along with this program; if not, write to the Free Software
---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
---- 02111-1307, USA.
-->
<title>Stratagus Scripting Language Description: Content</title>
<meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
<meta name="Author" content="cleonard@go.ro">
<meta name="Keyword" content="scripting">
<meta name="Description" content="Documentation for Stratagus.Players.*">
</head><body>
<h1>Stratagus Scripting Language: Stratagus.Players.*</h1>
<p><b>
(C) Copyright 1998-2004 by The Stratagus Project. Distributed under the
<a href="../gpl.html">"GNU General Public License"</a>
</b></p>
<hr>
<a href="../faq.html">FAQ</a>
<a href="script.html">Script main</a>
<a href="script-index.html">Script index</a>
<hr>
<a href="stratagus.html">Stratagus.*</a>
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
<a href="players.html">Stratagus.Players.*</a>
<hr>
<dl>
<!-- SCRIPT -->
<a name="Stratagus.Players">
<dt><b>Stratagus.Players</b></dt>
<dd><b>Type:</b> array </dd>
<dd>This is the interface to Player information in the game. You can
only index it with an integer. There is a max of 16 players right now.</dd>
<a name="Stratagus.Players[].Allied">
<dt><b>Stratagus.Players[].Allied</b></dt>
<dd><b>Type:</b> bool array </dd>
<dd>This boolean array represents the allied status of the player.
Players[1].Allied[2] is true if player 1 is allied with player 2.
This is not reciprocal, if player 1 is allied with 2 it will only
stop his units attacking, player 2 doesn't have to do the same.</dd>
<a name="Stratagus.Players[].BuildingLimit">
<dt><b>Stratagus.Players[].BuildingLimit</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Maximum number of buildings the player is allowed to have.</dd>
<a name="Stratagus.Players[].Demand">
<dt><b>Stratagus.Players[].Demand</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Amount of food consumed by the player's units.</dd>
<a name="Stratagus.Players[].Enemy">
<dt><b>Stratagus.Players[].Enemy</b></dt>
<dd><b>Type:</b> bool array </dd>
<dd>This boolean array represents the enemy status of the player.
Players[1].Enemy[2] is true if player 1 is enemy with player 2.
This does not have to be reciprocal, see
<a href="players.html#Stratagus.Players[].Allied">Allied</a>.</dd>
<a name="Stratagus.Players[].Name">
<dt><b>Stratagus.Players[].Name</b></dt>
<dd><b>Type:</b> string </dd>
<dd>The name of the player, as selected by him.</dd>
<a name="Stratagus.Players[].NumBuildings">
<dt><b>Stratagus.Players[].NumBuildings</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Total number of buildings for the player</dd>
<a name="Stratagus.Players[].NumUnits">
<dt><b>Stratagus.Players[].NumUnits</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Total number of units for the player</dd>
<a name="Stratagus.Players[].Score">
<dt><b>Stratagus.Players[].Score</b></dt>
<dd><b>Type:</b> int </dd>
<dd>The player's score. <b>FIXME:</b> Document now how this is calculated.</dd>
<a name="Stratagus.Players[].SharedVision">
<dt><b>Stratagus.Players[].SharedVision</b></dt>
<dd><b>Type:</b> bool array </dd>
<dd>This boolean array represents the shared vision status of a
player. Players[1].SharedVision[2] is true if player 1 wants to
share vision with player 2. Share vision only takes effect if both
players agree on it and share vision with each other.</dd>
<a name="Stratagus.Players[].Slot">
<dt><b>Stratagus.Players[].Slot</b></dt>
<dd><b>Type:</b> int </dd>
<dd>This is perhaps confusing and rarely usefull. It's the index in the
player array. Stratagus.Players[x].Slot == x.</dd>
<a name="Stratagus.Players[].StartX">
<dt><b>Stratagus.Players[].StartX</b></dt>
<dd><b>Type:</b> int </dd>
<dd>X coordinate of the player's start location. This only specifies where
the screen is placed at the start of the game.</dd>
<a name="Stratagus.Players[].StartY">
<dt><b>Stratagus.Players[].StartY</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Y coordinate of the player's start location. This only specifies where
the screen is placed at the start of the game.</dd>
<a name="Stratagus.Players[].Supply">
<dt><b>Stratagus.Players[].Supply</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Total amount of food supplied for the player.</dd>
<a name="Stratagus.Players[].TotalBuildings">
<dt><b>Stratagus.Players[].TotalBuildings</b></dt>
<dd><b>Type:</b> int </dd>
<dd>The player's building score. This should be the total number of units
built by the player.</dd>
<a name="Stratagus.Players[].TotalKills">
<dt><b>Stratagus.Players[].TotalKills</b></dt>
<dd><b>Type:</b> int </dd>
<dd>How many units the player has killed.</dd>
<a name="Stratagus.Players[].TotalRazings">
<dt><b>Stratagus.Players[].TotalRazings</b></dt>
<dd><b>Type:</b> int </dd>
<dd>How many buildings the player has destroyed.</dd>
<a name="Stratagus.Players[].TotalUnitLimit">
<dt><b>Stratagus.Players[].TotalUnitLimit</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Maximum number of units and buildings (buildings can be considered units that
don't move)</dd>
<a name="Stratagus.Players[].TotalUnits">
<dt><b>Stratagus.Players[].TotalUnits</b></dt>
<dd><b>Type:</b> int </dd>
<dd>The player's unit score. This should be the total number of units
trained by the player.</dd>
<a name="Stratagus.Players[].UnitLimit">
<dt><b>Stratagus.Players[].UnitLimit</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Maximum number of units the player is allowed to have.</dd>
<a name="Stratagus.Players[].UnitTypesCount">
<dt><b>Stratagus.Players[].UnitTypesCount</b></dt>
<dd><b>Type:</b> int array </dd>
<dd>This is the number of units that the player has, organized by type.
You can index this by both unit number, or better yet by unit-ident</dd>
<!-- SCRIPT -->
</dl><hr>
Last changed: $Id$<br>
All trademarks and copyrights on this page are owned by their respective owners.
<address>(c) 2002-2004 by <a href="http://stratagus.org">The Stratagus Project</a></address>
</body></html>

View file

@ -1,96 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<!--
---- (c) Copyright 2004 by Crestez Leonard
---- This program is free software; you can redistribute it and/or modify
---- it under the terms of the GNU General Public License as published by
---- the Free Software Foundation; only version 2 of the License.
----
---- This program is distributed in the hope that it will be useful,
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
---- GNU General Public License for more details.
----
---- You should have received a copy of the GNU General Public License
---- along with this program; if not, write to the Free Software
---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
---- 02111-1307, USA.
-->
<title>Stratagus Scripting Language Description: Index</title>
<meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
<meta name="Author" content="clenard@go.ro">
<meta name="Keyword" content="script,index">
<meta name="Description" content="">
</head><body>
<h1>Stratagus Scripting Language Description: Index</h1>
<p><b>
(C) Copyright 2002-2003 by The Stratagus Project. Distributed under the
<a href="../gpl.html">"GNU General Public License"</a>
</b></p>
<hr>
<a href="../faq.html">FAQ</a>
<a href="script.html">Script main</a>
<a href="script-index.html">Script index</a>
<hr>
<a href="stratagus.html">Stratagus.*</a>
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
<a href="players.html">Stratagus.Players.*</a>
<hr>
<dl>
<!-- SCRIPT --><dt><a href="stratagus.html#Stratagus.GameCycle">Stratagus.GameCycle</a></dt>
<dt><a href="stratagus.html#Stratagus.GameName">Stratagus.GameName</a></dt>
<dt><a href="stratagus.html#Stratagus.GamePaused">Stratagus.GamePaused</a></dt>
<dt><a href="stratagus.html#Stratagus.LibraryFilePath">Stratagus.LibraryFilePath</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes">Stratagus.MissileTypes</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].CanHitOwner">Stratagus.MissileTypes[].CanHitOwner</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Class">Stratagus.MissileTypes[].Class</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].DrawLevel">Stratagus.MissileTypes[].DrawLevel</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].File">Stratagus.MissileTypes[].File</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].FiredSound">Stratagus.MissileTypes[].FiredSound</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].FriendlyFire">Stratagus.MissileTypes[].FriendlyFire</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Height">Stratagus.MissileTypes[].Height</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Ident">Stratagus.MissileTypes[].Ident</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].ImpactMissile">Stratagus.MissileTypes[].ImpactMissile</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].ImpactSound">Stratagus.MissileTypes[].ImpactSound</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].NumBounces">Stratagus.MissileTypes[].NumBounces</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].NumDirections">Stratagus.MissileTypes[].NumDirections</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Range">Stratagus.MissileTypes[].Range</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Sleep">Stratagus.MissileTypes[].Sleep</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].SmokeMissile">Stratagus.MissileTypes[].SmokeMissile</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Speed">Stratagus.MissileTypes[].Speed</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].SplashFactor">Stratagus.MissileTypes[].SplashFactor</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].SpriteFrames">Stratagus.MissileTypes[].SpriteFrames</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Transparency">Stratagus.MissileTypes[].Transparency</a></dt>
<dt><a href="missiletypes.html#Stratagus.MissileTypes[].Width">Stratagus.MissileTypes[].Width</a></dt>
<dt><a href="players.html#Stratagus.Players">Stratagus.Players</a></dt>
<dt><a href="players.html#Stratagus.Players[].Allied">Stratagus.Players[].Allied</a></dt>
<dt><a href="players.html#Stratagus.Players[].BuildingLimit">Stratagus.Players[].BuildingLimit</a></dt>
<dt><a href="players.html#Stratagus.Players[].Demand">Stratagus.Players[].Demand</a></dt>
<dt><a href="players.html#Stratagus.Players[].Enemy">Stratagus.Players[].Enemy</a></dt>
<dt><a href="players.html#Stratagus.Players[].Name">Stratagus.Players[].Name</a></dt>
<dt><a href="players.html#Stratagus.Players[].NumBuildings">Stratagus.Players[].NumBuildings</a></dt>
<dt><a href="players.html#Stratagus.Players[].NumUnits">Stratagus.Players[].NumUnits</a></dt>
<dt><a href="players.html#Stratagus.Players[].Score">Stratagus.Players[].Score</a></dt>
<dt><a href="players.html#Stratagus.Players[].SharedVision">Stratagus.Players[].SharedVision</a></dt>
<dt><a href="players.html#Stratagus.Players[].Slot">Stratagus.Players[].Slot</a></dt>
<dt><a href="players.html#Stratagus.Players[].StartX">Stratagus.Players[].StartX</a></dt>
<dt><a href="players.html#Stratagus.Players[].StartY">Stratagus.Players[].StartY</a></dt>
<dt><a href="players.html#Stratagus.Players[].Supply">Stratagus.Players[].Supply</a></dt>
<dt><a href="players.html#Stratagus.Players[].TotalBuildings">Stratagus.Players[].TotalBuildings</a></dt>
<dt><a href="players.html#Stratagus.Players[].TotalKills">Stratagus.Players[].TotalKills</a></dt>
<dt><a href="players.html#Stratagus.Players[].TotalRazings">Stratagus.Players[].TotalRazings</a></dt>
<dt><a href="players.html#Stratagus.Players[].TotalUnitLimit">Stratagus.Players[].TotalUnitLimit</a></dt>
<dt><a href="players.html#Stratagus.Players[].TotalUnits">Stratagus.Players[].TotalUnits</a></dt>
<dt><a href="players.html#Stratagus.Players[].UnitLimit">Stratagus.Players[].UnitLimit</a></dt>
<dt><a href="players.html#Stratagus.Players[].UnitTypesCount">Stratagus.Players[].UnitTypesCount</a></dt>
<!-- SCRIPT -->
</dl>
<hr>
Last changed: $Id$<br>
All trademarks and copyrights on this page are owned by their respective owners.
<address>(c) 2002-2004 by <a href="http://stratagus.org">The Stratagus Project</a></address>
</body></html>

View file

@ -1,167 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<!--
---- (c) Copyright 2004 by Crestez Leonard.
---- This program is free software; you can redistribute it and/or modify
---- it under the terms of the GNU General Public License as published by
---- the Free Software Foundation; only version 2 of the License.
----
---- This program is distributed in the hope that it will be useful,
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
---- GNU General Public License for more details.
----
---- You should have received a copy of the GNU General Public License
---- along with this program; if not, write to the Free Software
---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
---- 02111-1307, USA.
-->
<title>Stratagus Scripting Language Description: Content</title>
<meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
<meta name="Author" content="cleonard@go.ro">
<meta name="Keyword" content="scripting">
<meta name="Description" content="Scripting language main structure">
</head><body>
<h1>Stratagus Scripting Language Description: Content</h1>
<p><b>
(C) Copyright 1998-2004 by The Stratagus Project. Distributed under the
<a href="../gpl.html">"GNU General Public License"</a>
</b></p>
<hr>
<a href="../faq.html">FAQ</a>
<a href="script.html">Script main</a>
<a href="script-index.html">Script index</a>
<hr>
<a href="stratagus.html">Stratagus.*</a>
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
<a href="players.html">Stratagus.Players.*</a>
<hr>
<h2>Intro - Introduction to scripting in Stratagus</h2>
<p>Stratagus is a real-time strategy engine. To define
the different games a configuration language is needed.</p>
<p>The old scripting language was used mostly in a declarative way,
with functions for everything. I am changing that, in the branch
called META_LUA (you just change an ifdef in stratagus.h to get it).
Somebody should remove this text when META_LUA is complete.</p>
<p>In the mean-time you can look at the old outdated scripting
documentation <a href="../ccl/ccl.html">here</a>. Most of it is
still for scheme... yuk.</p>
<h3>Scripting interface design</h3>
<p>All the scripting interface will be in one big lua table, called
<b>Stratagus</b>. If you think that's too long something like Game could do.
Inside that table, most configurable structures in the game will be
accessbile. For instance Stratagus.UnitTypes[3] or Stratagus.UnitTypes["unit_goldmine"]
will get you a reference to a UnitType, and you can change values around from
lua code.</p>
<p>It is planned to have some sort of access level, depending on the origin
of the current script. Possible values could be: save game, config file,
map script(trigger), command line. This is because changing values at random
can easily crash the game.</p>
<h3>How to use scripting from lua</h3>
<p>If you are a game-designer this is probably all you need to read, the rest of
this file is for developers of the engine. You should first read documentation on
<a href="http://www.lua.org">Lua</a>, expecially the
<a href="http://www.lua.org/manual/5.0/">Lua Reference Manual</a>.</p>
<p>The main <b>Stratagus</b> table contains all the scripting interface,
inside it you will find all configurable information, in a tree-like structure.
Remember that in lua complex variables are passed by reference, so you can do
ut = Stratagus.UnitTypes["unit-goldmine"] and manipulate ut. It's even recommended,
for speed reasons.</p>
<p>Some "structures" in the game are actually collections. You can access them with
both an integer and a string index. Collection items are <b>named</b>. Traditionally
they are prefixed with the typename ("unit", "missile", "spell"), are all lower-case
and use a "-" as a separator in the names. This ensures they don't interfere with
methods and values in the same "structure". All collections provide a Create("name")
method, to create a new element and a "n" property, the count of elements. "n" is for
conformation to the lua convention for arrays.</p>
<p>The stratagus scripting interface makes use of "properties". Properties look like
normal fields (or however you call them) but remember that in C code it might translate
to a complex get or set function. I honestly find this a lot cleaner than calling a
lot of get/set functions like in most languages.</p>
<h3>How to use scripting from C</h3>
<p>The scripting interface is designed to be very clean and neat. This is why most
structures/functions are prefixed with "Script", and as many variables should be
local. To keep a reasonable level of similarity, lua functions should only be
wrappers around C functions, prefixed with "Script".</p>
<p>For every scriptable "module" you have write a separate file with the scripting
code for the module, generally called "script_module.c". Scripting is initialized with
a function called Script"Module"Init(). The "Stratagus" table is at -1 on the global
Lua stack. If there is any "collection" in the module it should be placed in the
global table. Try to keep the Init function the only global variable.</p>
<p>Lua provides a mechanism known as meta-tables, it can be explained in short as
run-time operator-overloading. It has a great degree of flexibility, since you can
even override the "[]" or "." operator. It is possible to get C functions called
from lua to override operators. However, lua functions are actually too flexible
and require lots of checking code. This is why Stratagus has a C mechanism build
on top of lua meta-tables, with proper error-checking and callback signatures.
Unless you hack on the scripting framework, only use ScriptProxyType. Read the next
sub-section for details on the actual scripting framework.</p>
<p>You need to have a ScriptProxyType for every structure <b>type</b>. You can create
an reference in lua to a C structure ad push it on the stack with
<i>ScriptCreateUserdata(lua_State *l, void* object, ScriptProxyType* type)</i>. You
can't free them from C, lua has a garbage collector. ScriptProxyType has a number of
function pointers, C functions that get called from lua when something happens to
the lua proxy for your object. The void* object won't get touched, and it comes as
a parameter to all those functions. Here is a list and a short explanation.</p>
<ul>
<li><i>ScriptProxyType::GetStr(void* object, const char* key, lua_State *l):</i><br>
Called when a script tries to access your object with a string, like
print(obj.Key) or print(obj["Key]). You have to push 1 item on the stack,
the result, or end up in an error.
</li>
<li><i>ScriptProxyType::GetInt(void* object, int index, lua_State *l):</i><br>
Called when a script tries to access your object with an int, like
print(obj[5]). You have to push 1 item on the stack, the result, or end up
in an error.
</li>
<li><i>ScriptProxyType::SetStr(void* object, const char* key, lua_State *l):</i><br>
Called when a script tries to write to a field of your object with a string
key, like obj.Key = "Hello" or obj["Key] = 7 + 4). You have to pop an
item from the stack and assign it to the field, or end up in an error
</li>
<li><i>ScriptProxyType::SetInt(void* object, int index, lua_State *l):</i><br>
Called when a script tries to write to a field of your object with an
index, like obj[3] = "Hello". You have to pop an item from the stack
and assign it to your index, or end up in an error.
</li>
<li><i>ScriptProxyType::Collect(void* object):</i><br>
This is a special callback. It gets called when the garbage collector
decides to get rid of the object. You can have whatever free code you
wish in there. Remember, the object pointer is never touched by Lua or
the scripting system. You probably don't need this if the lua object
you made is a mere "wrapper" around an existing C struct, and not a
special object created for Lua.
</li>
</ul>
<p>There are a whole bunch of macros and functions designed to make your life
easier when scripting. You should look for them in src/include/script.h, I'm
lazy right now.</p>
<h3>Scripting system internals</h3>
<p>The main <b>Stratagus</b> table will be accessible at all times.
However, having a lua table for each and every struct we use would be
a huge resource waste. This is why we make a table only when we want to get it
the actual struct. It works by returning userdate, not a table. Userdata is
a special type in lua, and it's mostly opaque to lua, it's good to store random
C values.</p>
<p>Despite what you might think at first, ScriptCreateUserdata doesn't always
create. For every object pointer-type it makes an entry into a special weak
table in the registry. The registry is a place in lua where you can keep values
unreachable from actual scripts. That the table is weak means that it does <b>
not</b> stop the collection of it's values. We have a global garbage collector
C function that removes the entry from the weak table and then calls the object
GC. There is only one meta-table across the whole system, that converts calls
to the nicer callbacks of ScriptProxyType.</p>
<b>FIXME: this is not complete, but it should give you an idea.</b>
<hr>
Last changed: $Id$<br>
All trademarks and copyrights on this page are owned by their respective owners.
<address>(c) 2004 by <a href="http://stratagus.org">The Stratagus Project</a></address>
</body></html>

View file

@ -1,78 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<!--
---- (c) Copyright 2004 by Crestez Leonard
---- This program is free software; you can redistribute it and/or modify
---- it under the terms of the GNU General Public License as published by
---- the Free Software Foundation; only version 2 of the License.
----
---- This program is distributed in the hope that it will be useful,
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
---- GNU General Public License for more details.
----
---- You should have received a copy of the GNU General Public License
---- along with this program; if not, write to the Free Software
---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
---- 02111-1307, USA.
-->
<title>Stratagus Scripting Language Description: Content</title>
<meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
<meta name="Author" content="cleonard@go.ro">
<meta name="Keyword" content="scripting">
<meta name="Description" content="Documentation for Stratagus.*">
</head><body>
<h1>Stratagus Scripting Language: Stratagus.*</h1>
<p><b>
(C) Copyright 1998-2004 by The Stratagus Project. Distributed under the
<a href="../gpl.html">"GNU General Public License"</a>
</b></p>
<hr>
<a href="../faq.html">FAQ</a>
<a href="script.html">Script main</a>
<a href="script-index.html">Script index</a>
<hr>
<a href="stratagus.html">Stratagus.*</a>
<a href="missiletypes.html">Stratagus.MissileTypes.*</a>
<a href="players.html">Stratagus.Players.*</a>
<hr>
<dl>
<!-- SCRIPT -->
<a name="Stratagus.GameCycle">
<dt><b>Stratagus.GameCycle</b></dt>
<dd><b>Type:</b> int </dd>
<dd>Game cycle. How many ticks from the start of the game.</dd>
<a name="Stratagus.GameName">
<dt><b>Stratagus.GameName</b></dt>
<dd><b>Type:</b> string </dd>
<dd>The name of the game. Specified ONCE in the config file, it should be
unique. It will be the name of the pref dir, and used to as a check
in multiplayer. Keep it short and lowercase.</dd>
<a name="Stratagus.GamePaused">
<dt><b>Stratagus.GamePaused</b></dt>
<dd><b>Type:</b> boolean </dd>
<dd>True if the game is paused, false otherwise.</dd>
<a name="Stratagus.LibraryFilePath">
<dt><b>Stratagus.LibraryFilePath</b></dt>
<dd><b>Type:</b> string </dd>
<dd>This is the path for the stratagus data dir, the one you specify
with -d on the command line.</dd>
<a name="Stratagus.SyncRand()">
<dt><b>Stratagus.SyncRand()</b></dt>
<dd><b>Type:</b> function, returns int </dd>
<dd>This calls the internal stratagus syncronized random number generator.
It will get the same values across multiplayer games. Make sure you
don't call it from unsincronized parts of the game.</dd>
<a name="Stratagus.MyRand()">
<dt><b>Stratagus.MyRand()</b></dt>
<dd><b>Type:</b> function, returns int </dd>
<dd>This calls a random number generator. Do not use this in map
scripts or anything else that has to behave the same across multiplayer
games.</dd>
<!-- SCRIPT -->
</dl><hr>
Last changed: $Id$<br>
All trademarks and copyrights on this page are owned by their respective owners.
<address>(c) 2002-2004 by <a href="http://stratagus.org">The Stratagus Project</a></address>
</body></html>