Words recognition or detect with bucket ?

GllmS.'s icon

I try to trigger an event depending on the words I type (with the key object)...

well I have two question :

1: In the patch I joint, why it work's only the 2th time I type the word "code" and not the first time ?

2: How can I have mutiple words (in a bank) and implement different words for different events ?

Thank you list !

Max Patch
Copy patch and select New From Clipboard in Max.

GllmS.'s icon

Ok !

I think I figure a more elegant way to do it...

but I still want to know how to change the word to detect dynamically with the regexpr object ???

Max Patch
Copy patch and select New From Clipboard in Max.

Bill 2's icon

1. From the documentation: "When a number is received, it is not sent out immediately, but the numbers stored in bucket are sent out. The numbers are all moved one outlet to the right, and the newly received number is stored in the left position. When using the "echo to output" mode (set with a non-zero second argument to the object) the number received is sent out immediately, instead of the previous input value."

2. Expressions make my head hurt, so I'd do it with a few "match" objects instead. I'm not sure whether you'd need to reset "bucket" every time a match is found, but maybe (I haven't thought it through) it'd allow you to detect words of different lengths...? "Bucket" would need to be the length of the longest word you want to detect.

Max Patch
Copy patch and select New From Clipboard in Max.

GllmS.'s icon

Thank you Bill ! it's obvious now...

So I decide to combine the second patch i have made with the "match" object instead of "regexp". This way, I can manage different words with a "set" message to the "match" object.

Bill 2's icon

Glad to accidentally help, Guillaume, especially since I hadn't even seen your 2nd post when I replied. ;-)

Cheers, Bill