loadbang and pattr problems

Feb 21, 2013 at 7:08pm

loadbang and pattr problems

Im struggling with getting loadbang and pattr to work properly. I want to create a random value when the user opens the patch for the first time and then use the pattr to store this value, restoring it each time the patch is opened. The problem is that pattr keeps storing a new value every time the patch is opened (due to loadbang). Heres the code im using, would be grateful to find out of this is possible.

– Pasted Max Patch, click to expand. –

cheers N

#66636
Feb 21, 2013 at 7:38pm

Like this?

– Pasted Max Patch, click to expand. –

Best

#239841
Feb 21, 2013 at 8:11pm

Hi Helmuth, I would never have guessed to use this way of solving the problem. Thanks so much for your help. The only thing is tho, Im using it in m4l and when I try and copy the device, it just goes blank. Any idea why that might be? Cheers N

#239842
Feb 21, 2013 at 9:21pm

It works fine here, as MAX Instrument. (Life 8.2.2/MAX 6.08)
Best

#239843
Feb 22, 2013 at 12:44pm

Weird, must be that max crashed, because when I restarted I could copy it.

I wonder, could this idea be used with the following code? Im trying keep track of the last device id to compare with the current device id in m4l.

I store the two values in a coll (0, 1), which works fine, but when I try to save/restore the last device id in pattr as an adv preset, pattr doesnt work, because it seems to have already updated due to the loadbang. Its a never ending circle, like the above example.

Heres the code:

– Pasted Max Patch, click to expand. –

Really appreciate your help.

Cheers

N

#239844
Feb 22, 2013 at 1:34pm

I tried using the idea of “script disconnect” here, but it doesnt seem to work, it only saves to the adv preset “sometimes”

– Pasted Max Patch, click to expand. –
#239845
Feb 22, 2013 at 3:33pm

ive also tried this script, which seems identical to yours, but it doesnt seem to work :( it seems something strange happens at the point of loadbang that causes the script just to initialise, rather than recalling the saved values :( :( :(

– Pasted Max Patch, click to expand. –
#239846
Feb 22, 2013 at 5:19pm

Hi, your scripting names must be identical in the object as well as in the script (e.g. object 1 => scriptingname var1 , object 2 => scriptingname var2), so it must be

#239847
Feb 22, 2013 at 8:55pm

Hi Helmuth,

I owe you a few beers, youre disconnect solution totally solved this problem for me and taught me a few things in the process about pattr. It turned out coll was the problem, but I didnt realise disconnect would be so useful.

Thanks so much for spending the time to help me out.

N

#239848

You must be logged in to reply to this topic.