Hook an entity output

Please post any questions about developing your plugin here. Please use the search function before posting!
roflmuffin
Junior Member
Posts: 19
Joined: Fri Nov 06, 2015 11:49 pm

Hook an entity output

Postby roflmuffin » Sat Nov 07, 2015 7:50 am

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.
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sat Nov 07, 2015 8:59 am

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.
roflmuffin
Junior Member
Posts: 19
Joined: Fri Nov 06, 2015 11:49 pm

Postby roflmuffin » Sat Nov 07, 2015 10:55 am

Thanks a bunch, can't believe I missed that

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 116 guests