Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

AND events together, instead of OR ?

If you have a question or need help, this is the place to be.
Post Reply
Dnq3
Posts: 3
Joined: Fri Feb 26, 2010 6:58 pm

AND events together, instead of OR ?

Post by Dnq3 »

If you create a macro and add two events, and an action to it, then the action will be performed if either of the events occurs (ie. OR).

Is it possible to only perform an action if both events occur (ie. AND) ?

I want to do this so that buttons have different effects, depending on whether the media player is in a paused state or not. At the moment, I enable/disable certain macros, depending on the state of the player (ie. Paused or not).
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AND events together, instead of OR ?

Post by Pako »

DependentEvent.jpg
DependentEvent.jpg (19.34 KiB) Viewed 875 times

Code: Select all

#Python script Aon
eg.globals.var_A = True

Code: Select all

#Python script Aoff
eg.globals.var_A = False

Code: Select all

#Python script TriggerEvent
try:
    if eg.globals.var_A:
        eg.TriggerEvent("AandB",prefix = "MyEvent")
except:
    pass
This example does exactly what you ask.
If the event "MyEvent.B" occurs after the event "MyEvent.Aon", event "MyEvent.AandB" is triggered .
But if it's after the event "MyEvent.Aoff", nothing happens.
Pako
Post Reply