process_input.c.980331.aragorn

final_realms_fluffos_v1/lib/global/process_input.c.980331.aragorn · 1.7 KB

From the archive final_realms_fluffos_v1.zip

Download the archive   « Back to the archive contents

/*
 * Process_input
 * grabbed from RoD and lobotomized by Baldrick dec '97
 */
// Skullslayer - define MAX_STRLEN to stop the driver barfing as it tries
//               to interpret the command
// Skullslayer - took out random error messages, "What?" will do :)
#define MAX_STRLEN 900

#define EXPANSION ([     \
     "u" : "up",         \
     "d" : "down",       \
     "n" : "north",      \
     "s" : "south",      \
     "e" : "east",       \
     "w" : "west",       \
     "ne" : "northeast", \
     "nw" : "northwest", \
     "se" : "southeast", \
     "sw" : "southwest", \
     "r" : "read", \
     "p" : "post", \
     "l" : "look", \
  ])

nomask static mixed process_input( string ss )
{
    string verb, t, tmp ;
    //string tmp ;

    reset_eval_cost() ;
    if( !ss || ss == "" ) return "" ;
// Taniwha crash workround.
    if( strsrch(ss,"%^") == 0) return "";
    while( ss[(strlen( ss ) - 1)..(strlen( ss ) - 1)] == " " )
    ss = ss[0..(strlen( ss ) - 2)] ;
    if( !ss || ss == "" ) return "" ;
    if( strlen(ss) > MAX_STRLEN ) {
    ss = ss[ 0..MAX_STRLEN ];
    tell_object(this_object(),"Command too long - processing anyway.\n");
    }
    if( ss[0] == '\''  ) ss = "say "+   ss[1..(strlen( ss ) - 1)] ;
    if( ss[0] == ':'  ) ss = "emote "+ ss[1..(strlen( ss ) - 1)] ;
    if( ss[0] == '\"' ) ss = "lsay "+  ss[1..(strlen( ss ) - 1)] ;
    if( ss[0] == ';'  ) ss = "parse "+  ss[1..(strlen( ss ) - 1)] ;
    if( (tmp = EXPANSION[ss]) ) ss = tmp ;

    /* Ok, my stuff: (Baldrick)
     */
    /* First the aliases. */
    sscanf(ss, "%s %s", verb, t);
    if(!verb)
    verb = ss;
    if ( exec_alias(verb, t) ) { return 1; }

    //if( action_check( ss ) ) { return 1; }
    action_check( ss );

    if( lower_check( ss ) ) { return 1; }

    return 1;

}

Site Stats

Snippets: 1791
Codebases: 571