i have been programming remotes like rti for a long time. alot of them have flag systems where you can test, toggle, add, clear flags. in this case is there a way to have an event trigger a predetermined flag, i.e. lets say i turn on my tv through a macro, it turns on a "tv" flag which tells that the tv is on, and lets say i trigger another macro to change to a different source, it would test that flag to see of it was up so it would or would not send the ir command out to turn on the tv. Then when i hit say a "power off" macro it could test the "tv" and "projector" flags to see which one was up to fire off the correct ir command to turn off the tv or projector then clear the flag.
please let me know if there is a way to do this if not turn this into a feature request.
Thanks
James
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.
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.
is there a way to have flag's?
Re: is there a way to have flag's?
Look here for eg.globals.
Another way could be to trigger multiple macros with the same event (tv_on, lights_off). Each macro would disable itself and enables the needed counterpart macros (tv_off, lights_on). If theses macros are called, let them finally disable themselves.
Another way could be to trigger multiple macros with the same event (tv_on, lights_off). Each macro would disable itself and enables the needed counterpart macros (tv_off, lights_on). If theses macros are called, let them finally disable themselves.
-
SlipStream
- Posts: 8
- Joined: Fri Feb 19, 2010 2:21 am
Re: is there a way to have flag's?
that wont work, there are to many variables, here is a very good example...
------------------------------
equipment in this layout
Receiver
DVD Player
Cable Box
TV
Projector
Media Center
------------------------------
ok so lets say i want to watch cable on the tv, now the flag systems i have seen in many remote/automation systems work like this. each device i assign to a flag. when the watch cable macro goes off this is kinda whats happens. this is kinda of a sample of the macro structure i use when controling the system. current flag state is in blue.
------------------------------
flag tv is down
Flag "TV"
|> If "tv" flag is up | Do Nothing
\do nothing
|> If "tv flag is down | Fire off "tv on" ir code
\set "tv" flag up
TV IS ON
flag projector is down
Flag "Projector"
|> if "projector" flag is up | Fire off "projector off" ir code
\set "projector" flag down
|> if "projector" flag is down | do nothing
\do nothing
PROJECTOR IS OFF
flag cable box is down
Flag "Cable Box"
|> if "cable box" flag is up | Do Nothing
\do nothing
|> if "cable box" flag is down | Fire off "cable box on" ir code
\set "cable box" flag up
CABLE BOX IS ON
flag dvd player is down
Flag "DVD Player"
|> if "dvd player" flag is up | Fire off "cable box on" ir code
\set "cable box" flag down
|> if "dvd player" flag is down | Do Nothing
\do nothing
DVD PLAYER IS OFF
flag media center is down
Flag "Media Center"
|> if "media center" flag is up | Fire off "media center off" ir code
\set "media center" flag down
|> if "media center" flag is down | Do Nothing
\do nothing
MEDIA CENTER IS OFF
flag receiver is down
Flag "Receiver"
|> if "receiver" flag is up | Do Nothing
\do nothing
|> if "receiver" flag is down | Fire off "cable box on" ir code
\set "receiver" flag up
RECEIVER IS ON
|> Time Delay 3.0 Secs
|>Fire off "receiver cable box input" ir code
-------------------------------
now, from what you said about the eg.globals, it is not as simple as disabling and enable certain macros, there are to many to list. in this case, what would happen if i wanted to watch my media center on the projector. in the case of the flags it looks at each flag can compairs them to a predetermined state and changes them to match and also changes the flag status to match, or if the condition is what is specified it does nothing. here is an example if i said lets watch the media center on the projector. current flag state is in blue
-------------------------------
flag tv is up
since tv was on, it will see that and turn the tv off
Flag "TV"
|> If "tv" flag is up | Fire off "tv off" ir code
\set "tv" flag down
|> If "tv flag is down | Do Nothing
\do nothing
TV IS OFF
flag projector is down
since projector was off, it will see that and turn the projector on
Flag "Projector"
|> if "projector" flag is up | Do nothing
\do nothing
|> if "projector" flag is down | Fire off "projector on" ir code
\set "projector" flag up
PROJECTOR IS ON
flag cable box is up
since cable box was on, it will see that and turn the cable box off
Flag "Cable Box"
|> if "cable box" flag is up | Fire off "cable box off" ir code
\set "cable box" flag down
|> if "cable box" flag is down | Do nothing
\do nothing
CABLE BOX IS OFF
flag dvd player is down
since the dvd player was off, it will see that and do nothing
Flag "DVD Player"
|> if "dvd player" flag is up | Fire off "cable box on" ir code
\set "cable box" flag down
|> if "dvd player" flag is down | Do Nothing
\do nothing
DVD PLAYER IS OFF
flag media center is down
since media center was off, it will see that and turn the media center on
Flag "Media Center"
|> if "media center" flag is up | Do nothing
\do nothing
|> if "media center" flag is down | Fire off "media center on" ir code
\set "media center" flag up
MEDIA CENTER IS ON
flag receiver is up
since the receiver was on, it will see that and do nothing
Flag "Receiver"
|> if "receiver" flag is up | Do Nothing
\do nothing
|> if "receiver" flag is down | Fire off "cable box on" ir code
\set "receiver" flag up
RECEIVER IS ON
|> Time Delay 3.0 Secs
|>Fire off "receiver media center input" ir code
-------------------------------
that in a nut shell is how the flag system on most good programable remotes are, including logitech except user has no control over the flag status or test flag command placement.
------------------------------
equipment in this layout
Receiver
DVD Player
Cable Box
TV
Projector
Media Center
------------------------------
ok so lets say i want to watch cable on the tv, now the flag systems i have seen in many remote/automation systems work like this. each device i assign to a flag. when the watch cable macro goes off this is kinda whats happens. this is kinda of a sample of the macro structure i use when controling the system. current flag state is in blue.
------------------------------
flag tv is down
Flag "TV"
|> If "tv" flag is up | Do Nothing
\do nothing
|> If "tv flag is down | Fire off "tv on" ir code
\set "tv" flag up
TV IS ON
flag projector is down
Flag "Projector"
|> if "projector" flag is up | Fire off "projector off" ir code
\set "projector" flag down
|> if "projector" flag is down | do nothing
\do nothing
PROJECTOR IS OFF
flag cable box is down
Flag "Cable Box"
|> if "cable box" flag is up | Do Nothing
\do nothing
|> if "cable box" flag is down | Fire off "cable box on" ir code
\set "cable box" flag up
CABLE BOX IS ON
flag dvd player is down
Flag "DVD Player"
|> if "dvd player" flag is up | Fire off "cable box on" ir code
\set "cable box" flag down
|> if "dvd player" flag is down | Do Nothing
\do nothing
DVD PLAYER IS OFF
flag media center is down
Flag "Media Center"
|> if "media center" flag is up | Fire off "media center off" ir code
\set "media center" flag down
|> if "media center" flag is down | Do Nothing
\do nothing
MEDIA CENTER IS OFF
flag receiver is down
Flag "Receiver"
|> if "receiver" flag is up | Do Nothing
\do nothing
|> if "receiver" flag is down | Fire off "cable box on" ir code
\set "receiver" flag up
RECEIVER IS ON
|> Time Delay 3.0 Secs
|>Fire off "receiver cable box input" ir code
-------------------------------
now, from what you said about the eg.globals, it is not as simple as disabling and enable certain macros, there are to many to list. in this case, what would happen if i wanted to watch my media center on the projector. in the case of the flags it looks at each flag can compairs them to a predetermined state and changes them to match and also changes the flag status to match, or if the condition is what is specified it does nothing. here is an example if i said lets watch the media center on the projector. current flag state is in blue
-------------------------------
flag tv is up
since tv was on, it will see that and turn the tv off
Flag "TV"
|> If "tv" flag is up | Fire off "tv off" ir code
\set "tv" flag down
|> If "tv flag is down | Do Nothing
\do nothing
TV IS OFF
flag projector is down
since projector was off, it will see that and turn the projector on
Flag "Projector"
|> if "projector" flag is up | Do nothing
\do nothing
|> if "projector" flag is down | Fire off "projector on" ir code
\set "projector" flag up
PROJECTOR IS ON
flag cable box is up
since cable box was on, it will see that and turn the cable box off
Flag "Cable Box"
|> if "cable box" flag is up | Fire off "cable box off" ir code
\set "cable box" flag down
|> if "cable box" flag is down | Do nothing
\do nothing
CABLE BOX IS OFF
flag dvd player is down
since the dvd player was off, it will see that and do nothing
Flag "DVD Player"
|> if "dvd player" flag is up | Fire off "cable box on" ir code
\set "cable box" flag down
|> if "dvd player" flag is down | Do Nothing
\do nothing
DVD PLAYER IS OFF
flag media center is down
since media center was off, it will see that and turn the media center on
Flag "Media Center"
|> if "media center" flag is up | Do nothing
\do nothing
|> if "media center" flag is down | Fire off "media center on" ir code
\set "media center" flag up
MEDIA CENTER IS ON
flag receiver is up
since the receiver was on, it will see that and do nothing
Flag "Receiver"
|> if "receiver" flag is up | Do Nothing
\do nothing
|> if "receiver" flag is down | Fire off "cable box on" ir code
\set "receiver" flag up
RECEIVER IS ON
|> Time Delay 3.0 Secs
|>Fire off "receiver media center input" ir code
-------------------------------
that in a nut shell is how the flag system on most good programable remotes are, including logitech except user has no control over the flag status or test flag command placement.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: is there a way to have flag's?
Just an idea...
Why not use eg.PersistentData?
Imagine that you build a class that handles all your flags
The good (or bad) thing doing this way is that current statuses are preserved also if you need to restart EG or your computer. To access the flags from anywhere else in your code you can do like this
To get the current status of the TV
To set the current status of the cable
and so on
Best regards
Edit: I would put this into a "flag-handling" plugin that captures and filters events and updates the status flags. For each flag you could add actions to set/read them. If its not necessary to keep the plugin generic you could instead add your specific functions to control your devices directly from the plugin instead of having a pile of macros. Its a design consideration depending on personal taste
Why not use eg.PersistentData?
Imagine that you build a class that handles all your flags
Code: Select all
class RemoteFlags(eg.PersistentData):
#False is OFF, True is ON (Using Booleans in this example)
bFlag_tv = False
bFlag_projector = False
bFlag_cablebox = False
#etc
To get the current status of the TV
Code: Select all
currentTV_status = RemoteFlags.bFlag_tv
Code: Select all
RemoteFlags.bFlag_cablebox = currentCableBox_status
Best regards
Edit: I would put this into a "flag-handling" plugin that captures and filters events and updates the status flags. For each flag you could add actions to set/read them. If its not necessary to keep the plugin generic you could instead add your specific functions to control your devices directly from the plugin instead of having a pile of macros. Its a design consideration depending on personal taste
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: is there a way to have flag's?
Here is an example how i would do it.SlipStream wrote:that wont work, there are to many variables, here is a very good example...
------------------------------
equipment in this layout
Receiver
DVD Player
Cable Box
TV
Projector
Media Center
------------------------------
ok so lets say i want to watch cable on the tv, ...