How do you input a variable message into node.script?

ygreq's icon

Hi folks!

I want to input a message into node.script and that message should trigger a different message based on the npm package it has and send it as Max.post.

For receiving a bang, I would have something like this
var maxMessage = Max.addHandler("bang", () => {};

So what should I put instead of "bang" if I am expecting any kind of message like, say, house, chair, light?

var maxMessage = Max.addHandler("SOMETHING HERE", () => {};

Any thoughts?
Thank you!
ygreq

ygreq's icon

Thank you for looking into it. It does not seem to work.

The message I get is: node.script: Unhandled Message: ["choose","WEIRDO!"]

which I believe is some kind of error message. Instead of: node.script: Sit down, BUDDY

ygreq's icon

My mistake! I forgot to change the name of the js file in the Max patch.
Thank you!!

For sure I have to figure out how to also send the message directly.