Trevliga Spel forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

diificulty to understand how to use the if then function

3 posters

Go down

diificulty to understand how to use the if then function Empty diificulty to understand how to use the if then function

Post by lionoil Sun Jan 28, 2024 11:57 am

I want to understand how to use the 'if' statement. Could I get some examples from the documentation page? I'm not quite clear on how to apply it.
For example, where I might use 'if':

Code:
[(@StkTrkRc:2-12){state:0}{cc:15,71,0}]


In their example, I envision being able to use:

Code:
[(#IF((@StkTrkRc >= 2) & (@StkTrkRc <= 12)#){state:0}{cc:15,71,0}]


Also, if I add:

Code:
[(@StkTrkRc:0){state:0}{cc:15,71,0}]
[(@StkTrkRc:2-12){state:0}{cc:15,71,0}]


Something like:

Code:
[(#IF(@StkTrkRc NOT 1)#){state:0}{cc:15,71,0}]


I know this isn't correct, as I've read that it requires another variable to assist:


Code:
{@l_v:MAX(@e_ccvalue, 64)}{text:#MIN(@l_v, 25)#}


That's why I'm asking if it would be possible to have some more examples on how to use them.
Thanks ! Very Happy

lionoil

Posts : 43
Join date : 2022-03-03

Back to top Go down

diificulty to understand how to use the if then function Empty Re: diificulty to understand how to use the if then function

Post by Admin Sun Jan 28, 2024 12:41 pm

I haven't looked at the IF statements since they are only a "side effect" of being a part of the math library I use to perform basic math calculations. Smile

Without having looked into the details, I think the IF statements you describe in principle have the correct syntax, but IF statements cannot be used the way you describe since expressions of any kind (enclosed by # characters) can only be used in actions, not in events. Sad
Admin
Admin
Admin

Posts : 965
Join date : 2020-03-26

https://trevligaspel.forumotion.eu

Back to top Go down

diificulty to understand how to use the if then function Empty Re: diificulty to understand how to use the if then function

Post by lionoil Mon Jan 29, 2024 10:20 am

Thanks for the clarification!  Very Happy

lionoil

Posts : 43
Join date : 2022-03-03

Back to top Go down

diificulty to understand how to use the if then function Empty Re: diificulty to understand how to use the if then function

Post by jacquesmk2 Tue Jan 30, 2024 10:20 pm

Hi.
Could this if/then function be used to trigger actions when receiving a specific Mackie signal ?
In other words, can we link incoming midi to outcoming actions ?
Is there any link to some documentation ?
Is this function related to the deep-linking topic ?

Thank you

jacquesmk2

Posts : 17
Join date : 2024-01-17

Back to top Go down

diificulty to understand how to use the if then function Empty Re: diificulty to understand how to use the if then function

Post by Admin Tue Jan 30, 2024 11:03 pm

I get a feeling you are overcomplicating things a bit. You don’t need if/then functions for most things since the script syntax is in itself a form of if/then. If this happens (the event), then do this (the action).

And yes, you can link incoming midi to outgoing actions; that is one of the main functions for scripts.

And no, it has nothing to do with deep linking.

If you, e.g., want to catch the Mackie Play command and send some CC when that occurs, you can do like this:

[(noteon:1,94, 127){cc:1,1,100}]

Syntax and examples are in the documentation; I don’t know if you are asking for something other than that.
Admin
Admin
Admin

Posts : 965
Join date : 2020-03-26

https://trevligaspel.forumotion.eu

Back to top Go down

diificulty to understand how to use the if then function Empty Re: diificulty to understand how to use the if then function

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum