Ignore:
Timestamp:
10/10/09 17:26:08 (10 years ago)
Author:
Kaydeth_parpg
Message:

Ticket #2: Patch by Kaydeth. Updated the classes in console.py through engine.py (went through files alphabetically) to correct some obvious discrepancies with our coding standard. comment[s:trac, t:2]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/dialogue.py

    r300 r312  
    2222class EndException(Exception): 
    2323    """EndException is used to bail out from a deeply nested 
    24        run_section/continue_with_response call stack and end the 
     24       runSection/continueWithResponse call stack and end the 
    2525       conversation""" 
    2626    pass 
     
    2828class ResponseException(Exception): 
    2929    """ResponseException is used to bail out from a deeply nested 
    30        run_section/continue_with_response call stack and allow the user to 
     30       runSection/continueWithResponse call stack and allow the user to 
    3131       specify a response""" 
    3232    pass 
     
    3434class BackException(Exception): 
    3535    """BackException is used to bail out from a deeply nested 
    36        run_section/continue_with_response call stack and rewind the section 
     36       runSection/continueWithResponse call stack and rewind the section 
    3737       stack""" 
    3838    pass 
     
    6767 
    6868        try: 
    69             self.run_section(start_section) 
     69            self.runSection(start_section) 
    7070        except EndException: 
    7171            # we stopped talking to the NPC 
    7272            logging.debug("Reached the end") 
    7373            end_cb = self.callbacks.get('end') 
    74             if end_cb: end_cb() 
     74            if end_cb: 
     75                end_cb() 
    7576            return 
    7677        except ResponseException, e: 
     
    7980            self.section_stack.pop(-1) 
    8081            try: 
    81                 self.run_section(self.section_stack[-1]) 
     82                self.runSection(self.section_stack[-1]) 
    8283                return e 
    8384            except ResponseException, e: 
    8485                return e.args[0] 
    8586 
    86     def get_section(self, section_name): 
     87    def getSection(self, section_name): 
    8788        """Return a section object. 
    8889        @type section_name: string 
     
    101102            try: 
    102103                if response is not None: 
    103                     self.continue_with_response(self.section_stack[-1], response) 
     104                    self.continueWithResponse(self.section_stack[-1], \ 
     105                                                response) 
    104106                else: 
    105                     self.run_section(self.section_stack[-1]) 
     107                    self.runSection(self.section_stack[-1]) 
    106108            except ResponseException, e: 
    107109                logging.debug("Got response exception %s" % (e.args, )) 
     
    124126            except EndException: 
    125127                end_cb = self.callbacks.get('end') 
    126                 if end_cb: end_cb() 
     128                if end_cb: 
     129                    end_cb() 
    127130                logging.debug("Reached the end") 
    128131                return 
    129132 
    130     def continue_with_response(self, section_name, response): 
    131         """Reply to a response in a section and continue executing dialogue script 
     133    def continueWithResponse(self, section_name, response): 
     134        """Reply to a response in a section and continue executing dialogue 
     135           script 
    132136           @type section_name: str 
    133137           @param section_name: the section to continue 
     
    142146                self.section_stack.pop(-1) 
    143147 
    144         for command in itertools.cycle(self.get_section(section_name)): 
    145             if not command.get('responses'): continue 
     148        for command in itertools.cycle(self.getSection(section_name)): 
     149            if not command.get('responses'): 
     150                continue 
    146151 
    147152            responses = [] 
     
    161166                raise EndException() 
    162167 
    163             self.run_section(section) 
    164  
    165     def run_section(self, section_name): 
     168            self.runSection(section) 
     169 
     170    def runSection(self, section_name): 
    166171        """Run a section 
    167172           @type section_name: string 
     
    179184                self.section_stack.pop(-1) 
    180185 
    181         logging.debug("In run_section %s %s" % (section_name, self.section_stack,)) 
    182         for command in itertools.cycle(self.get_section(section_name)): 
     186        logging.debug("In runSection %s %s" % (section_name, \ 
     187                                               self.section_stack,)) 
     188        for command in itertools.cycle(self.getSection(section_name)): 
    183189            if command.get("say"): 
    184190                if self.callbacks.get('say'): 
     
    197203 
    198204            elif command.get("start_quest"): 
    199                 self.callbacks["start_quest"](state, command.get("start_quest")) 
     205                self.callbacks["start_quest"](state, \ 
     206                                              command.get("start_quest")) 
    200207 
    201208            elif command.get("complete_quest"): 
    202                 self.callbacks["complete_quest"](state, command.get("complete_quest")) 
     209                self.callbacks["complete_quest"](state, \ 
     210                                                 command.get("complete_quest")) 
    203211 
    204212            elif command.get("dialogue"): 
Note: See TracChangeset for help on using the changeset viewer.