I’m messing about with a patch using the mousestate object and I am trying to figure out the best way to do this. What I want to do is be able to basically split the screen in 2, so when my mouse scrolls left and right past the halfway mark, it sends a bang. This bang will be sent to a gswitch2 so that when the mouse is in the left half of the screen the left outlet is being used and when it is on the right, it is the opposite. I have tried using ‘select’ with the values out of mousestate, but the values don’t update fast enough if i run my mouse across the screen at a fast pace only when i do it gently. I have the metro object set to 1 connected to mousestate so it is updating at 1 ms but this is not fast enough.
So basically what I am asking is, if anybody knows the best way to get ‘1’ bang when the mouse moves left and ‘1’ bang when mouse moves right of the half way mark. Preferably when the mouse is moved at fast and slow speeds.
Thanks for your help :)
you can send [mousestate] the message "poll" instead of banging it through [metro].
And instead of using [select] and trying to obtain an exact number, why don’t you use [>], detecting when the mouse x value goes above a certain number?
Will give that a go now :) have only been using max for a short while really, just doing a few things in Uni so still trying to get my head around it.
Some other objects you’ll want to investigate are [screensize], [unpack], and [change].
(Spoiler alert: Don’t look at the following example till you’ve tried solving it yourself.)
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 783.3ocyX1taaBCEF92jqBF+coYXH70j1j10wTUkC3l3Nvfvl1zU068YeLjP 1XstABsoJ0wNF6y4wu93iySKrb1Ttmvcr+p8OssrdZgkEzjpAq15VNE38o4X NzMmzxhBBS3rT+cBxdAzNuopplv410jJhfJnkLdWmXMETVNQ.i.pswaq2tQU 2ckaaKzLXjJ2b2UnjdOaYin6g655skLAm9aBLfdq52LCW.M67iZJNuaXpvhz cT11apIoBs+FqlYaOWn.gh00V4Zes5QddwB0+VNRrjhySaxwBhsXGwdGN+1G vOZWURO12yfNQWd5ffGzFEzVfFEd1xefJmBuA8YuA7vfilVszjEj5aHL7lbR e+7TuuaXzMIdrhn8DGmkx21W2MKLQePOfq6Ctrm2ZUgVknZ5rbbF4Ao+7uxh cX1VxKp.5Si0Cud6+xq2CBBP3oKNfj2jvnkN5sMAtiRVTHCXfOxgC3opLO2X oh+vvA8Vgy4gCTnh.qiaUIAx8JwSqVQ5TbBWHigXrdwcXjD7FQROsxfEigXQ fLJ1eT5m+Cw992LU7jLMZmwtaBEALILToelZZ7YSgQ76MLhRf8O5ib7CtDv3 K1FeFTz6MNR.QAxqWrkoFGe5JSoQ3GDZ3BmJGFrJT8Z8zijFVEN8W1t5+LMj avv3Y8TEwcLLqMTaxkHTadINaiLWFS4j2zHifobT5Hc.W2KAS3o0DBCbCSOv 14Eyn0TpjS4ffAJGCczoyDN7UhfAVNGr+9hivvoZ+TjwKapS6LwtzSrQGruL YxMTFVciwdcRdxrb+WWe1QyxHr949mQ4pqC.Lzcv0NSMmSmogsFUF3yj4Daf 4jbB.ujVimIvY1XCx.qIX1rlPCrlnYyZT9s2qXMgyltIv.1DNarIx.qI9CEa heE1TPyfeDo1PvHWHa4jnimzq97wIY51B5aRDA24KjvZSrm4KnfQAL8OqU20 H3J.G97qt5pOoFWUcOol2ZBfgKSi4txZU0vkPUJSWExMwolbOsq+vuwjCtVl nfPlkPSsNOh8wgNKTyyyK9CBMlAH -----------end_max5_patcher-----------
haven’t looked at your patch yet, but i used [screensize] and [unpack] so that when the patch is opened on any system, the max and min values will be set straight away so that my patch will work on whichever size screen. Instead of using the mid point of the screen as the crossover point, i instead used the extreme left and right values to send a bang to the [gswitch2]. Until i figure out a better way myself, this work around will do :)
Thanks again guys
Just after looking at your patch and seeing you already have the mid point method done ha.
I think i will use a combination of the 2 in my project.
Just curious…but what is the necessity of the [change] object? It seems to work perfectly well without it. What do you mean by "suppress repetitions"?
Also, it seems to work perfectly well without the [!] and [+] objects too!
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 650.3ocyV0taaBCE82vSgE+l0Yafrvj1j1ywzTkC3k3NvfvNsYqpu6ye.IzT SfjVQhhBV2q+3dtGe709YeufUU6nh.vWA+D348rummwk1gWqsWPIYWVAQXFV .m9T0pGBBscIo6jF2eFf67w2VVsUVPklIfZ8VSjYaX7022Pyj1.hihtKIDfT MvPPDVafg2AA+pcN1kQ92ZpcBALtZpc8xxMQVglOE0E6eWwkbRoY7A+ngQJ5 2if8OSOHrJf6AKi2gUr12K995OgSjOxpJKoJXcLgH1VW2PEBPCslJYRVEW3l gfCyPnkZjBvnE5FDZowpOE0iDPoeLr.5BXg0hmXJzOfF.ehLLJ1jSwPcyRXq R3DZffP0em4eRv93znxdIs4dJmrpf1mke2a3Cb.HaCgul5N+iFO+s6vIv2rA 6L+0mCBG93.J95oDJUZdxAhXO+TWUTb1UHZU7KhOTfP64DjiS53JVdX.0hJ+ ETgjHGPwjLJmrz9MZbASOwhyFmTF75ofFfx992Ne4i8vEJ0TEcwhK+BlzaNE zVdMI6O.n8mapI9DTSZeUT56PE4htRt4TOEUj7UpJzmuFxRTQVIzDpOahhKR AeyQJhrFJkaB3YeucZuJyKVNNsTvDFIio0YImOd5wDFUD4G+DWSBo8+ZNSTs sIqCvsG6AGxobUEaFmneJWuwnurs2f1vxyo79u3HmIzOBwjoPmadSENpiU.7 HvIZ1PSzDHGMAhlEzfmxV0XjSIKutRUTqUtfgeQekQh4KBu23PXlW3OaasGo oG.NIyGdlhVS+lk4BOvWoqGV6OSvYBryktYYqgRpqej1HZWRCPT2v7PUi1bQ nwjwsllULng9Hqa7w95U6E++CHvxF2F -----------end_max5_patcher-----------
Forums > MaxMSP