Using a string as a trigger

Hello,
Does anyone know how to use a string as a trigger?
I have 3 unique strings that I will send into TouchDesigner through my Serial Dat.

20499975
BA9B9C75
70D5E716

I would like to use each one to to trigger a separate event.

Thanks

In the receive callback, in the attached DAT, under the Serial DAT, print out the message argument, to see it in the textport and make sure its what you expect.
If so, you can perform a different action based on its value:

derivative.ca/wiki088/index. … lDAT_Class

def receive(dat, rowIndex, message, bytes):
    print(message)
    if (message == '20499975'):
        #some action...
    if (message == 'BA9B9C75'):
        #some action...
    return

This assumes those strings are terminated with a newline or null character.
If they’re terminated with a carriage return only, use build 31860 or later, in the experimental download section:

derivative.ca/088/Downloads/Experimental.asp

Thanks Rob!

I can now identify these data states, and I want it to be responsible for triggering an image for each channel it reads

Uploading: 51667987633_.pic.jpg…