[MUD-Dev] PirateMUD and CSL

clawrenc at cup.hp.com clawrenc at cup.hp.com
Tue Aug 12 16:38:49 CEST 1997


In <9708060212.8ame at ami-cg.GraySage.Edmonton.AB.CA>, on 08/06/97 
   at 07:53 AM, cg at ami-cg.GraySage.Edmonton.AB.CA (Chris Gray) said:

>However, what I did was to make up a datatype that is 3-valued, and
>have many such routines return that type. I call the type "status",
>and it is built into the language just like "int", "bool", etc. The
>three values it has, and their common meanings are:

>    success - the activity has completed successfully
>    failure - the activity has failed
>    continue - continue with the activity

I'd long wondered about that one.  I've had a similar type for almost
10 years now, originally an enum:

  enum {
    NEG = -1,
    MID,
    POS
  } ACT;

Its been an incredibly useful mini-tool.  I've found it rather
surprising that nobody else seems to have used a tri-value in any of
the code I've worked on (which often could have *really* used one).

>In your example, the writer of the CSL could choose whether or not to
>return 'success', having done everything related to the event, or
>return 'continue', indicating that the default activities should
>happen. Returning 'continue' doesn't mean that nothing special has
>been done, however. Naturally, I then ran into cases where 3 values
>weren't enough, so I fudged it. You could just return an integer, and
>predefine some values.

For me a typical interpretation might be:

  switch (ACTvar) {
    case NEG:
      error...
    case MID:
      do nothing...nothing happened...
    case POS:
      do something...something happened.
  }

My general extrapolation is:

  negative values == failure conditions
  zero value == success/pass
  postive values == something notable which isn't an error happened.

--
J C Lawrence                           Internet: claw at null.net
(Contractor)                           Internet: coder at ibm.net
---------------(*)               Internet: clawrenc at cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...




More information about the mud-dev-archive mailing list