My mission was essentially the same as Egon's; how to make a call to a python script from within a responder defined in Alcscript. 'notifymsg' seemed to be my answer, and given Egon's eventual success I used code derived from this thread. As is always the case with the gossamer thin web that is the Alcscript/Python interface I eventually got my code to work.. .. but not without a lot of patience .. phew .
On the way though I noticed the same behavior as reported by Egon at one point in his struggle:
When I click my button in game "id" passed to "OnNotify" is "-1"
I think I've noticed this before, without understanding what the problem is. My experience, given my current setup is that this call:
- Code: Select all
actTrigger = ptAttribActivator(1, 'Activator')
##############some code#########
def OnNotify(self, state, id, events):
if id == actTrigger.id:
will always fail because the value reported for the ptAttribActivator is always -1
This call:
- Code: Select all
actTrigger = ptAttribActivator(1, 'Activator')
##############some code#########
def OnNotify(self, state, id, events):
if id == actTrigger.id - 2:
works
I went back and checked this with some scripts I wrote a couple of years ago, which I know work fine. I inserted a debug script to report the id of the activator and always the same result: the value reported for the ptAttribActivator is always -1. Bug?
my current setup is:
Blender 2.49
Python 2.6
PyPRP 1.6