X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=CarFire%2Fleveleditor%2Fdoc%2Fleveleditor.txt;h=cb56df862da4dbd6fd3bc19d977917f175f2a329;hb=65c7b1983e25cd16f2e00b83f23542854e8345af;hp=46cfb6392ab89f364ace8046390aedb5fffd590e;hpb=c255cb9589044501e3b16774eb96c9c803f523cc;p=chaz%2Fcarfire diff --git a/CarFire/leveleditor/doc/leveleditor.txt b/CarFire/leveleditor/doc/leveleditor.txt index 46cfb63..cb56df8 100644 --- a/CarFire/leveleditor/doc/leveleditor.txt +++ b/CarFire/leveleditor/doc/leveleditor.txt @@ -33,10 +33,15 @@ vim directory; usually: $HOME/.vim/doc or $HOME/vimfiles/doc -You're done! To use the level editor without installing the plugin, just -|source| the plugin in vim: +Alternatively, you can use the level editor without installing the plugin, +just |source| the plugin in vim: - :source path/to/leveleditor.vim + :so /path/to/leveleditor.vim + +Or setup Vim to do it automagically with |:autocmd|; put this in your user +Vim config file: + + au BufNewFile,BufRead *.cfmap so /path/to/leveleditor.vim =========================================================================== 3. Features *leveleditor-features* @@ -68,6 +73,9 @@ A. Map File Format *leveleditor-fileformat* The format of the CarFire map file follows the de facto standard INI file format, with at least one notable exception which we'll get to shortly. +Because of that exception, a specialized loader is necessary, so map files +should carry the extension `cfmap' so as not to have them be mistook as +your everyday household variety INI file. *leveleditor-metadata* The metadata section of the file contains just that: metadata. Some of the @@ -100,7 +108,9 @@ objects and whatnot. For example, if I wanted to place a monster on the map using the `A' character, I would create a section of the file named `A' and then place one or more `A' characters in the |leveleditor-maptable| section at the coordinates where I want the monsters to be created when the -map file is loaded. +map file is loaded. The static scenery at the places where entities are +placed is determined by the `defaulttile' key in the |leveleditor-metadata| +section. You can also use the same definitions to place identical copies of the same entity at different locations on the map. This is what allows you to @@ -109,32 +119,50 @@ although you are limited to only 52 different types of entities per level. By the way, these sections can appear anywhere in the file, either before or after the |leveleditor-maptable| section. +There is also a way to place entities on the map without putting its +identifying character in the |leveleditor-maptable| section. You might +want to do this if you want to place an entity at some cell on the map that +you don't want to be the default tile. This is accomplished by listing +the coordinates where entities should be place after the `create' key. +Sometime during the map loading process, entities defined with this key and +one or more valid sets of coordinates will be made available to the game in +the usual manner, just as if its identifier was put on the map. The +difference is, you can put any (open) static scenery you want at those +locations. + =========================================================================== B. Basic Syntax *leveleditor-syntax* To make parsing simple, the format of the values that make up a key-value pair follows a consistent pattern based on the type of thing being -described. Here are the things that can appear on the right side of a -key-value pair assignment: +described. Except in the case of strings, white space is ignored. Here +are the things that can appear in a map file. + + *leveleditor-keys* +Keys are special strings that appear on the left side of a key-value pair, +which combined is a key and value separated by an equals sign. Keys are +simply a sequence of alphabet characters. No white space, digits, or +punctuation is allowed in a key. *leveleditor-strings* Strings are simply a sequence of characters. If the key expects to be set to a string, then the right side of the assignment up to the line-end will be parsed as a string, including any white space. If a string value is not -necessarily expected, you can explicitly surround the string with quotes; -otherwise, the value could be interpreted as a list if it contains any -white space. +necessarily expected, you can explicitly surround the string with double +quotes; otherwise, the value could be interpreted as a list if it contains +any white space. The characters given as a string are interpreted as-is. +No escape characters are ever parsed (i.e. \t or \n). -The characters that make up the string are included in the string according -to their literal characters; no escape characters are ever parsed (i.e. \t -or \n). Any value which does not follow any of the following formats will -be read as a string. - - *leveleditor-numbers* + *leveleditor-integers* Base-ten numbers are parsed as they appear. The parser is allowed to read numbers with special characters such as -10e5. Numbers cannot be specified in any other base than ten. + *leveleditor-booleans* +Boolean values are one of two keywords: `true' and `false.' Case is +ignored when parsing booleans, but abbreviations are not allowed. For +example, `TrUe' is okay, but `T' is not. + *leveleditor-coordinates* To specify a coordinate or location on the map, surround two comma-separated integers with square brackets. For example, @@ -150,7 +178,7 @@ you go down. A range of integer values is parsed as two comma-separated integers with angular brackets. For example, - <1-4> Matches any integer between 1 and 4, inclusive. + <1,4> Matches any integer between 1 and 4, inclusive. In this way, you could set a range as the value for the key `numplayers' in the |leveleditor-metadata| section, representing the minimum and maximum @@ -159,16 +187,12 @@ number of players the map supports. *leveleditor-functions* The syntax of a function call is familiar. First comes the name of the function to be called, then an open parenthesis, followed by a -comma-separated list of arguments before a closing parenthesis. For -example, +whitespace-separated (no commas!) list of arguments before a closing +parenthesis. For example, wait(3) Delay for 3 seconds. has(F) Check if a player has an entity F in inventory. - create(B,[2,3]) Create an entity B on the map at [2,3]. - -Note, the file loader parses each group of characters between white space -separately; therefore, do not include spaces between the arguments of the -function call, only a single comma. + create(B [2,3]) Create an entity B on the map at [2,3]. *leveleditor-lists* Some keys can be assigned a list of things, such as functions to be called