Home

[Package Index | Mudlib Index | Effect Index]

File /global/new_parse.c

This file contains all the code to support and run the text parsing system used by discworld. This is called 'add_command', please see help on add_command for a more detailed listing.

Written by Pinkfish

Inherits

This class inherits the following classes /global/command.c

Includes

This class includes the following files /include/obj_parser.h, /include/function.h, /include/command.h, /include/soul.h, /include/user_parser.h and /include/creator.h

Class Index

Method index

Public Functions

These are functions that everyone can access.

.

    add_command
    varargs int add_command(string cmd,
                            object ob,
                            mixed format,
                            function funct)
    

    The id is a useful thingy so that things can remember which pattern was parsed.
      add_failed_mess
      void add_failed_mess(object dir,
                           string mess,
                           mixed * in_dir)
      
        add_succeeded
        int add_succeeded(mixed ob)
        

        This is called by the object the command is being passed on to find whether or not it succeeded on the objects it was passed... and which ones. This can be passed an object.. or an array of objects. Share and enjoy.
          add_succeeded_mess
          int add_succeeded_mess(object dir,
                                 mixed incoming_mess,
                                 object * in_dir)
          
            check_if_allowed
            int check_if_allowed(object ob)
            
              check_if_creator
              int check_if_creator(object ob)
              
                check_living
                int check_living(object ob)
                
                  create_message
                  varargs string create_message(string * bits,
                                                int * matches,
                                                mixed * pattern,
                                                object * dir,
                                                int flag)
                  
                    get_fail_messages
                    string get_fail_messages(string verb,
                                             object * fail_obs)
                    
                      my_find_match
                      class obj_match my_find_match(string pattern,
                                                    object * where,
                                                    int type)
                      
                        new_parser
                        nomask int new_parser(string str)
                        

                        This method does all the real work for add_command parsing.
                          pattern_match
                          int * pattern_match(string * bits,
                                              mixed * pattern)
                          
                            print_special_messages
                            void print_special_messages(string verb)
                            
                              query_failed_message_exists
                              int query_failed_message_exists(object dir)
                              

                              This method checks to see if the given object has already added a failed message yet or not. This is checking for a direct object, not an indirect object.
                              • Parameters:
                                dir - the object adding the failed message
                              • Returns:
                                0 if not found, 1 if found
                              • See also:
                                add_failed_mess()
    query_p_commands
    mapping query_p_commands()
    

    This method returns the current internal set of commands.

    ([ "command_name" :
    ({ ({ pattern_weight, pattern_str, nn, object, function }) })
    ])

    • Returns:
      the current commands list
    • See also:
      query_p_objects()
        query_p_objects
        mapping query_p_objects()
        

        This method returns the current mapping between objects and commands.
        ([ object : ({ "cmd1", "cmd2", ... }), ... ])

        This mapping is used when the object leaves the environment to make the command updating more efficent.

        • Returns:
          the current object/command mapping
        • See also:
          query_p_commands()
            query_parse_command
            mixed * query_parse_command(string name)
            

            This method returns the information associated with the specific command. This should only be used for debug.
            • Parameters:
              name - the command name to return info on
            • Returns:
              the information associated with the command
                query_parse_command_objects
                object * query_parse_command_objects(string name)
                

                This method returns the objects associated with the parse command.
                • Parameters:
                  name - the command name to return the objects for
                • Returns:
                  the objects associated with the command
                    query_succ_mess_dir
                    object * query_succ_mess_dir()
                    

                    This method returns the objects which have success messages already attached for. This allows you to determine which objects already hace a success message available. This array is added to by both the add_succeeded_mess and add_failed_mess methods, it disable the autogeneration of these messages.
Valid HTML 4.01 Transitional
Valid CSS!
Read More