I never use the self.id and never had problems. A plasma object id is assigned automatically.
Here is a version I have used recently which has an activatorlist. Not for any reason in particular, just to try something different.

It does come in handy when you need to call some of Cyan's global Python files.
AlcScript
- Code: Select all
Door:
logic:
modifiers:
- name: Enter_Door_Rgn
cursor: nochange
flags:
- multitrigger
activators:
- type: objectinvolume
remote: <door region>
triggers:
- enter
conditions:
- type: volumesensor
satisfied: true
direction: enter
actions:
- type: pythonfile
ref: :Pyth_Door
- name: Exit_Door_Rgn
cursor: nochange
flags:
- multitrigger
activators:
- type: objectinvolume
remote: <door region>
triggers:
- exit
conditions:
- type: volumesensor
satisfied: true
direction: exit
actions:
- type: pythonfile
ref: :Pyth_Door
actions:
- type: pythonfile
name: Pyth_Door
pythonfile:
file: <python file>
parameters:
- type: activatorlist
refs: ['logicmod:Enter_Door_Rgn', 'logicmod:Exit_Door_Rgn']
The list items must have quotes. Since the script is not under the region object itself I defined the region as a remote. And I had to set the cursor to nochange otherwise it gives the door a hotspot.
Python code
- Code: Select all
from Plasma import *
from PlasmaTypes import *
actDoorRegion = ptAttribActivator(1, 'Door region activator')
class <python file>(ptModifier,):
def __init__(self):
ptModifier.__init__(self)
self.named = self.__class__.__name__
def OnNotify(self, state, id, events):
if (not state):
return
if (id == actDoorRegion.id):
for event in events:
if (event[0] == kCollisionEvent):
if event[1]:
PtDebugPrint('%s: OnNotify: id = %d: Someone entered the region' % (self.named, id))
else:
PtDebugPrint('%s: OnNotify: id = %d: Someone left the region' % (self.named, id))
break