All about (thispatcher) scripting
I'm trying to up my skills with regards to scripting in max (thispatcher scripting that is).
For some reason I feel that the help patch and reference page for thispatcher is not complete.
For instance, I came to realize that there is a message "script replace" that is not listed anywhere, and I am having difficulty really understand how to accomplish some things like change the color of an object. Regarding the latter, it puzzles me that if I send "script sendbox varname color 0. 0. 1. 1." not only max complains that there are extra arguments but it will also paint it white instead of blue.
Any help, good references, or otherwise words of encouragement are greatly appreciated.
OCH
You are going to do some Max archeology here... For border color try "script sendbox varname bordercolor 0. 0. 1. 1."
Thx @KLSDIZ but that doesn't do anything.
Hi @👽R∆J∆ THE RESIDENT ∆LIEN👽
yes, varname is the scripting name for the object in question.
For the time being, and to avoid further confusion let's assume then that I am referring to my coll object, whose scripting name is colly, and I want to change the Border Color.
There IS a color attribute, it is the attribute name for Border Color.
Have you tried it out? sending "script sendbox colly color 1. 0. 0. 1." to this patcher will change it to light brown (?) and not red! It seem as if it is expecting only one number between 1 and 16... I would really like to set rgb colors.
Also I am not expecting to see any info regarding the scripting types of messages in the middle of attributes and inspector documentation. "Script replace" afaik is completely absent from documentation. I wonder what other scripting messages are absent too and if there is a place where one could REALLY learn more about scripting messages.
Hey @KLSDIZ
I opened your patch, which contains what you suggested before, but it doesn't change the color.
Does it work for you?
I'm on Mac OSX 15.3 Max 8.1.2. Would you mind sharing your setup here?
Ok, I see the problem.
It seems that you need first set legacy numbered color (to anything) via "color" attribute, and then you can change proper color using "bordercolor" attribute. This is either a bug or a workaround for some backward compatible behavior.
what in the world... you nailed it!
Thank you very much for that one.
I would love to learn these quirks.
If you could direct me to some good spots for Max archeology, I'd greatly appreciate it :)
Several months ago I had a scripting problem with initiating an object with a couple parameters, one of which needed to be inside quotes. (It was probably just a matter of finding the correct way to escape characters?) I can't find that example now, though. Have you dealt with things like these?
Again, thank you very much.
in old times you just exported a patch with the object in question as textfile - then you knew how to script-create it.
a good resource for object scripting doesnt exist i think.
Just saw this in the release notes for 8.1.3:
object box: color attribute works as expected
though, it is taking like an hour to download the update... I don't know if it is on a slower server than usual, or if there is just too many people at home (cough cough) hogging my supposedly gigabit connection.
Yup, they fixed it!
(Thanks Cycling74)
now, about the thispatcher scripting messages thorough documentation... :D ?
"to this patcher will change it to light brown (?) and not red"
yes, because thispatcher scripting is a max v4 leftover, and this kind of "color" you can script with it is one of the 16 "boxcolors" you had in max 4, which has nothing to do with the "styles" based things you can set for an object, but is still present behind the scenes.
however, it nevertheless has been enhanced and now supports things like 32 bit color (unless there are bugs about that ;) ) and, as you can see in the helpfile, allows you to use @attributes when creating new objects.
in the max v7 reference the object-releated scripting messages are more or less the same as 20 years ago - not sure about max 8.
like someone said, they mostly do it with javascript now. not my taste, but probably works.
"it is one of the 16 "boxcolors" you had in max 4" I was not even born at that time!
Jk I probably was, but I only became aware of max and started using it by the end of max 5.
I wouldn't mind joining Cycling74 for the summer just to work on this and help create new documentation for it... (*wink wink* @Cycling74) :D
while is it faster than using js, thispatcher is getting awkward when you want to script hundreds of connections. it is also not very funny to have hundreds of objects using a scripting name in a patch.
scripting can be very clever in a compiled app (and yes it works there too) but during programming i my opinion snippets are a good alternative to thispatcher scripting since max v6.
and dont forget that you can combine snippets, prototypes, javascript and thispatcher-scripting in your personal workflow to get the best out of every world.
just linking to a nice related thread: https://cycling74.com/forums/dynamically-creating-an-deleting-max-objects/