dynamic tag router

Francisco Colasanto's icon

Hi friends, I'm trying to implement a router that routes a list according to different unknown numbers (tags) but if one of those tags repeats then the content of that list uses the already created outlet. Let me give an example:

Lets say that I have an object called "tagrouter" and I specify that tagrouter has 8 outputs. So if I send the message "12 tito fuu toto" the list after 12 goes trough the first outlet, then I send "233 rata rio roca" and this new list goes trough second outlet...
This goes like this until I reach the 8th outlet, BUT if i send a list that uses one of the previous tags, that list will go trough the outlet assigned to that tag (so "12 pepe loco malo" will go trough first outlet)
(I know that I could do this using regular route but in this case I don't know the tags I will have)
So I need an object that sends to the same outlets those lists that have the same tag (but I dont know that tag)

I don't know if I explain this very well but hopefully somebody could solve this (probably using Javascript ?)

Many thanks

Francisco

Roman Thilenius's icon

i would base it around [route 1 2 3 4 5 6 7 8] - the other half of the algorithm will map incoming indexes to 1 - 8.

Francisco Colasanto's icon

Thanks Roman, but I don't understand you answer. If I use [route 1 2 3 4 5 6 7 8] the first tag must be 1 for example...but I don't know if will be that number or any other.

double_UG's icon

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

Francisco Colasanto's icon

Thanks !! DOUBLE_UG. It works !!