#example map and command list.
#comments are marked with #, spaces/caps don't matter in the def section.

#This is the actual map. Use a fixed-width font to display/edit correctly.
0000000
0211110
0111000
0111350
0000000

#After the map comes the definitions section.
:def
#This gives the difficulty of monsters that inhabit the area.
difficulty=2

#This defines what the '0' character meant when used in the map.
:0
#Use the rock.png picture when displaying. Take a look at the
#images directory for the list of usable pictures.
pix=rock
#No, you can not walk on it. Use either 0 or 1.
walk=1

:1
pix=grass
walk=0

:2
#Example of stairs. (Note: The stairs.png picture does not exist;
#it is being used as an example only.)
pix=stairs
walk=0
#This does the work, moving the player to map2.txt, xy coord. 5, 7
action=move map2.txt 5 7

:3
#Again, example3.png does not exist.
pix=example3
walk=1
#if you have already attacked, let the player through.
action=if var have_attacked 1 | walk 0 | pass
#If you have already attacked, stop the script
action=if var have_attacked 1 | end | pass
#A dialog box will display this.
action=info Looks interesting.
action=if question Enter this hole? | attack random 3 | end
#set have_attacked, so it will only work once.
action=set have_attacked 1

:5
pix=exit
walk=0
#Note the \. That continues the line. Rephased, it would be:
#action=info You Win
action=info \
You Win
#Call wingame.txt.
action=win

#Complete list of working commands:
#\
#action= info \
#Display line.
#Not a real command, but if a line ends with \, it can continue to the
#next line.

#difficulty=Number
#difficulty=3
#Note that this only goes between :def and the first tile definition.
#It specififies the difficulty of monster available.


#:Letter or Number
#:t
#Start defining a new tile. Note that case matters, and only use one digit.

#pix=Filename minus .png extension
#pix=grass
#Give the displayed picture. Only .png is supported, and the file must be in
#the images directory

#walk=Number
#walk=0
#Can the player walk on it? The only values accepted are 0 (can walk) and
# 1 (can not walk)

#action=String
#action=pass
#Scripting associated with the tile. The rest of this file describes
#possible strings. Prepend action= to anything listed from now on.


#Action Strings

#attack random Number OR attack String
#attack random 2
#attack Ant
#Attack either a random monster of difficulty Number, or the monster
#given with String.

#die
#Die. This kills the player, and calls endgame.txt.

#end
#End processing the script. Note that this is only useful with If.

#give String Number
#give maxhp 5
#Adjust stats; possible values for String: hp, ep, maxhp, maxep, attack,
#defense, gold, exp, skillpoints. Note that Number can be either
#positive or negative.

#hero Filename minus .png extension
#hero hero_w
#Give a specific picture to the hero. While any picture can be used (that would
# work for pix=) it is recommended to use one of the hero_n (s, e, w) pictures.

#hurt Number
#hurt 10
#Injure the player for Number points, reduced by armor.

#if Action1 | Action2 | Action3
#if rng 1 5 | attack random 2 | pass
#Perform Action1. (This can be any action, though some are more useful
#than others) If it is successful, (action returned 1) perform Action2.
#Otherwise, perform Action3. End and Pass are useful for the 2nd/3rd places,
#and Attack, Item, Rng, Question, Var, and Take are useful for the 1st.
#For actions that may kill the player, (eg: Hurt, give hp -5) simply follow the
#action with others, and don't bother with If, as death ends the script anyway.
#For Attack, success is defined by destroying the monster, failure by
#running away. Death simply ends the script.

#info String
#info Hi there!
#Give the player a message box.

#item String
#item light healing potion
#Give the player the item specified. (case-insensitive) Fails if the
#inventory is full.

#lose
#Lose the game. Note that this does not call endgame.txt, differing it from
#die. Use die whenever possible.

#move mapname x y
#move town.txt 4 6
#Move the player to the given location. mapname is the complete filename of the
#map, (no need for path) and x and y are the xy coordinates inside the map.

#pass
#Do nothing. Only useful with If.

#pix Filename minus .png extension
#pix rock
#change the picture to the given file. Same rules as standard pix= apply.

#question String
#question Leave this area?
#This creates a dialog box with a body of String and yes/no buttons.
#Use with the If command.

#refresh
#Refresh the screen. This is useful if you want to move the player *then*
#show a dialog box. Leaves the player pointing to the west. If you don't like
#that, use the hero command after refreshing.

#rng Number1 Number2
#rng 4 9
#This creates a random number between 1 and Number2. (ie, if Number2 is 3, the
#possible values are 1, 2, or 3.) The number is then compared with Number1.
#If Number1 is higher or equal, 1 is returned. Otherwise, 0 is returned.
#This is meant to work with the If action.
#Note that the probability of 1 returning can be expressed as the fraction
#Number1/Number2. ie, rng 3 4 will return 1 3/4ths of the time.

#set String Number
#set have_entered 1
#set a variable. Use var String Number to compare. This information is
#saved when saving the game, and is useful for one-time actions.

#store Number
#store 3
#Enter a store. The possible values are 1 (Weapons store), 2 (General store),
#3 (Armory), and 4 (Training Hall).

#take String
#Take or drop an inventory item. When used with If, can implement keys and
#the like.

#var String Number
#var have_entered 1
#returns 1 if the value of String is Number. Use with If.

#walk Number
#walk 1
#Change the walkable status to the given number. Same rules as standard walk=

#win
#Call wingame.txt.