Object 3892

Mob Progs Manual: C2

Chapter 2  If-Else-or-etc.

This is the heart of control flow.  Without it, you cannot do
dittly except for the gratutious hi mobile, and pickup mobile.

        In place of any legal mud command in a MOBprogram, one can substitute a
flow of control command. Here is the syntax for a flow of control command.
"if" " "  "("  ")"   NL
or    (  )   NL
                        .           .           .
or    (  )   NL
         NL
         NL
              .   .   .
        break NL
              .   .   .
         NL
else NL
         NL
         NL
              .   .   .
        break NL
              .   .   .
         NL
"endif" NL
        Basically, it is: an 'if' line, followed by zero or more 'or' lines,
followed by zero or more legal mud commands, which may contain a 'break' line,
possibly followed by an 'else' line , followed by zero or more legal mud
commands, which may contain a 'break' line, followed by an 'endif' line.
The only new syntax labels are all in the IF line:
--Explainations
An IF_CHECK is a string which describes under what context to compare things.
The ARGUMENT is the reference point from which the LHS of an expression comes.
The OPERATOR indicates how the LHS and RHS are going to be compared.
The VALUE is the RHS of the expression to be compared by the operator.
The BREAK command bails out of the entire MOBprogram regardless of the
level if nesting.
If that looks confusing, skip to the end of the document and review the
Example. Hopefully that should clear things, otherwise you'll probably have
to give us a mail since examples are the best way we know to explain syntax.

Anything between " " is required.  Otherwise, it's pretty much
optional.

Extra Descriptions: manual mob progs C1 create type IN_FILE_PROG ACT_PROG BRIBE_PROG ENTRY_PROG GIVE_PROG GREET_PROG ALL_GREET_PROG FIGHT_PROG HITPERCENT_PROG HITPRCNT_PROG DEATH_PROG RAND_PROG SPEECH_PROG ARGS commands destroy C2 C3 Variables C4 Reference mobcommands
Back to the Main Builder Resources Page
© World of Pain, All rights reserved.