ObjectInVolumeDetector ALC/python script not working

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

ObjectInVolumeDetector ALC/python script not working

Postby Branan » Wed Jul 02, 2008 2:52 pm

First, thanks to Tsar Hoikas in this thread for pointing me in the right direction to even get started on this.

I'm trying to create a functional plObjectInVolumeDetector (think the floor panels in Teledahn). So far I've got an ALCscript which I suspect is broken, and a python script which I suspect is perfectly fine.

Between the two code pieces, whenever the avatar (or, I think, any object) goes into the region, two lines should be placed into the python.0.elf file:
python.0.elf wrote:Event notification recieved...
It's from our goal region! yay!

Unforunately, I'm not getting either of those lines.

I know it's loading my python file - I forgot to put my testage2.pak file into my Uru folder the first time I tested it, and it failed to load tst2Goal.py - when I added the .pak file, that error went away.

ALCscript
Code: Select all
Region_Goal:
    logic:
        modifiers:
          - tag: Goal
            flags:
              - localelement
            cursor: nochange
            activators:
              - type: objectinvolume
                remote: Region_Goal
                triggers:
                  - any
            actions:
              - type: pythonfile
                ref: $PythResp
        actions:
          - type: pythonfile
            tag: PythResp
            pythonfile:
                file: tst2Goal
                parameters:
                  - type: activator
                    ref: logicmod:$Goal


Python Script
Code: Select all
from Plasma import *
from PlasmaTypes import *

actGoal = ptAttribActivator(1, "Goal Activator")

class tst2Goal(ptResponder,):
    __module__ = __name__
   
    def __init__(self):
        ptResponder.__init__(self)
        self.id=1009100
        self.version = 1
        self.ballObject = None
   
    def OnFirstUpdate(self):
        pass
   
    def OnServerInitComplete(self):
        pass
   
    def OnSDLNotify(self, VARname, SDLname, playerID, tag):
        pass
   
    def OnNotify(self, state, id, events):
        PtDebugPrint("Event notification recieved...")
        if(id == actGoal.id):
            PtDebugPrint("It's from our goal region! yay!")
Image
Your friendly neighborhood shard admin
User avatar
Branan
Gehn Shard Admin
 
Posts: 694
Joined: Fri Nov 16, 2007 9:45 pm
Location: Portland, OR

Re: ObjectInVolumeDetector ALC/python script not working

Postby Nadnerb » Wed Jul 02, 2008 3:25 pm

perhaps try an alcscript like this?:

Code: Select all
Region_Goal:
    logic:
        modifiers:
          - tag: Goal
            flags:
             - multitrigger
            activators:
             - type: objectinvolume
            conditions:
             - type: volumesensor
               satisfied: true
               direction: enter
            actions:
             - type: responder
               ref: $PythResp
        actions:
          - type: pythonfile
            tag: PythResp
            pythonfile:
                file: tst2Goal
                parameters:
                  - type: activator
                    ref: logicmod:$Goal
Image
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: ObjectInVolumeDetector ALC/python script not working

Postby Branan » Wed Jul 02, 2008 4:41 pm

nadnerb: no luck with that.

Hmm... maybe the problem is that the logicmod is on the region, instead of a separate object. I'll try making another object and making that the mod, see what happens...

EDIT: with my original script and a seperate logicmod object it still doesn't work. I'm not sure how to mod Nadnerb's script to work on a separate object, so I haven't tested that yet.
User avatar
Branan
Gehn Shard Admin
 
Posts: 694
Joined: Fri Nov 16, 2007 9:45 pm
Location: Portland, OR

Re: ObjectInVolumeDetector ALC/python script not working

Postby Jojon » Wed Jul 02, 2008 10:07 pm

I neither know, understand, nor have the time atm, to read what you have above properly, but should the alcscript not be attached to the object whose presence in the region is to be detected?
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: ObjectInVolumeDetector ALC/python script not working

Postby Trylon » Wed Jul 02, 2008 10:46 pm

No, it should simply be on the region.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: ObjectInVolumeDetector ALC/python script not working

Postby Robert The Rebuilder » Thu Jul 03, 2008 4:57 am

Paladin: I had created ObjectInVolumeDetectors for the paging version of Ahra Pahts; these regions will trigger paging in/out of shells whenever a person walks through them. Here's the alcscript for one of the objects (which is just a generic region, without bounds turned on):

Code: Select all
Portal13To44:
    physical:
        physlogic: detect
    logic:
        modifiers:
          - tag: mod
            flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions:
              - type: pythonfile
                ref: $click
        actions:
          - type: pythonfile
            tag: click
            pythonfile:
                file: LinkTest01Portal
                parameters:
                  - type: activator
                    ref: $mod
                  - type: string
                    value: Portal13To44


Note the differences between this and what Nadnerb posted:
  • In the activators section, I have added a triggers list (with enter as its only item)
  • The actions in my modifiers section has a type of pythonfile and not responder
  • I pass in the name of the region that was triggered, which you probably don't need.

My associated python code for this is below:
Code: Select all
    def OnNotify(self, state, id, events):
        print "LinkTest01Portal.OnNotify(), id=",id
        if (id == actObjectInVolume.id and PtWasLocallyNotified(self.key)):
            # Do stuff...


One last tip: make sure that your region has no scale or rotation in its transform. If it does, hit Ctrl-A to apply the transform to the vertices.
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: ObjectInVolumeDetector ALC/python script not working

Postby Branan » Thu Jul 03, 2008 10:28 am

That worked! I may have to give you a hug.

Walked through my region twice, and the python log reflects that =)
[quote=python.0.log](07/03 10:26:28) Event notification recieved...
(07/03 10:26:28) It's from our goal region! yay!
(07/03 10:26:30) Event notification recieved...
(07/03 10:26:30) It's from our goal region! yay![/quote]
Image
Your friendly neighborhood shard admin
User avatar
Branan
Gehn Shard Admin
 
Posts: 694
Joined: Fri Nov 16, 2007 9:45 pm
Location: Portland, OR

Re: ObjectInVolumeDetector ALC/python script not working

Postby Robert The Rebuilder » Thu Jul 03, 2008 10:52 am

Glad to help.

And just a friendly wave will do. :)
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: ObjectInVolumeDetector ALC/python script not working

Postby Jojon » Thu Jul 03, 2008 11:01 am

Congrats Paladin! :)


Trylon wrote:No, it should simply be on the region.


Oh, goodie! I suppose, then, based on things half-heard-half-guessed, that we might also be able to get notified on just WHAT has entered a region, or alternatively request a list of present thingies? (I really should learn Python and read up on stuff...or at least figure out *where* to read up, other than the pyprp sources.:)

(maybe some day I'll get working on that if-blueball-enters-bluehome-then-blueplayer-wins-requiring stuff.)
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: ObjectInVolumeDetector ALC/python script not working

Postby Nadnerb » Thu Jul 03, 2008 11:44 am

oops. It must have been the type: responder not being pythonfile. >.<

(The others shouldn't matter because the code was plucked directly from a working region in TD)
Image
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron