loadbang and pattr problems

    Feb 21 2013 | 7:08 pm
    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.
    cheers N

    • Feb 21 2013 | 7:38 pm
      Like this?
    • Feb 21 2013 | 8:11 pm
      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
    • Feb 21 2013 | 9:21 pm
      It works fine here, as MAX Instrument. (Life 8.2.2/MAX 6.08) Best
    • Feb 22 2013 | 12:44 pm
      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:
      Really appreciate your help.
    • Feb 22 2013 | 1:34 pm
      I tried using the idea of "script disconnect" here, but it doesnt seem to work, it only saves to the adv preset "sometimes"
    • Feb 22 2013 | 3:33 pm
      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 :( :( :(
    • Feb 22 2013 | 5:19 pm
      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
    • Feb 22 2013 | 8:55 pm
      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.