Bedspread Posted February 4, 2010 Share Posted February 4, 2010 In the C4 programming "language" there is the ability to trigger events based on the change of a variables state."WHEN X CHANGES" DO THE FOLLOWING.I use this very often and it is very much like a macro or subroutine in other programming languages.My suggestion is to add the ability to run these subroutines without having to change the state of the variable but simply to EXECUTE the code even if the variable did not change state.For example:One thing that I do often is to set up a boolean variable as a flag and then when the flag changes from TRUE to FALSE or FALSE to TRUE, trigger certain events (useful for LED color changes that signify conditions and useful for many other things)Variable: STATUS_CHECKWHEN STATUS_CHECK changes:IF STATUS_CHECK is TRUE DO A, B, C, D, E, FIF STATUS_CHECK is FALSE DO I, J, K, L, M, NI would like to have the ability to execute these types of subroutines even if the STATUS_CHECK variable has not changed state. It would be something like: EXECUTE STATUS_CHECK Link to comment Share on other sites More sharing options...
henniae Posted February 4, 2010 Share Posted February 4, 2010 Good things come to those who wait. Link to comment Share on other sites More sharing options...
ILoveC4 Posted February 4, 2010 Share Posted February 4, 2010 How long do they have to wait? Link to comment Share on other sites More sharing options...
RyanE Posted February 4, 2010 Share Posted February 4, 2010 You can do this now, if you just use a different boolean variable as a trigger.So, put the code that checks Variable X into a 'When Variable Y' changes, and in the 'When Variable X Changes' event, toggle Variable Y.Then, if you want to manually trigger it, toggle Variable Y.Somewhat convoluted, but it'd work fine.RyanE Link to comment Share on other sites More sharing options...
CFUG Posted February 4, 2010 Share Posted February 4, 2010 In the C4 programming "language" there is the ability to trigger events based on the change of a variables state."WHEN X CHANGES" DO THE FOLLOWING.I use this very often and it is very much like a macro or subroutine in other programming languages.My suggestion is to add the ability to run these subroutines without having to change the state of the variable but simply to EXECUTE the code even if the variable did not change state.For example:One thing that I do often is to set up a boolean variable as a flag and then when the flag changes from TRUE to FALSE or FALSE to TRUE, trigger certain events (useful for LED color changes that signify conditions and useful for many other things)Variable: STATUS_CHECKWHEN STATUS_CHECK changes:IF STATUS_CHECK is TRUE DO A, B, C, D, E, FIF STATUS_CHECK is FALSE DO I, J, K, L, M, NI would like to have the ability to execute these types of subroutines even if the STATUS_CHECK variable has not changed state. It would be something like: EXECUTE STATUS_CHECKI totally would use this. I have some strange side-effect from 1.8 that likes to randomly change the LED color state even if he load state did not change. What he is describing would band-aid this. Link to comment Share on other sites More sharing options...
henniae Posted February 4, 2010 Share Posted February 4, 2010 How long do they have to wait?Until it is done. Couldn't reseist. Link to comment Share on other sites More sharing options...
Bedspread Posted February 4, 2010 Author Share Posted February 4, 2010 How long do they have to wait?Until it is done. Couldn't reseist. Now that gives me hope. Thanks!!!!!!! Link to comment Share on other sites More sharing options...
Bedspread Posted February 4, 2010 Author Share Posted February 4, 2010 You can do this now, if you just use a different boolean variable as a trigger.So, put the code that checks Variable X into a 'When Variable Y' changes, and in the 'When Variable X Changes' event, toggle Variable Y.Then, if you want to manually trigger it, toggle Variable Y.Somewhat convoluted, but it'd work fine.RyanEVery true but I'm of the school that code should be efficient and that the most brief, minimal code is best. The least amount of code and logic necessary to do a job is always the best code.So your suggestion is:When Y changes IF X is TRUE DO A, B, C, D, E IF X is FALSE DO I, J, K, L, MNow there is more code necessary to determine if it is time to manually change the state of Y so that the code under X can be executed. As you say it is convoluted and as the project grows in complexity and size this approach really increases the amount of code necessary.Someone above hinted that the EXECUTE command may be in our future. I hope that it's true. Link to comment Share on other sites More sharing options...
RyanE Posted February 4, 2010 Share Posted February 4, 2010 Yes, two lines of code.So keep this:When Y changes IF X is TRUE DO A, B, C, D, E IF X is FALSE DO I, J, K, L, MAnd add this:When X changes Toggle YI haven't heard of an 'Execute' command (other than the existing 'Execute' button in Composer), so I wouldn't hold your breath.RyanE Link to comment Share on other sites More sharing options...
Bedspread Posted February 4, 2010 Author Share Posted February 4, 2010 Yes, two lines of code.So keep this:When Y changes IF X is TRUE DO A, B, C, D, E IF X is FALSE DO I, J, K, L, MAnd add this:When X changes Toggle YI haven't heard of an 'Execute' command (other than the existing 'Execute' button in Composer), so I wouldn't hold your breath.RyanEOk. I'll keep breathing. No big deal...Thanks for your input. Link to comment Share on other sites More sharing options...
shaneoneill Posted February 8, 2010 Share Posted February 8, 2010 sorry if this is redundant, but i would like the ELSE command added. testing for TRUE and FALSE does accomplish the same thing but its more verbose and ELSE can handle more and reduces the need for another IF COMMAND.IF X IS TRUE DO COMMANDA ELSE DO COMMANDB Link to comment Share on other sites More sharing options...
dinosaur Posted February 8, 2010 Share Posted February 8, 2010 sorry if this is redundant, but i would like the ELSE command added. testing for TRUE and FALSE does accomplish the same thing but its more verbose and ELSE can handle more and reduces the need for another IF COMMAND.IF X IS TRUE DO COMMANDA ELSE DO COMMANDBYou can create your own ELSE construct if you use a variable. Boolean Variable: MYELSESet MYELSE = TRUEIF X DO <abcdef> Set MYELSE = FALSEIF MYELSE = TRUE DO <defghi> Link to comment Share on other sites More sharing options...
dgbrown Posted February 8, 2010 Share Posted February 8, 2010 ^ naaahh ... I'd rather use card punch or wiring boards Link to comment Share on other sites More sharing options...
henniae Posted February 8, 2010 Share Posted February 8, 2010 ^ naaahh ... I'd rather use card punch or wiring boards I can probably dig up a wire wrap tool from my archive. Link to comment Share on other sites More sharing options...
dinosaur Posted February 9, 2010 Share Posted February 9, 2010 ^ naaahh ... I'd rather use card punch or wiring boards I can probably dig up a wire wrap tool from my archive. I've got a few boxes of 80 column Hollerith Cards for sale. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.