File: DynamicGoal.py

package info (click to toggle)
cyphesis-cpp 0.5.16-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,084 kB
  • ctags: 3,627
  • sloc: cpp: 30,418; python: 4,812; xml: 4,674; sh: 4,118; makefile: 902; ansic: 617
file content (22 lines) | stat: -rw-r--r-- 813 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#This file is distributed under the terms of the GNU General Public license.
#Copyright (C) 2000 Aloril (See the file COPYING for details).

from mind.Goal import Goal

class DynamicGoal(Goal):
    """Base class for dynamic or trigger goals.

    A dynamic goal is one which is activated by an event or trigger,
    usually the sight of an event, or a trigger language construct
    in a talk operation."""
    def __init__(self, desc="some dynamic goal", trigger=None, **kw):
        kw['desc'] = desc
        apply(Goal.__init__,(self,),kw)
        self.trigger_data = trigger
        self.vars.append("trigger_data")
    def trigger(self):
        return self.trigger_data
    def event(self, me, original_op, op):
        """this is called when trigger even is received"""
        #redefine this
        pass