Peg Scripting help

I was hoping to create a script that grabs the Peg and changes the peg colour and then locks it. I have a LOT of this to do and doing it by hand would be an insane waste of time. I can’t seem to find the attribute in the peg options that helps me even know what the attributes to change the colour and lock attributes in the Peg layer properties are.

ie…

module type=“PEG” name=“Peg-Position-Separate” pos=“0,0,0”
options
version val=“1”
collapsed val=“false”/
/options
attrs
enable3d val=“false”/
position
separate val=“true”/
x val=“0”/
y val=“0”/
z val=“0”/
/position
scale
etc…

so i could write something along the lines of:

for selected pegs, change

function changeColourRGBA()

var n = selection.selectedNode(0);
node.setColorRGBA(170,0,0,0);

then same with “lock” attribute

(i know that’s not correct, but it’s the closest I could come on a guess… but i can’t seem to even find what the attribute script name is called in the list of peg attributes available to change via script)

I’ve done a fair bit of successful scripting in Maya and 3Ds Max. But i rely heavily on the listener to get a sense of where to begin.

Any help or direction would be greatly appreciated.

Thanks!

try to see this script
it should help to understand
https://toonboomscripts.com/2015/06/18/selection-sets/