Marxon

*Request* button_mode=OffOnly

3 posts in this topic

Hi TK,

would you please add also a "OffOnly" mode for buttons?
A way to start a ngr on button press and a other script on release would be just as helpfull.
Thank you very much!

Best regards
Marxon

Share this post


Link to post
Share on other sites

Hello Marxon

i hope i undersand your question right...

try this as OFF in .NGC

EVENT_BUTTON id=  1  type=CC  chn= 1 cc= 16  range=  127:0

and this as ON

EVENT_BUTTON id=  1  type=CC  chn= 1 cc= 16  range=  0:127

and to jump to .NGR section type this in .NGC:

EVENT_BUTTON id=1  type=Meta  meta=RunSection:21  button_mode=OnOnly

and make the corresponding section in .NGR

if ^section == 21

endif

i didn't test that, let me know if it helped...

Best Regards, Novski

Share this post


Link to post
Share on other sites

Hi Novski,

thanks for your suggestion!
Your inverted range get me on the right path.
Last night I did not come up with the idea.
This is working:
  

### BUTTON PRESS
EVENT_BUTTON id=1   hw_id=3 type=Meta  range=127:0   button_mode=OnOff   meta=runsection:1
### BUTTON RELEASE
EVENT_BUTTON id=2   hw_id=3 type=Meta  range=0:127   button_mode=OnOnly  meta=runsection:2

It allows to run two different scripts on button press and button release.

Until now i used a if/then statement in my .NGR script wich was probably not very CPU friendly.

### .NGC
EVENT_BUTTON id=1   hw_id=1 type=Meta  range=0:127   button_mode=OnOff  meta=runsection:1
### .NGR
if ^section == 1
	if (id)button:1 == 0
	    LOG "BUTTON RELEASE"
	else
	    LOG "BUTTON PRESS"
	endif
endif

 

Best regards
Marxon

Edited by Marxon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now