X10 Community Forum
💬General Category => General Discussion => Topic started by: birdzeye on July 31, 2009, 07:30:29 PM
-
I have read several posts on Flags and Tuicemen's Flags Basics and I still don't get it. What are Flags?
When you make a new Macro and go over to the righthand side and drag and drop Flags into your Macro, what do the 16 check boxes stand for? Are you supposed to have MADE the 16 flags somewhere else beforehand or what? Are they pre-made and if so, where do you find out what they mean? Like if you check off #5 and set it, what will happen?
-
basically its sort of a condition. Inside of a macro if you set a flag (example: flag2 on) than you can use that as a condition in a different macro to see if it should run or not.
you could look at flags like little switches. if you set the switch (flag) on or off then that switch (flag)can be used as a condition for macros and such.
If you have a macro that sets flag 2 and starts video recording, you can have another macro look to see if flag2 is set and if it is set then that macro won't run.
but if you set the flag 2 and then video recording, delay 30 sec, clear flag 2 then your other macro would see that flag 2 was set and not do anything, then if the macro is done running after 30 sec then your macro would see that flag 2 is clear and it can go ahead and run.
hope I didn't confuse you. ;)
-
birdzeye,
Think of a flag as a single bit memory location that can have one of two states, either "set" or "cleared".
You can use it in a macro to "remember" if something has happened or not.
Say you want macro "B" to do something, but only if macro "A" has been triggered.
Macro "A" would "set" a flag like maybe flag "2".
Then the next time macro "B" fired, it would check flag "2" in a condition and only continue if flag "2" is "set".
Sorry, couldn't come up with a decent "real world" example. :(
Looks like hawk1 did while I was typing this though. #:)
>!
-
hawk1 and Bill,
Hey thanks those were helpful posts--both good explanations. I think I understand now, though it really does sound totally complicated and somewhat maddening.
Can I get more info on actual working examples of this, showing how the separate macros would be constructed? In AHP Help, it said something about a Macro Library, but I'm not sure if this is still available or if it really was a "library". Is there a "library"?
-
hawk1 and Bill,
Hey thanks those were helpful posts--both good explanations. I think I understand now, though it really does sound totally complicated and somewhat maddening.
Can I get more info on actual working examples of this, showing how the separate macros would be constructed? In AHP Help, it said something about a Macro Library, but I'm not sure if this is still available or if it really was a "library". Is there a "library"?
Unfortunately, the macro library turned out to be "vaporware". ;) >*<
-
Macro 1:
trigger b2 motion sensor
check if flag 2 is off (condition)
set flag 2
cam2 on
start recording
delay 30 seconds
stop recording
clear flag 2
Macro 2:
trigger b3 motion sensor
check if flag 2 is off (condition)
set flag 2
cam3 on
start recording
delay 30 seconds
stop recording
clear flag 2
Description: When macro 1 is triggered by b2 it checks the condition of flag2, if it is on macro 1 won't do anything since the condition of flag 2 is set. Basically in the macros above flag 2 set means that the system is recording.
If macro 1 is triggerd by b2 and flag 2 is cleared it will run, set flag 2 and record video for 30 seconds then stop and clear flag 2 so if trigger b3 fires it can record.
Same with macro 2, it will check the flag status and if macro 1 has set flag 2 macro 2 won't do anything, but if macro 1 isn't running then macro 2 will execute and record video.
You have 16 flags to play with. Like Bill said it's a good way to see if something or a macro was triggered or running. In the above example if macro one is already recording you wouldn't want to try to start another instance of recording. Flags keep that from happening.
That being said, they can get confusing and out of hand.
Hope I haven't confused you! ;)
-
Also check out the forum section User-Designed Working Macros (http://forums.x10.com/index.php?board=103.0) for examples.