Logical OR/AND? Multiple "if" conditions? Is there such a thing?

dimanche 23 août 2015

Hi,
I'm working on a script that should enable me to Overdub, Multiply or Undo using the same button, depending on how long I keep it pressed.

Overdub (<500ms)
Multiply (500-1500ms)
Undo (@2000ms)

But in order to call Multiply in the mentioned interval and not just in 500ms window of time as it is now, I need to be able to say something like this:
if sustainCount = 1 OR sustainCount = 2

Here's the code:
Code:

!autoload

!name _Overdub/Multiply/Undo

!sustain 500

label sustain
    if sustainCount = 3
        message Undo (loop)
        wait loop
        Undo
    endif
end

label endSustain
    if sustainCount = 0
        message Overdub (loop)
        wait loop
        Overdub
    endif

    if sustainCount = 1        (<-- this needs to be changed)
        message Multiply (loop)
        wait loop
        Multiply
    endif
end

The exact way to achieve what I want is not that important. If there some other way to do it, please say it.

In general I'm interested in how to write more complex if statements involving OR/AND logical operators. The manual currently says nothing about it (if section is empty).

EDIT: I'm aware that I can duplicate the statement, first time for sustainCount=1 and second time for sustainCount=2 and say it to do the same thing (call Multiply), and it'll do for such a simple script, but it will soon become a bad practice when I go about writing some more complex scripts, so it's better that I know about it right away.


0 commentaires:

Enregistrer un commentaire

 

Lorem

Ipsum

Dolor