                        The Gateway IGM Program Codes:
                        ==============================

This file lists the program codes for the new built in Random Happening
Program (RHP) system.  See GATEWAY.TXT under the section [EXTRA SETUP
INFO] for how to install your RHPs into The Gateway.  Remember that
if you distribute your programs, please give me credit for writing
The Gateway!
                                        
Look at SAMPLE.RHP to see how these can be used.

The RHP language uses codes that have a @ on both sides.
Unless otherwise notified, codes will work with previous versions.

Example: @PROGRAM@ GATEWAY
Example: @VERSION@ 1.0, or @VERSION@ 1.1

Example: @VERSION@ 1.0d     -- For July-September 2002 beta use
-----------------------------------------------------------------

This first set is just normal commands with no parameters.

@;@@PROGRAM@ xxxxxxxxxxx  What program it's for, for this program
                          put GATEWAY
@;@@VERSION@ xxxx         Version of program the script is compatible
                          with
@;@@NAME@ xxxxxxxx        This is the name of the RHP to be displayed
                          in the menu.
@;@@LIMIT@ xxxx           Limits the number of times the RHP can be
                          accessed in a day.
@;@@VARIABLE1@ xxxxxxxxx  Gives a name to the given user variable
                          number.  If you define a name, it will show
                          up in the stats.
                          Max length is 13 characters. (v1.0a)
@;@                       Comment, everything on a line with this at the
                          front will be ignored (works in recording)
@CLEAR@                   Clear the screen (works in recording)
@STATS@                   Displays the player stats
@MORE@                    Pause for keypress with "<MoRE>"
@DELAY@                   Small delay (250 or so milliseconds)
@END@                     Stop program and pause
@KILL@                    Stop program, pause, and kill player (player
                          is notified)
@EXIT@                    Stop program, pause, and exit to LORD
@RUNRHP@ xxxxxxxx.xxx     Run an external RHP program.  Does not
                          return to the first program.
-----------------------------------------------------------------

This set is for writing to a player's MAIL?.DAT and LORD's LOGNOW.TXT.

@MAIL@      Start writing to mail
@MAILEND@   Stop writing to mail
@NEWS@      Start writing to LOGNOW.TXT
@NEWSLINE@  Stop writing to LOGNOW.TXT and add
            a line "-=-=-=-" centered (on-screen).
@NEWSEND@   Stop writing to LOGNOW.TXT
-----------------------------------------------------------------

The following two sets can be used in Mail and News recordings.

The next set is for designating sections to go to.
@#xxxxxxxx         Section designation, no maximum length

@GOTO@ @#xxxxxxxx  Go to section xxxxxxx after this command

The one in this section is for writing lengths of spaces.

@SPACE@ x  Write x spaces to screen/file
-----------------------------------------------------------------

This new set is for testing existing information and can be used in
main or news recording.

Example: @IF@ FEMALE @GOTO@ @#Help (if player is female, goto section
                                    @#Help)
Example: @IF@ EXPERIENCE>0 @GOTO@ @#Help (if experience is greater than 0,
                                          goto section @#Help)
Example @IF@ FIGHTER `9Good job! (if player is a Death Knight, write
                                  `9Good job! to file/screen)
Example @IFNOT@ MAGIC `9Good job! (if player is not a Magician, write
                                   `9Good job! to file/screen)

@IF@ condition command  Test condition, if true do command.  Command can
                        be any RHP @ command or one line text.  Condition
                        can have math in it (see variables section).
@IFNOT@ condition command  Test condition, if false do command.  Command can
                           be any RHP @ command or one line text.  Condition
                           can have math in it (see variables section).

conditions:
 FEMALE     : returns if player is female
 MALE       : returns if player is male
 FIGHTER    : returns if player is currently a Death Knight
 MAGIC      : returns if player is currently a Magic User
 THIEF      : returns if player is currently a Thief
 HORSE      : returns if player has a Horse
 FAIRY      : returns if player has a Fairy
 MARRIED    : returns if player is married, works with Violet and Seth
              Able marriages as well as player to player.
 SPIRITS    : returns if player is in High Spirits
 WEIRDEVENT : returns if player will have a Weird Event in the forest
 HEALED     : returns if player is healed
 x<y        : returns if number x is less than a number y
 x>y        : returns if number x is greater than a number y
 x<>y       : returns if x is not equal to y
 x=y        : returns if x is equal to y

Any number can be used as x or y or you can use player stats.
-----------------------------------------------------------------

