This is more a concept than a standard snippet, since its entirely up to 
you what you wish to be able to abort/prevent/etc.

The point of a preprog is adding in the capability to use progs to validate
the completion of an action.

Inside mud.c add this variable:

bool GlobalAbort;

Then, add any prog types you want, here are some examples:

  PRE_DEATH_PROG, 
  PRE_ENTRY_PROG, PRE_GIVE_PROG, PRE_BRIBE_PROG, PRE_WEAR_PROG, PRE_REMOVE_PROG, 
  PRE_GET_PROG, PRE_DROP_PROG, PRE_DAMAGE_PROG, PRE_REPAIR_PROG, PRE_SLEEP_PROG, 
  PRE_REST_PROG, PRE_LEAVE_PROG, PRE_ENTER_PROG,

For each of those you create you'll need to add a corresponding translation entry 
to both:

char *mprog_type_to_name( int type )     // Found int mud_comm.c
int mprog_name_to_type ( char *name )    // Found in db.c


A sample of one of the trigger checks for a preprog would be:


bool rprog_pre_enter_trigger( CHAR_DATA *ch, ROOM_INDEX_DATA *room)
{
    GlobalAbort = FALSE;    // Reset global abort to false
    if ( HAS_PROG(room, PRE_ENTER_PROG) )
    {
	rset_supermob( room );
	rprog_percent_check( supermob, ch, NULL, NULL, PRE_ENTER_PROG );
	release_supermob();
    } 
   return GlobalAbort;   // If it was told to abort, this will now equal true
}


in mud_prog.c in the function:

int mprog_do_command( char *cmnd, CHAR_DATA *mob, CHAR_DATA *actor, 
                      OBJ_DATA *obj, void *vo, CHAR_DATA *rndm, 
                      bool ignore, bool ignore_ors )

after:

  /* If the command is 'break', that's all folks. */
  if ( !str_cmp( firstword, "break" ) )
    return BERR;


add:

  /* If the command is 'abort', we not only bail out, we make sure it knows to cancel anything else. */
  if ( !str_cmp( firstword, "abort" ) ) 
  {
    GlobalAbort = TRUE;
    return BERR;
  }


An example of the appropriate method to check this would be a check similar to this inside
act_move.c's ch_ret move_char( CHAR_DATA *ch, EXIT_DATA *pexit, int fall )


// Before they can enter the next room 
        if ( rprog_pre_enter_trigger( ch, to_room) == TRUE)
         return rNONE;

Generally you'll just want to return silently if a preprog check comes back true, because the prog
itself told the command to not happen (and probably should have given any needed messages).

An example of a pre-prog in action:

>pre_enter_prog 100
if level($n) < 6
mpat 0.$n mea $n &WA wall of force rises within the archway, preventing you+
from being able to leave the Academy until your education is complete.
abort
endif

Noone under level 6 would be able to enter the room with that prog.
Abort of course would have no effect in any program other than pre prog.