Forums > MaxMSP

pattrstorage and the matrixctrl…. How do i recall correct values?

March 16, 2008 | 12:51 pm

I’m trying to recall only the cells that have the value of one using pattrstorage.

However, when I recall the settings via pattrstorage it sets the last cell of the matrix to 1 and therefore recalls that as the value each time?

What gives?

max v2;
#N vpatcher 357 173 974 528;
#P window setfont "Sans Serif" 18.;
#P window linecount 3;
#P comment 270 142 320 196626 Currently pattrstorage makes the last cell (7 3) go from 1 to 0 very quickly???;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 193 177 37 196617 pipe 2;
#P number 93 319 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 57 319 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 193 218 30 196617 t b b;
#P newex 137 275 48 196617 pack 0 0;
#P newex 165 249 22 196617 v b;
#P newex 137 249 22 196617 v a;
#P newex 193 197 46 196617 select 1;
#P newex 137 154 67 196617 unpack 0 0 0;
#P message 137 320 50 196617 7 3;
#P newex 137 297 62 196617 prepend set;
#P newex 17 33 167 196617 pattr MatrixSettings MatrixObject;
#X prestore 96 0 0 0 0 0 1 0 0 2 0 0 3 0 1 0 0 1 1 0 1 2 1 1 3 0 2 0 0 2 1 0 2 2 0 2 3 0 3 0 0 3 1;
#X prestore 96 41 0 3 2 0 3 3 0 4 0 0 4 1 0 4 2 0 4 3 0 5 0 0 5 1 0 5 2 0 5 3 0 6 0 0 6 1 0 6 2 0 6;
#X prestore 96 82 3 0 7 0 0 7 1 0 7 2 0 7 3 0;
#P objectname MatrixSettings;
#P message 66 97 43 196617 store 2;
#P message 19 97 43 196617 store 1;
#P message 99 147 14 196617 2;
#P message 82 147 14 196617 1;
#P user matrixctrl 137 74 130 66 MatrixDefaultCell.pct MatrixDefaultBkgnd.pct 130 66 16 16 8 4 16 16 1 1 52 2 5120 0;
#P objectname MatrixObject;
#P newex 19 180 107 196617 pattrstorage Settings;
#X client_rect 24 74 664 314;
#X storage_rect 0 0 640 240;
#P objectname Settings;
#P window setfont "Sans Serif" 18.;
#P window linecount 2;
#P comment 270 87 320 196626 How can I get this to recall the cell which is at value 1 only?;
#P connect 3 0 1 0;
#P connect 4 0 1 0;
#P connect 5 0 1 0;
#P connect 6 0 1 0;
#P connect 10 0 16 0;
#P connect 10 1 17 0;
#P connect 2 0 10 0;
#P fasten 15 0 12 0 198 241 142 241;
#P connect 10 0 12 0;
#P connect 12 0 14 0;
#P connect 14 0 8 0;
#P connect 8 0 9 0;
#P fasten 15 1 13 0 218 245 170 245;
#P connect 10 1 13 0;
#P fasten 13 0 14 1 170 271 180 271;
#P connect 10 2 18 0;
#P connect 18 0 11 0;
#P connect 11 0 15 0;
#P pop;

Thanks,

Rhys


March 17, 2008 | 8:40 am

Rhys Perkins schrieb:
> I’m trying to recall only the cells that have the value of one using
> pattrstorage.
>
> However, when I recall the settings via pattrstorage it sets the last
> cell of the matrix to 1 and therefore recalls that as the value each
> time?

Just filter the others (three more objects…):

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 137 188 50 196617 zl rev;
#P newex 137 167 50 196617 route 1;
#P newex 137 146 50 196617 zl rev;
#P newex 193 232 37 196617 pipe 2;
#P number 93 319 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 57 319 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 193 273 30 196617 t b b;
#P newex 137 330 48 196617 pack 0 0;
#P newex 165 304 22 196617 v b;
#P newex 137 304 22 196617 v a;
#P newex 193 252 46 196617 select 1;
#P newex 137 209 67 196617 unpack 0 0 0;
#P message 137 375 50 196617 7 3;
#P newex 137 352 62 196617 prepend set;
#P newex 17 33 167 196617 pattr MatrixSettings MatrixObject;
#X prestore 96 0 0 0 0 0 1 0 0 2 0 0 3 0 1 0 0 1 1 0 1 2 1 1 3 0 2 0 0 2
1 0 2 2 0 2 3 0 3 0 0 3 1;
#X prestore 96 41 0 3 2 0 3 3 0 4 0 0 4 1 0 4 2 0 4 3 0 5 0 0 5 1 0 5 2
0 5 3 0 6 0 0 6 1 0 6 2 0 6;
#X prestore 96 82 3 0 7 0 0 7 1 0 7 2 0 7 3 0;
#P objectname MatrixSettings;
#P message 66 97 43 196617 store 2;
#P message 19 97 43 196617 store 1;
#P message 99 147 14 196617 2;
#P message 82 147 14 196617 1;
#P user matrixctrl 137 74 130 66 MatrixDefaultCell.pct
MatrixDefaultBkgnd.pct 130 66 16 16 8 4 16 16 1 1 52 2 5120 0;
#P objectname MatrixObject;
#P newex 19 180 107 196617 pattrstorage Settings;
#X client_rect 24 74 664 314;
#X storage_rect 0 0 640 240;
#P objectname Settings;
#P connect 20 0 9 0;
#P connect 19 0 20 0;
#P connect 18 0 19 0;
#P connect 1 0 18 0;
#P connect 9 1 16 0;
#P connect 9 1 12 0;
#P connect 9 0 15 0;
#P connect 9 0 11 0;
#P connect 10 0 14 0;
#P connect 17 0 10 0;
#P connect 9 2 17 0;
#P fasten 12 0 13 1 170 326 180 326;
#P fasten 14 1 12 0 218 300 170 300;
#P connect 7 0 8 0;
#P connect 13 0 7 0;
#P connect 11 0 13 0;
#P fasten 14 0 11 0 198 296 142 296;
#P connect 5 0 0 0;
#P connect 4 0 0 0;
#P connect 3 0 0 0;
#P connect 2 0 0 0;
#P window clipboard copycount 21;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


March 17, 2008 | 11:57 am

> #P comment 270 142 320 196626 Currently pattrstorage makes the last cell (7 3) go from 1 to 0 very quickly???;

No, this is not true (print). In your patch, after restoring, always the last index values (i.e. the size of the matrix) will be displayed because of pipe.

Stefan’s addition is the complete solution.

_
johan


March 17, 2008 | 12:33 pm

I didn’t realise that route would keep the whole list intact in this case. Very nice!

Thanks very much Stefan.

Rhys


Viewing 4 posts - 1 through 4 (of 4 total)