Strange DAT to CHOP behavior

Hello!

I’ve tried to make simple password check in Field op, that trigger one sound if password is right and another sound if wrong. I used evaluate DAT with simple scripts:
“1 if ((op(‘password1’)[0,0] == op(‘rightPassword’)[0,0]) & (op(‘pressEnter’)[0,0] == 1)) else 0” and “1 if ((op(‘password1’)[0,0] != op(‘rightPassword’)[0,0]) & (op(‘pressEnter’)[0,0] == 1)) else 0”.
Then i convert DAT to CHOP to triggering sound.

When i put wrong password everything is OK and it’s triggering wrong sound, but when i put right password it triggering both wrong and right sounds. In DAT’s its looks like everything works correct, but If look at trail CHOP you can see, that it’s short pulse (1 sample) accruing in wrong CHOP’s and longer pulse accrues in right CHOP. Sure, i can filter out this short pulse, but i would like to realized why it happening and how to make it right…

I’ve also tried to use CHOP execute DAT, that start script when pressing “ENTER” button, but result is absolutely same. It doesn’t look like a bug because it also happening in both experimental and normal releases.

Please, check attached file.

Very appreciate any help! Thank you!
password_test.1.toe (5.87 KB)

The logic problem here is that pressing enter by itself will trigger the sound - which is why you’re getting a false positive when you enter a correct password.

Rather than using enter as your trigger you might instead use the focus attribute of the filed COMP - you can get this with a panel CHOP. That will change from 1 to 0 when you hit enter.

You could use that to trigger evaluating if the password is correct and then playing a sound.

Something like this:
base_password_test.tox (1.87 KB)

Thank you for reply! If i use focus attributes - right sound is triggering if i select\deselect field with mouse. I would like to make it check only after pressing enter button (and field focused). Moreover, nothing is happened, when you put wrong password…

If you’re after using the Enter key as the trigger here then you’ll want to use a keyboard in DAT. You’ll need to do a little python scripting to do all of your checks and logic, but it should be similar to what you’ve got here so far.

took a quick look.

Is this what you’re after:
base_password_test_enter_only.tox (2.21 KB)

that .tox does’t opening =(

huh. Try this one?
base_password_test_enter_only.tox (1.83 KB)

It works, thank you! Didn’t know about callback DAT’s…