Initial values in number boxes?
Hi folks,
I'm a new and very excited beginner with MAX - managing to make some useful things already even though I don't quite know what I'm doing yet. I have a super-newbie question: how do you specify initial values for a number box? Seems like if I put a number in as an argument, this is good for determining format (integer, real, etc.) but the value itself doesn't "stick", and we always start up with 0 (or 0.0).
What am I missing here? I imagine that there must be a simple way to do this, and expected to find "initialvalue" or something like that as an attribute. No?
Thanks in advance,
-mk
Related question: if one is delivering control signals via message boxes, is there a way to have those boxes "fire" and send their messages each time the patch starts up?
The magic object you are looking for is loadbang. This will send out a bang every time the patch loads. Using this you can initialise anything you like.
So you can initialise your number box by sending it a static integer number and force a message box to output it's contents as follows:

Note the use of the delay object if things need to be in a specific sequence. Also note that setting the contents of a message box can be done through the right inlet and cause it to display the message without generating any out put.
Double clicking a loadbang will make it send out a bang on demand so that you can test what happens.
There is also a loadmess object that will send out the specific message in its argument when the patch loads instead of just a bang.
That is indeed a magic object! Very exciting. Thank you!
1. max is not flowstone. :)
2. the only GUI object which allows to be initialised by arguments is [bpatcher]
3. external "loadbang" initialisation is not only better readable, it also allows you control the order (which is sometimes required)
4. loadbang is a great start for making abstractions better than loadbang or loadmess.
https://cycling74.com/forums/feature-request-loadbang-delay-argument/replies/1#reply-58ed2071b7244922ce260190
Perhaps I am misunderstanding your question in its level of detail, but... when I want to set a range for a number box outside of which values won't be sent or to specify initial values when my patch is opened, I use the float or int number box's Inspector. It works like this:
select the number box whose behavior you want to change
click on the Inspector icon on the right-hand side of the patcher window
(the Inspector opens up at the right-hand side of your patcher window)scroll to the very bottom where you'll see minimum rand maximum entries.
click in either column to the right of the label and type in the min/max. (your number box now won't scroll outside of those ranges)
to set an initial value, find the listing for Parameter Mode Enable under the Parameter tab. Click in the checkbox. (a bunch of "new" Inspector entries will appear)
scroll down. you should see an Initial Enable and Initial Value.
click to check the Initial Enable box, and then click to the right of the Initial Value area and type in the initial value you want. (if the number box you've selected already is set to a value, that will show up. you can change if to anything you want).
that's it. your float or int number box wil have a range and an initial value the next time you open your patch.
again, I hope you'll forgive me if you've asked a much more complex questioni, but you described yourself as a beginner. that's how I still do it. :-)
Hi Max,
No, you didn't misunderstand my question. I am enough of a beginner that it took me awhile to realize why I never saw the Initial Enable or Initial Value boxes - I didn't have Parameter Mode enabled. Now that I do, that is a great thing to know! So thanks!
-mk
I did the setting in the inspector but when I open a Live set where the device is already in, the number boxes are not set with their initial value.
Thanks.
f.