Forums > MaxMSP

where do I use this script?

August 11, 2009 | 9:32 am

I found this script to show how to calculate mouse velocity but I don’t know how to turn this into a patch.

Can anyone help?

Best,

Cam

Here is a patch that shows how to calculate mouse velocity.

-Joshua

max v2;
#N vpatcher 10 59 438 444;
#P window setfont "Sans Serif" 9.;
#P newex 136 168 58 196617 !/ 1.;
#P newex 136 146 34 196617 timer;
#P flonum 136 190 61 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 136 124 58 196617 t b b f;
#P number 136 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 66 29 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 67 168 58 196617 !/ 1.;
#P newex 67 146 34 196617 timer;
#P comment 137 210 62 196617 y velocity (pixels per millisecond);
#P flonum 67 190 61 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 67 124 58 196617 t b b f;
#P number 67 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 25 28 15 0;
#P newex 25 51 51 196617 metro 20;
#P newex 25 79 66 196617 mousestate;
#P comment 67 210 62 196617 x velocity (pixels per millisecond);
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P connect 10 0 2 1;
#P connect 1 3 4 0;
#P connect 4 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 6 0;
#P connect 5 1 8 1;
#P connect 5 2 9 1;
#P fasten 1 4 11 0 86 99 141 99;
#P connect 11 0 12 0;
#P connect 12 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 13 0;
#P connect 12 1 14 1;
#P connect 12 2 15 1;
#P pop;


August 11, 2009 | 1:00 pm

That "script" is an patch!

Copy all script, including the "max v2;" line.

open max

File>new from clipboard

And there you go!

BTW, read this!
http://www.cycling74.com/forums/index.php?t=msg&th=38828&start=0&rid=3728&S=398fea90bd642f10a2cc5bca4f0dcd75


August 11, 2009 | 1:00 pm

You could use the mouse position output of the lcd object.


August 11, 2009 | 7:28 pm

you could use mousestate


August 12, 2009 | 7:21 am

The mouse state is inhibited by the size of the screen. What if I want it to be connected to the size of an external element?


August 12, 2009 | 3:28 pm

can you explain what you mean by an external element?


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