aboutsummaryrefslogtreecommitdiff
path: root/behaviors/RestrictLocation.py
diff options
context:
space:
mode:
Diffstat (limited to 'behaviors/RestrictLocation.py')
-rw-r--r--behaviors/RestrictLocation.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/behaviors/RestrictLocation.py b/behaviors/RestrictLocation.py
index febc9ed..5e12440 100644
--- a/behaviors/RestrictLocation.py
+++ b/behaviors/RestrictLocation.py
@@ -6,6 +6,16 @@ import util.Strings as Strings
import random
import pdb
class RestrictLocation(Behavior):
+ """RestrictLocation is a Behavior which does an action -- A ModifyParam, actually, when a certain
+ location based condition is met. It takes arguments as follows:
+
+ <Action> -- Operation to perform, using ModifyParam syntax. Use {val} to reference the variable
+ specified by ParamName.
+ <ParamName> -- the name of the parameter to modify.
+ <LocationRestriction> -- either a tuple of (xmin,ymin,xmax,ymax) or a python-correct conditional. Use {x} and
+ {y} to reference x and y. Use &lt; and &gt; to get < and > in XML. EG:
+ <LocationRestriction>{x}&lt;0 or {x}&gt;800</LocationRestriction>"""
+
def behaviorInit(self):
action = self['Action']
modifyParamArgs = {'ParamType': 'Sensor',
@@ -25,7 +35,7 @@ class RestrictLocation(Behavior):
def processResponse(self, sensorInputs, recursiveInputs):
ret = []
for data in sensorInputs:
- if not self.locEval(data['Location']):
+ if self.locEval(data['Location']):
(dataOut, recur) = self.paramModifier.immediateProcessInput([data], [])
#behaviors expect lists ^[]
ret += dataOut