Dumb Question

Apr 28, 2006 at 12:36am

Dumb Question

Hello everyone,

I’m stuck on something that I really can’t get my head round. How do you make toggles that when one is pressed the other turns off and vice versa.

This sounds really dopey, but in the patch below when the patcher is loaded and you click toggle 2 on/off (doesn’t affect the other switch). It works fine. Then when you click that same one on again and then lick toggle 1 it turns toggle 2 off. When you click 2 off, then on again 1 comes on aswell, hope do you stop it?

I think it needs to work like a two switch light circuit, with two switches in paralell, but how do you make that in Max?

Any help would be grately appreciated,

Jay

max v2;
#N vpatcher 5 40 605 440;
#P window setfont “Sans Serif” 9.;
#P newex 261 137 28 9109513 sel 1;
#P newex 60 163 28 9109513 sel 1;
#P number 186 154 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 149 154 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 180 61 15 0;
#P toggle 124 60 15 0;
#P window linecount 6;
#P comment 316 93 199 9109513 When the patcher is loaded click toggle 2 on/off. It works fine. Then click that same one on again. Now lick the toggle 1 and it turns toggle 2 off. Click 2 off , then on again and 1 comes on aswell , then it does crazy things. how do you stop it?;
#P window linecount 1;
#P comment 196 55 100 9109513 2;
#P comment 108 55 100 9109513 1;
#P connect 3 0 7 0;
#P connect 8 0 3 0;
#P connect 3 0 5 0;
#P connect 7 0 4 0;
#P connect 4 0 6 0;
#P pop;

#25687
Apr 28, 2006 at 12:55am

Here’s one way…

max v2;
#N vpatcher 10 59 782 726;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 388 270 100 196617 parallel , reversed;
#P newex 302 282 23 196617 abs;
#P newex 302 259 27 196617 – 1;
#P number 324 330 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 287 330 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 369 239 15 0;
#P toggle 287 238 15 0;
#P number 77 331 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 40 331 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 77 238 15 0;
#P toggle 40 239 15 0;
#P newex 215 119 28 196617 sel 1;
#P newex 14 145 28 196617 sel 1;
#P number 140 136 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 103 136 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 134 43 15 0;
#P toggle 78 42 15 0;
#P comment 271 72 100 196617 original;
#P comment 140 270 100 196617 parallel , matching;
#P connect 2 0 6 0;
#P connect 8 0 10 0;
#P connect 8 0 9 0;
#P connect 9 0 11 0;
#P connect 7 0 2 0;
#P connect 2 0 4 0;
#P connect 6 0 3 0;
#P connect 3 0 5 0;
#P connect 12 0 14 0;
#P connect 12 0 16 0;
#P connect 16 0 17 0;
#P connect 13 0 15 0;
#P connect 17 0 13 0;
#P pop;

Eric Honour

——————-
Associate Professor of Music
Composition and Music Technology
Central Missouri State University

#75886
Apr 28, 2006 at 12:58am

This’ll do it.

wes

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 174 172 62 196617 prepend set;
#P newex 291 165 62 196617 prepend set;
#P newex 291 144 27 196617 !- 1;
#P newex 174 151 27 196617 !- 1;
#P number 275 225 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 160 222 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 275 118 15 0;
#P toggle 160 120 15 0;
#P connect 4 0 7 0;
#P connect 4 0 3 0;
#P connect 1 0 3 0;
#P fasten 1 0 5 0 280 138 296 138;
#P connect 5 0 2 0;
#P connect 5 0 6 0;
#P connect 0 0 2 0;
#P fasten 0 0 4 0 165 143 179 143;
#P connect 6 0 0 0;
#P connect 7 0 1 0;
#P window clipboard copycount 8;

#75887
Apr 28, 2006 at 1:25am

Sorry… after re-reading the post, I realized you wanted to be able
to click either toggle. The patch I posted won’t do that; the one
Wesley Smith posted will.

Eric Honour

——————-
Associate Professor of Music
Composition and Music Technology
Central Missouri State University

#75888
Apr 28, 2006 at 1:57am

Cheers guys!

#75889
Apr 28, 2006 at 4:46am

one more solution!

max v2;
#N vpatcher 1343 197 1943 597;
#P window setfont “Sans Serif” 9.;
#P comment 234 180 100 9109513 option a;
#P comment 235 198 100 9109513 option b;
#P number 258 245 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 258 223 27 9109513 !- 1;
#P number 216 245 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user radiogroup 216 181 18 32;
#X size 2;
#X offset 16;
#X inactive 0;
#X itemtype 0;
#X flagmode 0;
#X set 0;
#X done;
#P number 133 243 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 77 243 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 77 59 14 9109513 0;
#P newex 77 34 44 9109513 loadbang;
#P newex 95 211 27 9109513 !- 1;
#P toggle 133 197 15 0;
#P toggle 77 192 15 0;
#P comment 131 52 108 9109513 loand bang if you want!;
#P connect 4 0 5 0;
#P connect 5 0 1 0;
#P connect 1 0 6 0;
#P fasten 1 0 3 0 82 209 100 209;
#P fasten 3 0 2 0 100 233 125 233 125 194 138 194;
#P connect 2 0 7 0;
#P fasten 5 0 8 0 82 81 221 81;
#P connect 8 0 9 0;
#P fasten 8 0 10 0 221 218 263 218;
#P connect 10 0 11 0;

#75890
Apr 28, 2006 at 11:06am
#75891
Apr 28, 2006 at 7:27pm

or you could use radio buttons (what an anachronistic term!). But you want
to use two binary objects to create what is still a two-state system.
Unless you want to _see_ two checkboxes, then why not just use a single
checkbox?

#75892

You must be logged in to reply to this topic.