  ===========================================================================
  MMEDIT Text Block Primer (revision 1)
  ===========================================================================

  This document attempts to explain how to make your own text blocks, and
  explains the various uses for text blocks in classes, monsters, spells
  and so on.  The first thing to know about text blocks is that 90% of them
  are a basic scripting language, with tokens, parameters and seperators.
  Here is how a possible text block might look for purchasing an item--

  price 200000 66:giveitem 9:message 66

  The ':' symbol seperates the commands from eachother.  A SINGLE space
  seperates different parameters (as is the case with the 'price' token).
  While MMEDIT shows wrapping in the viewer, the scripts must USUALLY
  occupy one line which can be VERY long.  Hopefully this basic explanation
  of how the text block script language works will be enough for you to
  comprehend the basics to follow, please take the time to read it as it
  will give you a fairly reasonable understanding of how text blocks work,
  how to use them, and common recommended guidelines should you make your
  own for your own NPC's, etc.

  ===========================================================================
  Table of Contents
  ===========================================================================

    1) Text Blocks for Monster/NPC Interaction
      1.1) Generic Text Block Interaction (dark druids)
      1.2) Complex Text Block Interaction (dwarven merchant)
      1.3) Text Block Command Index
    2) Text Blocks for Class Titles
      2.1) Class Titles Explained and an Example
    3) Text Blocks for Rooms (advanced)
      3.1) Effects
      3.2) Room Specific Commands
    4) Text Blocks for Items and Spells (advanced)
      4.1) Chests
      4.2) Maps and Documents (quest and story elements)
    5) Text Blocks for Quests (advanced)
      5.1) Simple Quest (interaction and abilities)
      5.2) Simple Quest (interaction, abilities and items)
      5.3) Complex Quest (interaction, abilities, items and monsters)
      5.4) Complex Quest (interaction, abilities, items, monsters and rooms)

  ===========================================================================

  The first use explained will be for monsters and how you can define how a
  monster responds, what he/she/it responds to, and so on.  First, understand
  this-- the uses for textblocks overlap in a lot of areas, they can be used
  for various different things, and their initial implementation may be
  different for each object, but overall they're almost identical.  Thanks!

  ===========================================================================
  1) Text Blocks for Monster/NPC Interaction
  ===========================================================================

  Whenever you 'greet' or 'ask' an NPC or monster, you're interacting with
  a text block.  The text block used for this greet/ask is specified in
  the Monster under the 'Greet Text' part of the 'Messages' area.

  1.1) Generic Text Block Interaction (dark druids)

  For the first part of our investigation/example, let's take a look at
  'dark druid's.  'dark druid's have their greet text set to text block 140.
  When we view text block 140, we see this--

  high druid:142
  druid:142
  forest:143
  darkwood forest:143
  ring:144
  darkwood ring:144
  ****

  ** NOTE: The four stars '****' denote the end of the text block, you will
  not see these in the exported text block-- this is normal!   Do NOT type
  the four stars at the end of your new text blocks, MMEDIT looks for the
  end of file, not for anything else! **

  These are the various things you can ask a 'dark druid' in the Elder
  Darkwood Grove.  When you type 'ask dark druid high druid' you'll be
  shown text block 142.  When you type 'ask dark druid forest' you'll be
  shown text block 143.  Finally when you type 'ask dark druid ring' you'll
  be shown text block 144.  As you can see there are also variations on the
  options in case the user types in something SIMILAR to what the expected
  input is (typing in a partial match won't work, so you need to prepare
  the blocks for possible partial commands, and not just what you THINK
  they should always type).

  As you'll also see with this initial text block, it's "Link To" field
  is set to 141.  This is the DEFAULT text displayed if the user simply
  greets the monster without actually giving any parameters.  If the
  user greets the monster with a parameter that doesn't match any of these,
  the game will display 'dark druid has nothing to tell you!' (for the
  dark druids, replace the name with the NPC's name you want to edit).

  1.2) Complex Text Block Interaction (dwarven merchant)

  Now, let's check out an NPC that lets you purchase objects from it, and
  is a bit more elaborate as far as interaction is concerned.  The NPC we
  will inspect next is the 'dwarven merchant', whose greet text is set to
  907.  When we look at block 907 we see this--

  wares:909
  axes:910
  mail:912
  hammers:914
  ****

  It links to 908 which has this--

  [0mThe dwarven merchant looks you over suspiciously, but after a moment his eyes
  light up at the prospect of a paying customer.

  [0;32m"Greetings, traveler," he says, "I be the traveling merchant Gorthuk. Many fine
  [0;1;32mwares [0;32mI bring from yon mountain stronghold, the likes of which have not been
  seen in these parts since olden times! Now that the barricade has been blown
  asunder by the gnomish inventors, trade between the peoples of mount Khazarad
  and Silvermere can once again continue."

  [0mWith that, he rubs his hands gleefully and looks at you in expectation.
  ****

  This is the default text when the monster is greeted without any specific
  questions/parameters.  You'll notice the ANSI codes above highlight the
  word 'wares' so that the user knows to ask the NPC about this word, and as
  the original text block shows, asking about 'wares' will get you a more
  detailed list in block number 909, which looks like this--

  [0mWith a twinkle in his eye, the dwarf continues happily:

  [0;32m"Fine [0;1;32maxes [0;32mfrom the forges of Khazarad I bring, and the best [0;1;32mmail [0;32mour smiths
  can craft! Also, [0;1;32mhammers [0;32mof awesome power, worked with the skill only our
  ancient rune-lords can muster. The weapons are 2000 gold each, and the mail
  is 8000 gold. Mind you that no unskilled warrior can wield these exquisitely
  made armaments, though! If ye wish to purchase any of these, simply ask me
  about the item ye're interested in."
  ****

  Again, the highlightning continues and points to the words 'axes', 'mail',
  and 'hammers'.  These take us to text blocks 910, 912 and 914 respectivly.
  Inspecting text block 910 will be our last look at this particular style
  of NPC interaction--

  [0mThe dwarven merchant holds his hand out expectantly.
  [40m
  ****

  This block links to text block 911, which looks like this--

  price 200000 1458:giveitem 868:message 1459
  ****

  Now, here's an explanation of how these commands work in text blocks;

  price 200000 1458

  The 'price' command deducts the amount (in copper) specificied in the
  next token, and generates the message specified in the last token if
  the required amount of money isn't on the player.  If the amount
  specified isn't on the player, the text block quits executing after it
  displays the message.

  giveitem 868

  The 'giveitem' command places the specific item in the players inventory.

  message 1459

  The 'message' command displays the specific message to the player and
  the room (depending on the message of course).  

  Following below is a list of commands you can use in text blocks, and
  a basic idea of how they work, which parameters to use, and so on!  As
  well, where possible, I include examples of how to use the command.
  These are in alphabetical order, and you may wish to extract this list
  and print it out for quick reference while working with text blocks.
  Remember, the commands are seperated by ':'s and a space is placed between
  each parameter to a command. 

  NOTE: The name in brackets DOES NOT need to be placed in brackets!  When
  you use these commands, simply type in a number in the place of what
  you're using.  Example: addability 131 1.  NOT addability [131] [1].

  1.3) Text Block Command Index

  addability [ability] [amount]
                        - Adds to the players specified ability, or, if the
                          ability is not present, give the ability with the
                          amount specified (if it is present, add the
                          amount to it).
  addexp [amount]       - Add the specified amount of exp, up to 32768.
  addevil [amount]      - Add the specified amount of EP, +/- allowed.      
  adddelay [time]       - Force a delay for the number of seconds specified
                          in [time].  
  cast [spell]          - Cast the specified spell and continue when the
                          spell is finished being cast.
  check ????            - Unknown.
  checkability [ability] [value]
                        - Check to see if the player has the specified
                          ability of atleast the specified [value] or higher.
  checkitem [item] [message]
                        - Checks to see if the player has the item specified
                          in [item], if not display the message specified
                          in [message] and quit.
  checkskill ????       - Unknown.
  checkspell [spell] [text]
                        - Checks to see if the player has the spell specified
                          in [spell] cast on them, and if not, display the
                          text block specified in [text] and quit.
  class [class]         - Check to see if the players class is the same as
                          that specified in [class].
  clear ????            - Unknown.
  clearitem [item]      - Clears the specified item from the room.  If the
                          item specified is 0, then all items are cleared
                          from the room.  (This is what is done in the
                          Khazarad Rubbish Disposal Chamber.)
  evilaligned [EP]      - If the player has atleast the amount of evil
                          points specified in [EP] then the text block
                          continues, otherwise quit.  This checks the UPPER
                          limit, use goodaligned to check against a lower
                          limit!  An appropriate use for this would be to
                          check to see if a player was between 100 and
                          150 evil points, like so--

                          evilaligned 100:goodaligned 150:<commands>
  failability [ability] - If the player has the specified ability, quit.
  failitem [item] [message]
                        - Check to see if the player has the specified
                          item and if so, quit and generate the message
                          specified in [message].
  failroomitem [item] [message]
                        - Check to see if the room has the specified
                          item and if so, quit and generate the message
                          specified in [message].
  flag ????             - Unknown.
  giveability [ability] [value]
                        - Gives the player the specified ability with the
                          specified value.  If the player already has this
                          ability, it's value is overwritten with this value.
  givecoins [amount] [currency]
                        - Give the amount of money specified in [amount] in
                          the currency type specified in [currency].  So far
                          only 'G' has been seen as a currency.  Presumeably,
                          'R' would be runic, 'P' would be platinum, 'S'
                          would be silver and 'C' would be copper.  But none
                          of these have been seen or tested.
  giveitem [item]       - Give the item specified in [item].
  goodaligned [EP]      - If the player has atleast the amount of evil
                          points specified in [EP] then the text block
                          continues, otherwise quit.  This checks the LOWER
                          limit, use goodaligned to check against an upper
                          limit!  An appropriate use for this would be to
                          check to see if a player was between 100 and
                          150 evil points, like so--

                          evilaligned 100:goodaligned 150:<commands>
  hideitem [item]       - Hides the item specified in [item] in the current
                          room?  Used in the Guilds add-on (not released).
  learnspell ????       - Unknown.  (Perhaps learnspell [spell], and place
                          the spell specified into the players spellbook?)
  maxlevel [level] [message]
                        - Checks to see if the players level is equal to or
                          lesser than the value specified in [level], if
                          the player is above this value [message] is
                          displayed and the text block quits.
  message [message]     - Show the message specified in [message].
  minlevel [level] [message]
                        - Checks to see if the player is atleast the level
                          specified in [level], if not show the message
                          in [message] and quit.
  needmonster [monster] [message]
                        - Checks the room for the specified monster/NPC, if
                          the NPC doesn't exist in this room then the
                          message in [message] is displayed and the text
                          block quits.
  nomonsters [message]  - If there are monsters in the room, show the message
                          specified in [message] and quit.
  price [amount] [message]
                        - Take the money specified in [amount] (in copper).
                          If the player doesn't have the money, generate
                          the message specified in [message] and quit.
  race [race]           - Checks to see if the players race matches the race
                          specified here.  If not, quit.
  random [text]         - Picks a random number and does a random test on the
                          text block specified in [text].  Each line in the
                          text block matches a number of less than or equal
                          to the value specified, like so--

                          6:<commands>
                          9:<commands>
                          100:<commands>

                          In this example, the first set of commands are
                          executed if the number is between 0 and 6; the
                          second set of commands are executed if the
                          number chosen is between 7 and 9 (including 9 and
                          7), and the last set of commands are executed if
                          the number chosen is between 10 and 100 (including
                          10 and 100).
  remoteaction [room] [message] [????] [exit]
                        - Opens the exit specified in [room] for exit [exit]
                          and generates the message [message] in the current
                          room.  [exit] is an index into the exits array,
                          starting at 0 up to 9.  The list of exits shown
                          in the detailed editor starts at 0 and loops
                          down to 9, so 0 = 'north' and 9 = 'down'.  The
                          [????] is unknown and has so far been seen as
                          only 0.
  removeability [ability]
                        - Removes the specified ability from the player.
  roomitem [item]       - Checks to see if the specified item is in the room,
                          and if not, quits.
  roomtext ????         - Unknown.
  summon [monster]      - Summons the specified monster to the current
                          room.
  takeitem [item] [message]
                        - Take the item specified in [item] from the
                          players inventory.  If the player doesn't have
                          the item, display the message specified in
                          [message] and quit.
  teleport [room] [map] - Teleport the player to map [map] room [room].
  teleport_silvermere   - Unknown.
  teleport_sewers       - Unknown.
  teleport_slumsewers   - Unknown.
  teleport_darkwood     - Unknown.
  teleport_eldergrove   - Unknown.
  teleport_labyrinth    - Unknown.
  teleport_blackcaverns - Unknown.
  teleport_fungushazy   - Unknown.
  teleport_crackedlava  - Unknown.
  teleport_blackfortress- Unknown.
  teleport_obsidian     - Unknown.
  testability [ability] [value]
                        - Checks the ability against the value specified in
                          [value], if it's not equal then quit.
  testskill [skill] [value] [text]
                        - Test the skill [skill] against [value].  [skill]
                          is an actual text in the block, like 'strength'
                          or 'intellect'.  It quits and displays the text
                          block specified in [text] if the player fails
                          the skill test.  Here is a list of accepted
                          [skill] texts--

                            agility
                            strength
                            intellect
                            wisdom
                            health
                            charm
                            spellcasting
                            perception
                            stealth
                            thievery
                            traps
                            picklocks
                            tracking
                            magicresistance
                            current_hp
                          Example:
                           
                            testskill intellect 20 80
                            testskill current_hp 0 80

  test_tournament ????  - Unknown.
  text [text]           - Displays the text block specified in [text].
                        
  ===========================================================================
  2) Text Blocks for class titles:
  ===========================================================================

  Text blocks for class titles are very different but far simpler than
  the other uses described in this document.  For this reason, this
  section is far shorter and much less in-depth.  The only thing to
  remember is that normal text block script commands (like those detailed
  in section 1.3) do not work in these text blocks.

  2.1) Class Titles Explained and an Example

  This useage is far more straightforward than text blocks for other uses.
  In this use, the text block is a line by line title for level object,
  where each line represents a specific level.  The first line represents
  the title for level 1, the second line represents the title for level
  2, and so on up to no logical limit.  The only thing of importance to
  remember is that if you want to make GENDER SPECIFIC titles, you need
  to include BOTH titles on the same line, seperated by '|' symbols.  Here
  is an example of a set of titles for a class, in this example, Rangers--

  Apprentice
  Novice
  Novice
  Novice
  Strider
  Strider
  Strider
  Strider
  Strider
  Scout
  Scout
  Scout
  Scout
  Scout
  Guide
  Guide
  Guide
  Guide
  Guide
  Woodsman|Woodswoman
  Woodsman|Woodswoman
  Woodsman|Woodswoman
  Woodsman|Woodswoman
  Woodsman|Woodswoman
  Courser
  Courser
  Courser
  Courser
  Courser
  Tracker
  Tracker
  Tracker
  Tracker
  Tracker
  Pathfinder
  Pathfinder
  Pathfinder
  Pathfinder
  Pathfinder
  Hunter
  Hunter
  Hunter
  Hunter
  Hunter
  Ranger Lord|Ranger Lady
  Ranger Lord|Ranger Lady
  Ranger Lord|Ranger Lady
  Ranger Lord|Ranger Lady
  Ranger Lord|Ranger Lady
  Master Ranger
  ****

  This example also shows the way gender specific titles are handled, and
  shows that it's safe to use spaces in class titles.  Apperently any
  titles for levels NOT handled are replaced with the default title of
  'Master'.  (Which explains why after the last line, 'Master Ranger',
  a Ranger receives the title of 'Master' every level after that without
  it being in this text block.)  The text block used for a classes title
  is saved in the class under the 'Titles' name.  By default and keeping
  with WCC conventions, all new classes are assigned their title text
  block by adding their numeric value (Class #) to 3000.  So if you added
  a new class and it was number 23, MMEDIT would set the class title text
  block to 3023.  Now, one thing to keep in mind, as this hasn't been
  thoroughly tested, is that MajorMUD ALSO stores the class title in the
  user database-- what this means to you, would-be editor, is that your
  changes may not take effect immeditiatly.  But they will take effect
  the next time the player trains for a level I'm certain.  Don't qoute me
  on this behaviour though.  :)

  ===========================================================================
  3) Text Blocks for Rooms (advanced)
  ===========================================================================

  3.1) Effects
  3.2) Room Specific Commands

  ===========================================================================
  4) Text Blocks for Items and Spells (advanced)
  ===========================================================================

  4.1) Chests
  4.2) Maps and Documents (quest and story elements)

  ===========================================================================
  5) Text Blocks for Quests (advanced)
  ===========================================================================

  Text blocks are the cornerstone of quests in MajorMUD.  They're used to
  do comparisons, set and maintain flags in the user database (in the form
  of abilities with different values), limit quests to specific classes,
  and so on.  Text blocks are almost as important to quests and MMUD in
  general as maps are, or any other object in MMUD.  Certain quests are
  simple, and involve minimal NPC interaction (such as the ice sorceress
  quest, high druid quest, and adult she-dragon quests, which merely rely
  on the player killing a monster and doing a specific action in a
  room to get their reward), while others are complex and vast, involving
  many NPCs, doing different things and even puzzles and such that all
  involve text blocks (such as the mod-6 Dao Lord quest, which involves
  interacting with various NPC's, getting and moving items, exploring
  different areas, finding different objects in rooms and exploring them,
  then speaking to NPC's again-- then moving through areas which use
  text blocks to control exit behaviour, as well as areas that use text
  blocks to make random events occur not only in the current room, but
  in other rooms throughout the area).

  5.1) Simple Quest (interaction and abilities)

  This one is so simple, it can't hardly be called a quest really.  It's more
  like something to keep a player from abusing a specific event over and
  over.  Say you want to do a quest similar to the Magebane sword quest that
  Witchunters do, and you want to give a specific class a specific item, but
  only ONCE and not again.  You also want this item to be given out only to
  a player of a specific level.  Here's a simple idea how, given these
  assumed truths: i) The class the item is to be given to are the 'Fluffs',
  which are class number 22, ii) the item to be given out is the long
  pursued 'fluffhammer', which is item number 10045, iii) the ability we'll
  use to 'flag' the player as having received the item will be an unused
  ability, number 500.  Now the example--

    Step 1-- Create the NPC that you want the player to interact with.  For
      our example, we'll create 'Bob'.  'Bob' will be an invincible NPC that
      is Stationary and is setup in one room with a 1 hour regen time and
      9999 HP, 9999 MR, 999/999 AC/DR and a Magical +999 ability as well as
      other godlike NPC stats.  For the sake of completedness, we'll make
      this NPC be monster number 10000.
    Step 2-- Create the weapon/item you want the player to receive for
      completing this easy and simple to do quest.  We'll create our
      'fluffhammer' as item 10045 which is far away from WCC's current
      max item values.
    Step 3-- Create the NPCs greet text and initial default text responses;
      for this we'll make text block 30000 be the greet which will look
      like this:

      fluff:30002
      fluffs:30002
      something:30003
      weapon:30003
      ****

      This block will link to text block 30001 which will look like this;

      [0mObviously an experienced and wise Fluff, Bob rises at your approach
      and bows humbly, and says:

      [0;32m"Hello adventurer, I am Bob, great Elven Fluff of legend, and holder
      of sacred trinkets for all [0;1;32mFluffs[0;32m throughout the land. I've
      helped many a Fluff with their early years, and guided them on to greatness and
      success."

      [0mBob sits again, returning to his work and awaiting your questions.
      ****

      Now, we also set it up to respond to the words 'fluff' and 'fluffs' by
      displaying text block 30002 to the user, which will look like this;

      Bob stops for a moment, and says "Yes, many trinkets, but most Fluffs come
      to me for--" and he stops, then looks off about the room and continues saying
      "-- [0;1;32msomething[0;32m special.  If you are of age and skill, I may have
      something of use for you as well!".  And with that, he sits back again,
      tending to his work.
      ****

      Finally, to complete this step and give the user the object that we 
      want them to receive, both as a Fluff and as a Fluff of the proper
      level, we create text blocks 30003, 30004 and 30005;

      (Text block 30003 -- Link To = 30004)
      [0mBob looks at you intently as if to judge you...

      ****

      (Text block 30004)
      class 22:minlevel 15 10000:checkability 500 1:testability 500 1:giveability 500 1:giveitem 10045:text 30005
      ****

      (Text block 30005)
      [0;32m"Wonderful! Indeed you are of the ancient walk, Fluffs, and you have reached
      the level of giftedness.". With that, he takes out a large, blunt object which
      you instantly recognize as the long fabled Fluffhammer! He takes it out and
      slowly makes swinging gestures with it; you notice him fumble with it, but just
      assume that his brew has gotten the better of him. After displaying it's ease
      of use, he proudly presents it to you and says "May your adventures benefit
      greatly from this weapon, and for all Fluffs throughout the realms, protect
      the great Fluffs from the evil and tyrrany of the Dark One.".

      [0mBob works up a broad smile, takes his seat again, and begins to sip on his
      brew.
      ****

    Step 4-- Create message 10000 for when a Fluff isn't of the appropriate
      level to get the weapon.  Line 1 of the message will look like this;

      Bob laughs, "Pitiful, come back when you are a worthy Fluff!".

      Line 2 of the message will look like this;

      %s sulks in disappointment when Bob deems them unworthy.

      And Line 3 will be blank.

  And with that, you've created a simple quest.  Mind you, this has NOT been
  thoroughly tested, but they are a guide to be used, not an exact method
  for a quest.  (Although this SHOULD work, it simply has not been tested.)

  5.2) Simple Quest (interaction, abilities and items)
  5.3) Complex Quest (interaction, abilities, items and monsters)
  5.4) Complex Quest (interaction, abilities, items, monsters and rooms)

