You will find the Console window on the right of any patcher, 4th from the top with the icon:
The print object has only one function; writting things into the Max console window. The main reason for this is to see what data is coming through Max cables.
1 . Start a new patcher
2 . Add a number box
3 . Add a new object box underneath and type print
and connect the two.
4 . Open the Max Console window and see what happens when you change the number box.
5 . Now add a slider
on top of the number box, lock the patcher and drag the slider up/down. Do you see the console?
You might remember using the select
object in the key example from Les 1.
select is the same as an If-statement. The only difference is in the output.
If the data-in matches the specified number then the output is a bang.
If-statements are more elaborate versions of the select object. You can make very specific If’s which you can’t do with select.
If statements can be found in every programming language, and in general the behave very similar to each other. Booleans are the conditions that an If-statement uses.
You can compare that two things are equal to each other:
This typical If-statement:
IF
thisIS EQUAL TO
thatTHEN
do thisELSE
do that
Becomes this with the boolean operator ==
:
IF
this==
thatTHEN
do thisELSE
do that
Then you add the values:
IF
$i1==
5THEN
1ELSE
0
$i1 is of course the input to the object. This should be a stream of numbers, and if it becomes 5 then it triggers 1 else it is sending 0 everytime the operation is triggered.
select
object with the if-statement
Other Booleans can be:
IS NOT EQUAL !=
IS GREATER THAN >
IS GREATER OR EQUAL THAN >=
IS LESS THAN <
IS LESS OR EQUAL THAN <=
Other Boolean Operations:
AND &&
OR ||
Complete the following example and fix the If Statements by using 3 different keys from your keyboard to start each of the 3 videos.
We will use th keys for 1, 2, 3 and space bar. When I look at the key
help file and I press these keys I see that these keys are numbered: 49, 50, 51 and 32.
if $i1 == 51 then 3
This should send a 3 when the key 3 is pressed. If you connect that to your Playlist then video 3 should play.