Page 1 of 1

Hook an entity output

Posted: Sat Nov 07, 2015 7:50 am
by roflmuffin
Hi there,

I'm looking to hook a buttons OnPressed output but I'm not too sure how this is done in Source Python. I already have the entity from using EntityIter, just need to know how to hook the thing.

Any advise would be appreciated.

Posted: Sat Nov 07, 2015 8:59 am
by Ayuto
Hi,

you can use the EntityOutput listener from the listeners module. Here is an example:

Syntax: Select all

from listeners import EntityOutput

@EntityOutput
def on_entity_output(output_name, activator, caller, value, delay):
print(output_name)
You would obviously want to check the output name equals "OnPressed" and maybe check the classname of the caller/activator as well.

Posted: Sat Nov 07, 2015 10:55 am
by roflmuffin
Thanks a bunch, can't believe I missed that