Player stats that can be used as x or y:

 VISITS     : Visits left
 FOREST     : Forest fights
 FIGHT      : Player fights
 KIDS       : Kids
 DEFENCE    : Defense
 DEFENSE    : Defense  -- Usable with Gateway v1.0d IGM.

 ** You may use DEFENSE or DEFENCE to handle the player's Defense  **
 ** points.  However any RHP Script that uses @DEFENSE* has to be  **
 ** designed for The Gateway v1.0d beta. July 09, 2002 note.   **

 STRENGTH   : Strength
 EXPERIENCE : Experience Points
 LAYS       : Lays
 SKILL      : Current Skill type amount
 HITPOINTS  : Current HitPoints
 HITMAX     : Max HitPoints
 GEMS       : Gems
 GOLD       : Gold in hand
 BANK       : Gold in Bank
 CHARM      : Charm
 WEAPON     : Weapon number
 ARMOUR     : Armour number
 LEVEL      : Player's level
 KILLS      : Number of player kills
-----------------------------------------------------------------

The following set is for prompting for input.  The single character
section is used to act on input.  The program runner acts on the first
matching section found, so don't use the same selections nested.

Example: @PROMPT@ CD (prompts for C and D selections, must be an @##C and
                      @##D sections later.)
@YESNO@        Prompt for Y/n, Y and N sections
@PROMPT@ xx..  Prompt for selections xx.., selections must be capitalized
               The first selection will be the default one
@RANDOM@ x     Random number between 1 and x, each number a section
@##x           Single character section, can be called with @GOTO@
-----------------------------------------------------------------

The following set has some special properties.  If you put a = before the
number x, it makes that attribute equal to x.  If you put %, it adds /
subtracts x% of the existing attribute to the attribute.  Ones marked with
a $ can be used in mail without the = option and may just increment the
attribute by 1.  Player is notified with a 'You LOSE/GAIN x <type>!' in
both mail and on screen, except not in mail for those that just increment.
You can also do one math operation (/,*,+,-) in a line.

Example: @EXPERIENCE@ %-15 (Subtracts 15% of experience)
Example: @GOLD@ =0 (Sets gold in hand to 0)
Example: @EXPERIENCE@ 4*LEVEL (Adds 4 times the player's level of
                               experience)
Example: @GOLD@ 6*GEMS (adds 6 times the player's gems to gold)

@VISITS@ x      RHP Visits left
                -- For Gateway IGM scripts usage only.
@FOREST@ x      Forest fights $
@FIGHT@ x       Player fights $
@KIDS@ x        Kids $(increments number by 1, ignores x)
@DEFENCE@ x     Defense $
@STRENGTH@ x    Strength $
@EXPERIENCE@ x  Experience $
@LAYS@ x        Lays $(increments number by 1, ignores x)
@SKILL@ x       Current Skill type (if resulting number is above 40 the
                Skill value is set to 40, no uses are given) $(increments
                number by 1, ignores x)
@HITPOINTS@ x   Current HitPoints
@HITMAX@ x      Max HitPoints $
@GEMS@ x        Gems
@GOLD@ x        Gold in Hand $
@BANK@ x        Gold in Bank $
@CHARM@ x       Charm $(increments number by 1, ignores x, = option can
                be used)
@KILLS@ x       Number of player kills
@VARIABLE1@ x   RHP variable 1 for math, is forgotten after RHP is done
@VARIABLE2@ x   RHP variable 2 for math, is forgotten after RHP is done
@VARIABLE3@ x   RHP variable 3 for math, is forgotten after RHP is done
@VARIABLE4@ x   RHP variable 4 for math, is forgotten after RHP is done
@VARIABLE5@ x   RHP variable 5 for math, is forgotten after RHP is done

-- These variables are for Gateway IGM scripts usage only:
----------------------------------------------------------
@USER1@ x       User variable 1, is stored in Gateway's player file
@USER2@ x       User variable 2, is stored in Gateway's player file
@USER3@ x       User variable 3, is stored in Gateway's player file
@USER4@ x       User variable 4, is stored in Gateway's player file
@USER5@ x       User variable 5, is stored in Gateway's player file

Example usage:  Use an @USER code to keep track of whether an user
had done something in your RHP IGM earlier that day.
-----------------------------------------------------------------

These codes are special player value changers that don't act like the
earlier ones.  They cannot be used in mail.  Player is NOT notified.

@FAIRY@       Changes if user has a Fairy.  Takes no parameters.  If user
              has a Fairy, it's taken, else one is given.
@HORSE@       Changes if user has a Horse.  Takes no parameters.  If user
              has a Horse, it's taken, else one is given.
@SEX@         Changes user's sex.  Takes no parameters.
@ARMOUR@      Changed!  Changes armour name to built in name (same as in
              The Skeleton Happening)
@WEAPON@      Changed!  Changes weapon name to built in name (same as in
              The Skeleton Happening)
@WEIRDEVENT@  Changes if user will have a Weird Event in the forest, that
              is if they will find gems when entering.
              (Note: Weird is intentional spelling of the word.)
@SPIRITS@     Changes the player's spirits, from high to low or from low
              to high.
@HEAL@        Heals the player.
-----------------------------------------------------------------

Variables like these work like the older LORD style codes, you put them in
a string to output and they get replaced by the corresponding value.  Place
the word you want in between @*@ like so:
  Example: `4Hello, @*@NAME@*@!

These all require Gateway v1.0a+ in order to work:

ALLGOLD    : Player's total gold
ARMOUR     : Player's armour name (same as `a)
BANK       : Player's bank gold
CHARM      : Player's charm
CLASS      : Player's class (eg. "Death Knight")
DEFENCE    : Player's defense

DEFENSE    : Player's defense      - Requires v1.0d to use this one.

EXPERIENCE : Player's experience
FIGHT      : Player's human fights left
FOREST     : Player's forest fights left
GOLD       : Player's gold on hand
HITPOINTS  : Player's current hitpoints
HITMAX     : Player's maximum hitpoints
KILLS      : Player's number of player kills
KIDS       : Player's number of kids
LAYS       : Player's number of lays
LEVEL      : Player's level
NAME       : Player's name (same as `n lord code)
MARRIED    : Player's spouse's name (same as `m)
USER1      : User variable 1
USER2      : User variable 2
USER3      : User variable 3
USER4      : User variable 4
USER5      : User variable 5
STRENGTH   : Player's strength
SKILL      : Player's skill level for current class
VARIABLE1  : RHP variable 1
VARIABLE2  : RHP variable 2
VARIABLE3  : RHP variable 3
VARIABLE4  : RHP variable 4
VARIABLE5  : RHP variable 5
WEAPON     : Player's weapon name (same as `w)
WINS       : Number of times player has won
-----------------------------------------------------------------

Section added July 16:
The @VARIABLE1@ through @VARIABLE5@ codes may be used in The
L.O.R.D. Cavern, Outlands Tavern, and The Gateway to store math
computation data that are multi-step.  IOW, the standard RHP scripts
easily handle x*y type mathematics.  But something like A*B/C would
require two separate math computation statement lines in a script.
You store data in the five VARIABLE codes while getting to your
final result for complex math.

To code GOLD = LEVEL*2*GEMS would be done like this:

Statement #1: @VARIABLE1@=0    (Presets variable for data handling)
Statement #2: @VARIABLE1@ LEVEL*2       (Stores result of Level*2)
Statement #3: @GOLD@ VARIABLE1@*GEMS    (Multiples Variable1 * Gems)
---------------------------------------------------------------------

The following codes can be put anywhere in a line, even in Mail and
News recording.  They are case sensitive!

`n  Put player's name
`a  Put player's armour name
`w  Put player's weapon name
`m  Put player's spouse's name if married
`l  Do not line feed (put at the end of a line)
`s  Put player's sex (he/she)
`o  Put player's opposite sex (he/she)
`[  Put player's sex possessive (his/her)
`]  Put player's opposite sex possessive (his/her)
`<  Put player's sex (him/her)
`>  Put player's opposite sex (him/her)
-----------------------------------------------------------------

07/15/02 Update: For The Gateway, version 1.0b, and v1.1.
------------------------------
Use this condition in an RHP Script to do IGM events based on
whether the LORD game is in Clean Mode or not.  Here is an example:

@IF@ CLEANMODE `1You're naughty!
-- If LORD is in clean mode, it displays the "You're naughty" phrase
on screen.  Can also be used with the @GOTO@ command, etc.
---------------------------------------------------------------------

The following LORD text color codes can also be used:

`1 dark blue            `2 dark green       `3 dark cyan
`4 dark red             `5 dark violet      `6 brown
`7 gray                 `8 dark gray        `9 light blue
`0 light green          `! light cyan       `@ light red
`# light violet         `$ yellow           `% white
-----------------------------------------------------------------

Note: LORD Color Codes section provided by
      Gary Hartzell - iron.man11@verizon.net

Codes.txt created by Jason Brown - jmbrown@pcisys.net

Revisions:
(1) July 09, 2002: The @DEFENSE@ RHP Code is now usable with
    all of Jason Brown's IGMs and utilities.  Usage of the
    alternate spelling Code requires script writer to indicate
    in their RHP scripts that Gateway v1.0d (or later version)
    has to be used to run them.  The old pre-2002 version will
    not know what the DEFENSE code means.

(2) July 15-16, 2002:  Added CLEANMODE condition section.
    Added info on @USER codes and the @VARIABLE codes to file.

(3) Sept. 05, 2002.  If you write a RHP Script where you
    award a player a Horse, it is up to you to decide whether
    to also grant them the 25% boost in Forest Fights.  If you
    wish to do so.  Likewise, if Horse is killed, player loses
    25% of their remaining Forest Fights.

       Donald Tidmore, maintainer/updater.
       Email: ktidmore@bellsouth.net or donald.tidmore@usa.net

End of Codes file for The Gateway IGM.
======================================================================

