# Action Counter

Hi,

Is there a way to set up a sort of counter? As in, some way in which I can have an incoming action trigger an outcoming action the first time it enters the engine and have that same incoming action trigger a different outgoing action the second time it enters the engine. And then basically have it start at counter 1 once it passes all defined counters? Does that make sense?

Hi Karen,

Yes, however to give you a better idea of what you want, it would be helpful to know the outgoing actions you want to perform. You would set up a global variable to count the sequence number. Within rules, you add 1 until it reaches the desired maximum at which point you reset the counter to zero. Here is an example of sending different notes depending on the iteration of the counter. I could have easily used the same note and sent a different velocity value based on the iteration.

Incoming message: Note on note 60 on channel 1

Rules:

//increment counter

ga=ga+1

// If maximum is reached, set counter to 0

if ga > 10 then ga = 0

// Determine note value to send based on counter position

if ga==1 the pp = 60

if ga==2 then pp=61

… etc

Outgoing action Note on Channel 1 note pp velocity 127

Now if you want a completely different action on each iteration. Just set up a bunch of translators that monitor the same incoming message. You only increment the value on the first translator. Each translator monitors for the global variable and only fires its action if it belongs to that translator. So the first translator monitors for value of 1, the second value of two etc. The rules would look something like this:

// Rules for translator 1 monitors ga for value of 1

if ga!=1 then exit rules, skip outgoing action

// Rules for for second translator monitors ga for value of 2

if ga!=2 then exit rules, skip outgoing action

In this way each translator could have it’s own and distinct outgoing action.

I hope this helps.

Steve Caldwell

Bome Moderator and

Independent Bome Programming Consultant/Specialist

bome@sniz.biz

Hi Steve,