Circular Labs Forums  

Go Back   Circular Labs Forums > Mobius Discussion > Scripting

Thread Tools Search this Thread Display Modes
Old 08-23-2015, 12:59 PM
mguer mguer is offline
Junior Member
Join Date: Aug 2015
Location: Croatia
Posts: 24
Default Logical OR/AND? Multiple "if" conditions? Is there such a thing?

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:

!name _Overdub/Multiply/Undo

!sustain 500

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

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

    if sustainCount = 1        (<-- this needs to be changed)
        message Multiply (loop)
        wait loop
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.
Forgive my upside down English when it happens.
-- Guitar, Bass, Ableton Live, Guitar Rig 5, Line 6 FBV Express MKII

Last edited by mguer; 08-23-2015 at 01:10 PM.
Reply With Quote
Old 02-10-2017, 01:43 AM
stk stk is offline
Junior Member
Join Date: Feb 2017
Location: vic australia
Posts: 8

I know this is a super old thread but I'm going through and adding answers to what I can in the hope that someone will do the same for me

In the absence of more flexible logic, you could define the code you want to run for both instances in a procedure (aka function) and then call it from each if block.
That way while you still have to have two if blocks, you have only one block of main functionality to maintain.
Mobius 2.5, Windows 7 SP1 x64, Intel i7-4770 @ 3.4Ghz, 16gb RAM, RME Fireface 400, Reaper 5.xx.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 12:50 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.