Second stage of automatic documentation extraction for utility macros.
This commit is contained in:
parent
ccc1c8661e
commit
506b7c92eb
13 changed files with 317 additions and 230 deletions
|
@ -34,4 +34,5 @@ utils-macros:
|
|||
definitions:
|
||||
@./macroscope --definitions --exclude data/scenarios --exclude data/campaigns $(EXCLUDE) $(TOPDIR)
|
||||
|
||||
|
||||
help:
|
||||
@./macroscope --extracthelp --exclude data/scenarios --exclude data/campaigns $(EXCLUDE) $(TOPDIR)
|
||||
|
|
|
@ -61,10 +61,11 @@ def iswml(filename):
|
|||
|
||||
class reference:
|
||||
"Describes a location by file and line."
|
||||
def __init__(self, filename, line=None):
|
||||
def __init__(self, filename, line=None, docstring=None):
|
||||
self.filename = filename
|
||||
self.line = line
|
||||
self.references = {}
|
||||
self.docstring = docstring
|
||||
def append(self, fn, n):
|
||||
if fn not in self.references:
|
||||
self.references[fn] = []
|
||||
|
@ -136,15 +137,22 @@ class CrossRef:
|
|||
elif iswml(filename):
|
||||
# It's a WML file, scan for macro defitions
|
||||
dfp = open(filename)
|
||||
here = None
|
||||
for (n, line) in enumerate(dfp):
|
||||
if line.startswith("#define"):
|
||||
tokens = line.split()
|
||||
name = tokens[1]
|
||||
here = reference(filename, n+1)
|
||||
here = reference(filename, n+1, line)
|
||||
if name in self.xref:
|
||||
print >>sys.stderr, "*** Warning: duplicate definition of %s from %s, at %s" \
|
||||
% (name, self.xref[name], here)
|
||||
self.xref[name] = here
|
||||
here.docstring = line[8:] # Strip off #define_
|
||||
elif here:
|
||||
if line[0] == "#":
|
||||
here.docstring += line[1:]
|
||||
else:
|
||||
here = None
|
||||
dfp.close()
|
||||
elif filename.endswith(".def"):
|
||||
# It's a list of names to be considered defined
|
||||
|
@ -238,6 +246,60 @@ class CrossRef:
|
|||
nrefs = len(defloc.references)
|
||||
if nrefs:
|
||||
print name
|
||||
def extracthelp(self, fp):
|
||||
"Deliver all macro help comments in HTML form."
|
||||
doclist = self.xref.keys()
|
||||
def defcmp(s, t):
|
||||
"Compare two documentation objects for place in the sort order."
|
||||
# Major sort by file, minor by name. This presumes that the
|
||||
# files correspond to coherent topics.
|
||||
byfile = cmp(self.xref[s].filename, self.xref[t].filename)
|
||||
if byfile:
|
||||
return byfile
|
||||
else:
|
||||
return cmp(s, t)
|
||||
doclist.sort(defcmp)
|
||||
outstr = ""
|
||||
for name in doclist:
|
||||
if self.xref[name].docstring:
|
||||
lines = self.xref[name].docstring.split("\n")
|
||||
header = lines.pop(0).split()
|
||||
if lines and not lines[-1]: # Ignore trailing blank lines
|
||||
lines.pop()
|
||||
if not lines: # Ignore definitions without a docstring
|
||||
continue
|
||||
outstr += "\n<dt>\n"
|
||||
outstr += "<emphasis role='bold'>" + header[0] + "</emphasis>"
|
||||
if header[1:]:
|
||||
outstr += "<emphasis>"+" ".join(header[1:])+"</emphasis>"
|
||||
outstr += "\n</dt>\n"
|
||||
outstr += "<dd>\n<p>"
|
||||
inlisting = False
|
||||
for line in lines:
|
||||
line = line.rstrip()
|
||||
if not inlisting and not line:
|
||||
outstr += "</p><p>"
|
||||
continue
|
||||
if not inlisting and line[0] == '!':
|
||||
outstr += "</p>\n<listing>\n"
|
||||
inlisting = True
|
||||
bracketdepth = curlydepth = 0
|
||||
if inlisting:
|
||||
outstr += line[1:] + "\n"
|
||||
else:
|
||||
outstr += line + "\n"
|
||||
if inlisting:
|
||||
if line and line[0] != '!':
|
||||
outstr += "</listing>\n<p>"
|
||||
inlisting = False
|
||||
if not inlisting:
|
||||
outstr += "</p>\n"
|
||||
else:
|
||||
outstr += "</listing>\n"
|
||||
outstr += "</dd>\n"
|
||||
outstr = outstr.replace("<p></p>", "")
|
||||
outstr = outstr.replace("\n\n</listing>", "\n</listing>")
|
||||
fp.write(outstr)
|
||||
|
||||
if __name__ == "__main__":
|
||||
def help():
|
||||
|
@ -253,6 +315,7 @@ Usage: macroscope [options] dirpath
|
|||
-r ddd, --refcount=ddd Report only on macros w/references in ddd files
|
||||
-u, --unresolved Report unresolved macro references
|
||||
--forced-used reg Ignore refcount 0 on names matching regexp
|
||||
--extracthelp Extract help from macro definition comments.
|
||||
The required dirpath argument may be a colon-separated directory list.
|
||||
""")
|
||||
|
||||
|
@ -262,6 +325,7 @@ Usage: macroscope [options] dirpath
|
|||
'crossreference',
|
||||
'definitions',
|
||||
'exclude=',
|
||||
'extracthelp',
|
||||
'force-used=',
|
||||
'from=',
|
||||
'help',
|
||||
|
@ -269,7 +333,7 @@ Usage: macroscope [options] dirpath
|
|||
'refcount=',
|
||||
'unresolved',
|
||||
])
|
||||
crossreference = definitions = listfiles = unresolved = False
|
||||
crossreference = definitions = listfiles = unresolved = extracthelp = False
|
||||
from_restrict = None
|
||||
refcount_restrict = None
|
||||
forceused = None
|
||||
|
@ -286,6 +350,8 @@ Usage: macroscope [options] dirpath
|
|||
definitions = True
|
||||
elif switch in ('-e', '--exclude'):
|
||||
exclude.append(val)
|
||||
elif switch == '--extracthelp':
|
||||
extracthelp = True
|
||||
elif switch == '--force-used':
|
||||
forceused = val
|
||||
elif switch in ('-l', '--listfiles'):
|
||||
|
@ -302,7 +368,7 @@ Usage: macroscope [options] dirpath
|
|||
print "# Macroscope reporting on %s" % time.ctime()
|
||||
print "# Invocation: %s" % " ".join(sys.argv)
|
||||
print "# Working directory: %s" % os.getcwd()
|
||||
if crossreference or definitions or listfiles or unresolved:
|
||||
if crossreference or definitions or listfiles or unresolved or extracthelp:
|
||||
filelist = allfiles(dirpath, "|".join(exclude))
|
||||
if listfiles:
|
||||
for filename in filelist:
|
||||
|
@ -325,4 +391,7 @@ Usage: macroscope [options] dirpath
|
|||
xref.deflist(predicate)
|
||||
if unresolved:
|
||||
xref.unresdump()
|
||||
if extracthelp:
|
||||
xref.extracthelp(sys.stdout)
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Macros for setting animations.
|
||||
|
||||
# These don't rely on any other macros. Please don't change this.
|
||||
|
||||
#define DEFENSE_ANIM REACTION BASEFRAME HITSOUND
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
# Conditionals for MP scenarios.
|
||||
# These don't depend on any other macros.
|
||||
|
||||
# These don't depend on any other macros. Please don't change this.
|
||||
# ! in comments is used in generating HTML documentation, ignore it otherwise.
|
||||
|
||||
#define IF_ALIVE PLAYER ACTION
|
||||
# Condition triggering of ACTION om whether PLAYER has at least one unit left.
|
||||
# For example, if the player 2 is still alive, kill all his units.
|
||||
# {IF_ALIVE 2 (
|
||||
# [kill]
|
||||
# side=2
|
||||
# [/kill]
|
||||
# )}
|
||||
#! {IF_ALIVE 2 (
|
||||
#! [kill]
|
||||
#! side=2
|
||||
#! [/kill]
|
||||
#! )}
|
||||
[if]
|
||||
[have_unit]
|
||||
side={PLAYER}
|
||||
|
@ -24,12 +25,12 @@
|
|||
#define IF_DEAD PLAYER ACTION
|
||||
# Condition triggering of ACTION on whether PLAYER has no units left.
|
||||
# For example, give player 2 gold if player 1 is dead
|
||||
# {IF_DEAD 1 (
|
||||
# [gold]
|
||||
# side=2
|
||||
# amount=25
|
||||
# [/gold]
|
||||
# )}
|
||||
#! {IF_DEAD 1 (
|
||||
#! [gold]
|
||||
#! side=2
|
||||
#! amount=25
|
||||
#! [/gold]
|
||||
#! )}
|
||||
[if]
|
||||
[have_unit]
|
||||
side={PLAYER}
|
||||
|
@ -47,16 +48,16 @@
|
|||
# NOTE: only works if leaders are alive, are the same leader as the game
|
||||
# started and haven't changed teams.
|
||||
# For example, if player 3 and 4 is allied, steal 10 gold from each:
|
||||
# {IF_ALLIED 3 4 (
|
||||
# [gold]
|
||||
# side=3
|
||||
# amount=-10
|
||||
# [/gold]
|
||||
# [gold]
|
||||
# side=4
|
||||
# amount=-10
|
||||
# [/gold]
|
||||
# )}
|
||||
#! {IF_ALLIED 3 4 (
|
||||
#! [gold]
|
||||
#! side=3
|
||||
#! amount=-10
|
||||
#! [/gold]
|
||||
#! [gold]
|
||||
#! side=4
|
||||
#! amount=-10
|
||||
#! [/gold]
|
||||
#! )}
|
||||
[store_unit]
|
||||
[filter]
|
||||
side={PLAYER1}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# These are clutter, scheduled to be removed.
|
||||
|
||||
# ! in comments is used for generating HTML documentation, ignore it otherwise.
|
||||
|
||||
#define DEPRECATE_132 NAME
|
||||
# Tag macros for removal, the number in the name is the
|
||||
# release where the message is shown the first time.
|
||||
|
@ -13,7 +15,7 @@
|
|||
#define ADD_GOLD SIDE AMOUNT
|
||||
# Gives a side an amount of gold
|
||||
# For example, to make player 1 rich:
|
||||
# {ADD_GOLD 1 999}
|
||||
#! {ADD_GOLD 1 999}
|
||||
{DEPRECATE_132 ADD_GOLD}
|
||||
[gold]
|
||||
side={SIDE}
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
# It is recommended that you only use these if you're confident you could write
|
||||
# the expanded form as well; these are mostly intended as shortcuts for
|
||||
# experienced WML authors.
|
||||
#
|
||||
|
||||
# These don't depend on any other macros. Please don't change this.
|
||||
# ! in comments is used in generating HTML documentation, ignore it otherwise.
|
||||
|
||||
|
||||
#define ON_EVENT NAME ACTION
|
||||
|
@ -23,12 +24,12 @@
|
|||
# For example, you can make side 2 start the scenario with ownership of the
|
||||
# village at 13,15:
|
||||
#
|
||||
# {ON_PRESTART (
|
||||
# [capture_village]
|
||||
# side=2
|
||||
# x,y=13,15
|
||||
# [/capture_village]
|
||||
# )}
|
||||
#! {ON_PRESTART (
|
||||
#! [capture_village]
|
||||
#! side=2
|
||||
#! x,y=13,15
|
||||
#! [/capture_village]
|
||||
#! )}
|
||||
[event]
|
||||
name=prestart
|
||||
{ACTION}
|
||||
|
@ -43,17 +44,17 @@
|
|||
#
|
||||
# For example you could display some dialogue when the scenario starts:
|
||||
#
|
||||
# {ON_START (
|
||||
# [message]
|
||||
# speaker=Konrad
|
||||
# message= _ "Hey, I can see some enemies up ahead!"
|
||||
# [/message]
|
||||
#
|
||||
# [message]
|
||||
# speaker=Delfador
|
||||
# message= _ "Yes, so it would seem. Charge!"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_START (
|
||||
#! [message]
|
||||
#! speaker=Konrad
|
||||
#! message= _ "Hey, I can see some enemies up ahead!"
|
||||
#! [/message]
|
||||
#!
|
||||
#! [message]
|
||||
#! speaker=Delfador
|
||||
#! message= _ "Yes, so it would seem. Charge!"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=start
|
||||
{ACTION}
|
||||
|
@ -64,11 +65,11 @@
|
|||
# Creates an event that triggers at the end of every turn.
|
||||
#
|
||||
# For example, you could give a player some gold at the end every turn:
|
||||
# [gold]
|
||||
# amount=35
|
||||
# side=1
|
||||
# [/gold]
|
||||
# )}
|
||||
#! [gold]
|
||||
#! amount=35
|
||||
#! side=1
|
||||
#! [/gold]
|
||||
#! )}
|
||||
|
||||
#define ON_NEXT_TURN ACTION
|
||||
[event]
|
||||
|
@ -81,12 +82,12 @@
|
|||
#define ON_NEXT_TURN_ONCE ACTION
|
||||
# Creates an event that triggers at the end of the current turn.
|
||||
# For example you could give a player some gold before his/hers next turn.:
|
||||
# {ON_NEXT_TURN (
|
||||
# [gold]
|
||||
# amount=100
|
||||
# side=1
|
||||
# [/gold]
|
||||
# )}
|
||||
#! {ON_NEXT_TURN (
|
||||
#! [gold]
|
||||
#! amount=100
|
||||
#! side=1
|
||||
#! [/gold]
|
||||
#! )}
|
||||
[event]
|
||||
name=new turn
|
||||
first_time_only=yes
|
||||
|
@ -97,12 +98,12 @@
|
|||
#define ON_SIDETURN ACTION
|
||||
# Creates an event that triggers at the start of every players turn
|
||||
# For example, you could set each players gold to a fixed amount every turn.
|
||||
# {ON_SIDETURN (
|
||||
# [modify_side]
|
||||
# side=3
|
||||
# gold=0
|
||||
# [/modify_side]
|
||||
# )}
|
||||
#! {ON_SIDETURN (
|
||||
#! [modify_side]
|
||||
#! side=3
|
||||
#! gold=0
|
||||
#! [/modify_side]
|
||||
#! )}
|
||||
[event]
|
||||
name=side turn
|
||||
first_time_only=no
|
||||
|
@ -115,13 +116,13 @@
|
|||
# Creates an event that triggers at the start of turn TURN
|
||||
# For example you can create a Wose belonging to player 1 at turn 3:
|
||||
# Strictly a syntactic shortcut.
|
||||
# {ON_TURN 3 (
|
||||
# [unit]
|
||||
# side=1
|
||||
# type=wose
|
||||
# x,y=12,4
|
||||
# [/unit]
|
||||
# )}
|
||||
#! {ON_TURN 3 (
|
||||
#! [unit]
|
||||
#! side=1
|
||||
#! type=wose
|
||||
#! x,y=12,4
|
||||
#! [/unit]
|
||||
#! )}
|
||||
[event]
|
||||
name=turn {TURN}
|
||||
{ACTION}
|
||||
|
@ -133,12 +134,12 @@
|
|||
# Strictly a syntactic shortcut.
|
||||
#
|
||||
# For example you could display a message saying they suck:
|
||||
# {ON_LAST_TURN (
|
||||
# [message]
|
||||
# speaker=narrator
|
||||
# message="They suck!"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_LAST_TURN (
|
||||
#! [message]
|
||||
#! speaker=narrator
|
||||
#! message="They suck!"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=time over
|
||||
{ACTION}
|
||||
|
@ -150,12 +151,12 @@
|
|||
# the game ends. Strictly a syntactic shortcut.
|
||||
#
|
||||
# For example you could congratulate the player:
|
||||
# {ON_VICTORY (
|
||||
# [message]
|
||||
# speaker=narrator
|
||||
# message="Congratulations!"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_VICTORY (
|
||||
#! [message]
|
||||
#! speaker=narrator
|
||||
#! message="Congratulations!"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=victory
|
||||
{ACTION}
|
||||
|
@ -168,12 +169,12 @@
|
|||
#
|
||||
# For example you could suggest an easier difficulty
|
||||
# the player:
|
||||
# {ON_DEFEAT (
|
||||
# [message]
|
||||
# speaker=narrator
|
||||
# message="Aww.. you lost. Try again with 800g and +40g income?"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_DEFEAT (
|
||||
#! [message]
|
||||
#! speaker=narrator
|
||||
#! message="Aww.. you lost. Try again with 800g and +40g income?"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=defeat
|
||||
{ACTION}
|
||||
|
@ -186,16 +187,16 @@
|
|||
# given player.
|
||||
#
|
||||
# For example, we could make a tree where the first player's leader can
|
||||
# read a note, but noone else:
|
||||
# {ON_TILE 5 7 (
|
||||
# side=1
|
||||
# canrecruit=1
|
||||
# ) (
|
||||
# [message]
|
||||
# speaker=narrator
|
||||
# message="This is a note."
|
||||
# [/message]
|
||||
# )}
|
||||
# read a note, but nobody else:
|
||||
#! {ON_TILE 5 7 (
|
||||
#! side=1
|
||||
#! canrecruit=1
|
||||
#! ) (
|
||||
#! [message]
|
||||
#! speaker=narrator
|
||||
#! message="This is a note."
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=moveto
|
||||
first_time_only=no
|
||||
|
@ -213,13 +214,13 @@
|
|||
# Strictly a syntactic shortcut.
|
||||
#
|
||||
# For example, let's allow undoing reading a note:
|
||||
# {ON_TILE 5 7 () (
|
||||
# [message]
|
||||
# speaker=narrator
|
||||
# message="This is a note."
|
||||
# [/message]
|
||||
# {ALLOW_UNDO}
|
||||
# )}
|
||||
#! {ON_TILE 5 7 () (
|
||||
#! [message]
|
||||
#! speaker=narrator
|
||||
#! message="This is a note."
|
||||
#! [/message]
|
||||
#! {ALLOW_UNDO}
|
||||
#! )}
|
||||
[allow_undo]
|
||||
[/allow_undo]
|
||||
#enddef
|
||||
|
@ -231,12 +232,12 @@
|
|||
|
||||
For example we could make a text-message
|
||||
# that is only readable once:
|
||||
# {ON_TILE_ONCE 5 7 () (
|
||||
# [message]
|
||||
# speaker=narrator
|
||||
# message="This is a note."
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_TILE_ONCE 5 7 () (
|
||||
#! [message]
|
||||
#! speaker=narrator
|
||||
#! message="This is a note."
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=moveto
|
||||
first_time_only=yes
|
||||
|
@ -254,12 +255,12 @@ For example we could make a text-message
|
|||
# Strictly a syntactic shortcut.
|
||||
#
|
||||
# For example we can make all units scream in pain upon death:
|
||||
# {ON_DEATH () (
|
||||
# [message]
|
||||
# speaker=unit
|
||||
# message="AAaaaaAAaaAAaarrrghh!!!"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_DEATH () (
|
||||
#! [message]
|
||||
#! speaker=unit
|
||||
#! message="AAaaaaAAaaAAaarrrghh!!!"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=die
|
||||
first_time_only=no
|
||||
|
@ -276,15 +277,15 @@ For example we could make a text-message
|
|||
#
|
||||
# For example we can make only player 3s leader units scream in
|
||||
# pain upon death:
|
||||
# {ON_DEATH_ONCE (
|
||||
# side=3
|
||||
# canrecruit=1
|
||||
# ) (
|
||||
# [message]
|
||||
# speaker=unit
|
||||
# message="AAaaaaAAaaAAaarrrghh!!!"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_DEATH_ONCE (
|
||||
#! side=3
|
||||
#! canrecruit=1
|
||||
#! ) (
|
||||
#! [message]
|
||||
#! speaker=unit
|
||||
#! message="AAaaaaAAaaAAaarrrghh!!!"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=die
|
||||
first_time_only=yes
|
||||
|
@ -300,12 +301,12 @@ For example we could make a text-message
|
|||
# advances to a new class. Strictly a syntactic shortcut.
|
||||
#
|
||||
# For example we could make it smile:
|
||||
# {ON_ADVANCEMENT () (
|
||||
# [message]
|
||||
# speaker=unit
|
||||
# message=":D"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_ADVANCEMENT () (
|
||||
#! [message]
|
||||
#! speaker=unit
|
||||
#! message=":D"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=advance
|
||||
first_time_only=no
|
||||
|
@ -322,12 +323,12 @@ For example we could make a text-message
|
|||
#
|
||||
# For example we could make it claim to be
|
||||
# the strongest one alive:
|
||||
# {ON_POSTADVANCEMENT () (
|
||||
# [message]
|
||||
# speaker=unit
|
||||
# message="I'm the strongest one alive!"
|
||||
# [/message]
|
||||
# )}
|
||||
#! {ON_POSTADVANCEMENT () (
|
||||
#! [message]
|
||||
#! speaker=unit
|
||||
#! message="I'm the strongest one alive!"
|
||||
#! [/message]
|
||||
#! )}
|
||||
[event]
|
||||
name=post_advance
|
||||
first_time_only=no
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Utility macros for images, overlays, and display effects.
|
||||
|
||||
# These don't depend on any other macros. Please don't change this.
|
||||
|
||||
#define MAGENTA_IS_THE_TEAM_COLOR
|
||||
|
@ -45,6 +46,7 @@ delay=500
|
|||
#enddef
|
||||
|
||||
#define PLACE_IMAGE IMAGE_FILE X Y
|
||||
# Place an image at a specified location on the map.
|
||||
[item]
|
||||
x={X}
|
||||
y={Y}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# Interface shortcut macros.
|
||||
# These don't depend on any other macros. Please don't change this.
|
||||
|
||||
# These don't depend on any other macros. Please don't change this.
|
||||
# ! in comments is used to generate HTML documentation; ignore it otherwise.
|
||||
|
||||
#define MESSAGE SPEAKER IMAGE CAPTION TEXT
|
||||
# Displays a text message spoken by SPEAKER.
|
||||
# Speaker can be any of: narrator, unit and second_unit
|
||||
# For example, let's have the narrator, which looks like a faery
|
||||
# express some feelings on the undead:
|
||||
# {MESSAGE narrator "units/elves-wood/shyde.png" _ "Faery" _ "Aarr! Them be undeadies! Loooks at them.."}
|
||||
#! {MESSAGE narrator "units/elves-wood/shyde.png" _ "Faery" _ "Aarr! Them be undeadies! Loooks at them.."}
|
||||
[message]
|
||||
speaker={SPEAKER}
|
||||
message={TEXT}
|
||||
|
@ -21,7 +22,7 @@
|
|||
# Puts TEXT on the map at X,Y. Strictly a syntactic shortcut.
|
||||
#
|
||||
# For example:
|
||||
# {SET_LABEL 4 7 _ "There be dragons here!"}
|
||||
#! {SET_LABEL 4 7 _ "There be dragons here!"}
|
||||
[label]
|
||||
x={X}
|
||||
y={Y}
|
||||
|
@ -33,7 +34,7 @@
|
|||
# Removes a label from a given tile.
|
||||
#
|
||||
# For example, remove it from 4,7
|
||||
# {REMOVE_LABEL 4 7}
|
||||
#! {REMOVE_LABEL 4 7}
|
||||
[label]
|
||||
x={X}
|
||||
y={Y}
|
||||
|
@ -46,7 +47,7 @@
|
|||
# someone clears it.
|
||||
#
|
||||
# Example:
|
||||
# {SET_LABEL_PERSISTANT 4 7 _ "There really will be dragons here!!"}
|
||||
#! {SET_LABEL_PERSISTANT 4 7 _ "There really will be dragons here!!"}
|
||||
{SET_LABEL {X} {Y} ({TEXT}) }
|
||||
{ON_SIDETURN (
|
||||
{SET_LABEL {X} {Y} ({TEXT}) }
|
||||
|
@ -57,7 +58,7 @@
|
|||
# Places an image at a given tile, shrinking it to fit the tile
|
||||
#
|
||||
# For example, let's put a tent on tile 14,5
|
||||
# {SET_IMAGE 14 5 "terrain/tent.png"}
|
||||
#! {SET_IMAGE 14 5 "terrain/tent.png"}
|
||||
[item]
|
||||
x,y={X},{Y}
|
||||
image={IMAGE}
|
||||
|
@ -68,7 +69,7 @@
|
|||
# Removes a previously set image from a tile.
|
||||
#
|
||||
# Example:
|
||||
# {REMOVE_IMAGE 14 5}
|
||||
#! {REMOVE_IMAGE 14 5}
|
||||
[removeitem]
|
||||
x,y={X},{Y}
|
||||
[/removeitem]
|
||||
|
@ -97,7 +98,7 @@
|
|||
# Scrolls the screen to the given coordinates.
|
||||
#
|
||||
# For example, let's focus on 26,35:
|
||||
# {SCROLL 26 35}
|
||||
#! {SCROLL 26 35}
|
||||
[scroll]
|
||||
x={X}
|
||||
y={Y}
|
||||
|
@ -134,12 +135,12 @@
|
|||
#define EARTHQUAKE ACTION
|
||||
# Creates an earthquake-effect while performing ACTION
|
||||
# For example we could kill all non-leader units in the earthquake:
|
||||
# {EARTHQUAKE (
|
||||
# [kill]
|
||||
# canrecruit=0
|
||||
# animate=yes
|
||||
# [/kill]
|
||||
# )}
|
||||
#! {EARTHQUAKE (
|
||||
#! [kill]
|
||||
#! canrecruit=0
|
||||
#! animate=yes
|
||||
#! [/kill]
|
||||
#! )}
|
||||
[sound]
|
||||
name=lightning.ogg
|
||||
[/sound]
|
||||
|
@ -153,8 +154,8 @@
|
|||
|
||||
#define COLOR_ADJUST RED GREEN BLUE
|
||||
# Adjusts the color of the screen by a tint or red, green and blue
|
||||
# for example, lets make it very blueish:
|
||||
# {COLOR_ADJUST 0 0 100}
|
||||
# for example, let's make it very blueish:
|
||||
#! {COLOR_ADJUST 0 0 100}
|
||||
[colour_adjust]
|
||||
red={RED}
|
||||
green={GREEN}
|
||||
|
@ -166,11 +167,11 @@
|
|||
# These macros come in WHITE, RED, GREEN and BLUE and can
|
||||
# easily be expanded for ORANGE, PURPLE etc.
|
||||
#
|
||||
# Example, Flash the screen to scare the player:
|
||||
# {FLASH_GREEN ()}
|
||||
# {FLASH_RED ()}
|
||||
# {FLASH_BLUE ()}
|
||||
# {FLASH_WHITE ()}
|
||||
# Example: flash the screen to scare the player:
|
||||
#! {FLASH_GREEN ()}
|
||||
#! {FLASH_RED ()}
|
||||
#! {FLASH_BLUE ()}
|
||||
#! {FLASH_WHITE ()}
|
||||
|
||||
#define FLASH_WHITE ACTION
|
||||
# Flash the screen momentarily white.
|
||||
|
@ -211,15 +212,15 @@
|
|||
#define THUNDER ACTION
|
||||
# Creates a thunder-and-lightning effect while performing ACTION.
|
||||
# For example, player 3 might disappear in the flash of lightning:
|
||||
# {THUNDER (
|
||||
# [store_unit]
|
||||
# [filter]
|
||||
# side=3
|
||||
# [/filter]
|
||||
# variable=player3
|
||||
# kill=yes
|
||||
# [/store_unit]
|
||||
# )}
|
||||
#! {THUNDER (
|
||||
#! [store_unit]
|
||||
#! [filter]
|
||||
#! side=3
|
||||
#! [/filter]
|
||||
#! variable=player3
|
||||
#! kill=yes
|
||||
#! [/store_unit]
|
||||
#! )}
|
||||
[sound]
|
||||
name=lightning.ogg
|
||||
[/sound]
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Utility macros for scenario-objectivew control.
|
||||
# Utility macros for scenario-objective control.
|
||||
|
||||
# These macros don't depend on any others. Please don't change this.
|
||||
# ! in comments is used in generating HTML documentation, ignore it otherwise.
|
||||
|
||||
#define SET_OBJECTIVES SIDE SUMMARY NOTE CONDITIONS
|
||||
# Sets the objectives for a given player
|
||||
|
@ -8,7 +10,7 @@
|
|||
#
|
||||
# For example, we could set the objective for all players to: "survive for
|
||||
# 3 turns" wuth this:
|
||||
# {SET_OBJECTIVES 0 "Survive for 3 turns" () ()}
|
||||
#! {SET_OBJECTIVES 0 "Survive for 3 turns" () ()}
|
||||
#
|
||||
[objectives]
|
||||
side = {SIDE}
|
||||
|
@ -23,9 +25,9 @@
|
|||
# (marked green).
|
||||
#
|
||||
# For example we could tell player 2 to win by killing all other players
|
||||
# {SET_OBJECTIVES 0 "Kill eachother." (
|
||||
# {VICTORY_CONDITION "Kill all other players."}
|
||||
# )}
|
||||
#! {SET_OBJECTIVES 0 "Kill eachother." (
|
||||
#! {VICTORY_CONDITION "Kill all other players."}
|
||||
#! )}
|
||||
#
|
||||
[objective]
|
||||
condition = "win"
|
||||
|
@ -38,9 +40,9 @@
|
|||
# (marked red).
|
||||
#
|
||||
# For example we could tell all players that they lose if they die.
|
||||
# {SET_OBJECTIVES 0 "Survive." (
|
||||
# {DEFEAT_CONDITION "Death of your leader."}
|
||||
# )}
|
||||
#! {SET_OBJECTIVES 0 "Survive." (
|
||||
#! {DEFEAT_CONDITION "Death of your leader."}
|
||||
#! )}
|
||||
#
|
||||
[objective]
|
||||
condition = "lose"
|
||||
|
@ -53,7 +55,7 @@
|
|||
#
|
||||
# For example we can set side 1 to be a player belonging to team "Good Guys"
|
||||
# starting with 200g and no income:
|
||||
# {SIDE_PLAYER 1 "Good Guys" "Good Guy #1" 200 -2 ()}
|
||||
#! {SIDE_PLAYER 1 "Good Guys" "Good Guy #1" 200 -2 ()}
|
||||
[side]
|
||||
description={DESCRIPTION}
|
||||
side={SIDE}
|
||||
|
@ -72,9 +74,9 @@
|
|||
# For example, we can set side 4 to be a computer belonging to team "Evil Guys"
|
||||
# starting with 666g and no 99 income.
|
||||
# We also make it more aggressive:
|
||||
# {SIDE_COMPUTER 4 "Evil Guys" "Evil One" 666 99 (
|
||||
# aggression=0.95
|
||||
# )}
|
||||
#! {SIDE_COMPUTER 4 "Evil Guys" "Evil One" 666 99 (
|
||||
#! aggression=0.95
|
||||
#! )}
|
||||
#
|
||||
[side]
|
||||
description={DESCRIPTION}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Music control macros, and declarations of sound resource lists.
|
||||
# These macros do not rely on any other macros. Please don't change this.
|
||||
|
||||
# Music macros. As of 1.1.3, music is parsed as follows:
|
||||
#
|
||||
# As of 1.1.3, music is parsed as follows:
|
||||
# 1. the [scenario]-level [music] tag
|
||||
# 2. the [story]-level music key
|
||||
# 3. any [event]-level [music] tags
|
||||
|
@ -14,6 +13,8 @@
|
|||
# like that. Of course, if you want something more elaborate, code it
|
||||
# manually.
|
||||
|
||||
# These macros do not rely on any other macros. Please don't change this.
|
||||
|
||||
#define DEFAULT_MUSIC_PLAYLIST
|
||||
# A macro to define a standard playlist suitable for any level. The
|
||||
# music is defined twice to catch instances where music is changed in
|
||||
|
@ -109,15 +110,15 @@
|
|||
#
|
||||
# These are used in unit .cfg's for example like this:
|
||||
#
|
||||
# [animation]
|
||||
# hits=no
|
||||
#
|
||||
# [frame]
|
||||
# begin=-200
|
||||
# end=0
|
||||
# sound={SOUND_LIST:MISS}
|
||||
# image="units/dwarves/warrior-attack.png"
|
||||
# [/frame]
|
||||
#! [animation]
|
||||
#! hits=no
|
||||
#!
|
||||
#! [frame]
|
||||
#! begin=-200
|
||||
#! end=0
|
||||
#! sound={SOUND_LIST:MISS}
|
||||
#! image="units/dwarves/warrior-attack.png"
|
||||
#! [/frame]
|
||||
|
||||
#define SOUND_LIST:HOLY
|
||||
magic-holy-1.ogg,magic-holy-2.ogg,magic-holy-3.ogg,magic-holy-4.ogg #enddef
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
# Macros for teleporting units.
|
||||
|
||||
# These don't depend on any other macros. Please don't change this.
|
||||
# ! in comments is used in generating HTML documentation, ignore it otherwise.
|
||||
|
||||
#define TELEPORT_UNIT FILTER NEWX NEWY
|
||||
# Teleports a unit matching FILTER to NEWX,NEWY
|
||||
# For example, teleport player 3's leader to 4,5
|
||||
#
|
||||
# {TELEPORT_UNIT (
|
||||
# side=3
|
||||
# canrecruit=1
|
||||
# ) 4 5}
|
||||
# For example, teleport player 3's leader to 4,5
|
||||
#! {TELEPORT_UNIT (
|
||||
#! side=3
|
||||
#! canrecruit=1
|
||||
#! ) 4 5}
|
||||
[teleport]
|
||||
[filter]
|
||||
{FILTER}
|
||||
|
@ -24,7 +26,7 @@
|
|||
# Teleports a unit on tile OLDX,OLDY to NEWX,NEWY
|
||||
#
|
||||
# For example, teleport any unit thats currently on 1,1 to 4,5
|
||||
# {TELEPORT_TILE 1 1 4 5}
|
||||
#! {TELEPORT_TILE 1 1 4 5}
|
||||
[teleport]
|
||||
[filter]
|
||||
x={OLDX}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
# Utility macros for manipulating map terrain.
|
||||
|
||||
# These don't depend on any other macros. Please don't change this.
|
||||
# ! in comments is used in generating HTML documentation, ignore it otherwise.
|
||||
|
||||
#define MODIFY_TERRAIN LETTER X Y
|
||||
# Changes the terrain at a given list of coordinates
|
||||
#
|
||||
# For example, we could make 14,15 and 14,16 grassland:
|
||||
# {MODIFY_TERRAIN g (14,14) (15,16)}
|
||||
#! {MODIFY_TERRAIN g (14,14) (15,16)}
|
||||
[terrain]
|
||||
letter={LETTER}
|
||||
x={X}
|
||||
|
@ -17,11 +19,11 @@
|
|||
# Changes the terrain for a given area
|
||||
#
|
||||
# For example, we could create a castle at 10,12:
|
||||
# {MODIFY_TERRAIN_MASK 10 12 (
|
||||
# CC
|
||||
# CKC
|
||||
# CC
|
||||
# )}
|
||||
#! {MODIFY_TERRAIN_MASK 10 12 (
|
||||
#! CC
|
||||
#! CKC
|
||||
#! CC
|
||||
#! )}
|
||||
[terrain_mask]
|
||||
x={X}
|
||||
y={Y}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
# Later macros in this file are built using earlier ones, which
|
||||
# is why they live hear rather than being broken out into topic-specific files.
|
||||
|
||||
# ! in comments is used in generating HTML documentation, ignore it otherwise.
|
||||
|
||||
#### TABLE OF CONTENTS ####
|
||||
|
||||
# variable operations
|
||||
|
@ -156,7 +158,7 @@ message={MSG}
|
|||
# unit.side), handling all the storing and unstoring.
|
||||
#
|
||||
# Example that flips all spearmen to side 2:
|
||||
# {MODIFY_UNIT type=Spearman side 2}
|
||||
#! {MODIFY_UNIT type=Spearman side 2}
|
||||
[store_unit]
|
||||
[filter]
|
||||
{FILTER}
|
||||
|
@ -185,8 +187,8 @@ message={MSG}
|
|||
# Stores an attribute of a unit to the given variable.
|
||||
#
|
||||
# Example where this is used to flip all orcs to whatever side James is on:
|
||||
# {STORE_UNIT_VAR description=James side side_of_James}
|
||||
# {MODIFY_UNIT race=orc side $side_of_James}
|
||||
#! {STORE_UNIT_VAR description=James side side_of_James}
|
||||
#! {MODIFY_UNIT race=orc side $side_of_James}
|
||||
[store_unit]
|
||||
[filter]
|
||||
{FILTER}
|
||||
|
@ -207,16 +209,16 @@ message={MSG}
|
|||
# isn't possible directly.
|
||||
#
|
||||
# You can use it, for example, like this:
|
||||
# [event]
|
||||
# name=moveto
|
||||
# first_time_only=no
|
||||
#
|
||||
# {IF_TERRAIN $x1 $y1 gfm (
|
||||
# [then]
|
||||
# {DEBUG_MSG "Stepped on grassland, forest or mountains!"}
|
||||
# [/then]
|
||||
# )}
|
||||
# [/event]
|
||||
#! [event]
|
||||
#! name=moveto
|
||||
#! first_time_only=no
|
||||
#!
|
||||
#! {IF_TERRAIN $x1 $y1 gfm (
|
||||
#! [then]
|
||||
#! {DEBUG_MSG "Stepped on grassland, forest or mountains!"}
|
||||
#! [/then]
|
||||
#! )}
|
||||
#! [/event]
|
||||
[store_locations]
|
||||
x={X}
|
||||
y={Y}
|
||||
|
@ -241,12 +243,12 @@ message={MSG}
|
|||
# when filtering on it. For example, let's create a wose for player 1
|
||||
# at 4,7
|
||||
#
|
||||
# {CREATE_UNIT 1 "Wose" 4 7 () ()}
|
||||
#! {CREATE_UNIT 1 "Wose" 4 7 () ()}
|
||||
#
|
||||
# As a second example, let's make it a female wose which can recruit and
|
||||
# is name "Woselina":
|
||||
#
|
||||
# {CREATE_UNIT 1 "Wose" 4 7 "Woselina" (
|
||||
#! {CREATE_UNIT 1 "Wose" 4 7 "Woselina" (
|
||||
# canrecruit=1
|
||||
# )}
|
||||
[unit]
|
||||
|
@ -316,18 +318,18 @@ message={MSG}
|
|||
# recalled (even if not until the next scenario) the unit may have less
|
||||
# than his maximum hp left.
|
||||
#
|
||||
# An example, that returns all units stepping on (20,38) back to the recall
|
||||
# An example that returns all units stepping on (20,38) back to the recall
|
||||
# list:
|
||||
#
|
||||
# [event]
|
||||
# name=moveto
|
||||
#
|
||||
# [filter]
|
||||
# x,y=20,38
|
||||
# [/filter]
|
||||
#
|
||||
# {PUT_TO_RECALL_LIST x,y=20,38}
|
||||
# [/event]
|
||||
#! [event]
|
||||
#! name=moveto
|
||||
#!
|
||||
#! [filter]
|
||||
#! x,y=20,38
|
||||
#! [/filter]
|
||||
#!
|
||||
#! {PUT_TO_RECALL_LIST x,y=20,38}
|
||||
#! [/event]
|
||||
[store_unit]
|
||||
[filter]
|
||||
{FILTER}
|
||||
|
@ -386,7 +388,7 @@ name=prestart
|
|||
# Create a unit with the Loyal trait.
|
||||
#
|
||||
# Example:
|
||||
# {UNIT (Elvish Fighter) (Myname) ( _ "Myname") 1 1 1}
|
||||
#! {UNIT (Elvish Fighter) (Myname) ( _ "Myname") 1 1 1}
|
||||
#
|
||||
[unit]
|
||||
type={TYPE}
|
||||
|
|
Loading…
Add table
Reference in a new issue