how do I set the value to an object/component in a different script processor?
-
Hi,
Little problem. I'm trying to control my UI pitchwheel knob from a different script processor. I used to have a const car reference, and it worked fine. like so:
if (Message.getControllerNumber() == 128) { var PitchMod = (Message.getControllerValue()); Interface.setAttribute(Interface.pitchWheel, PitchMod); }
But in a new project I have all my UI elements as parts of one object and this set attribute approach does not work anymore. I would think this would work but it's not.
if (Message.getControllerNumber() == 128) { var PitchMod = (Message.getControllerValue()); Interface.setAttribute(Interface.KEYBOARD.UI.wheel.pitch, PitchMod); }
My question is how do I setValue() to an object in a different script processor?
-
@CyberGen Global variable is one way.
-
@CyberGen A simple example:
HiseSnippet 922.3oc6V0saaaCElzwbsQqqnEsO.B9Jmgh.KO2DODLDm3jrZzlTipzrtqJnoniIrDofDU2bGJvtXOH6QYXOB6pd41avtoW2cnjbjTr6eFK2Ucg.342Od32gGNLRw3wwpHD15zYgbD9FD2YR8j9SnBIZvAH7MIGSi07H6LQ6OKjFGy8PX7ZeuQ.d85nzu+c28o9TIiWHBgNSIX7GIBD5BoC68Pgu+QTO9ohfRV2o2.lR1W4qR.7rFoEJjxlROmeB0XVMB5Az3IH7WS7b53LtKitUWmNsYr1c2t82tMiSGOluky82tS2wcFSYsZivewgdBsJxUS07XDt99JuYtST+jLKAmIhEi74lENHWHyYhOR46Y1hFon9SD9dCmWnhQPTFVT1VKqrcWxwBOwExKJe2JUgcgGkKf3ZUg2ZUfmSY30pD7VBjpUBR0yfzsItrHQntPiAOeIYfDNMgxCuBTxrEU6uvj9JvBody.5T9QQvhK7n4VsZcOa32F6XYAmUwZ6WPiruTdbr+N6TRzlmy0UJKMajYZQ4vogITVBouPxsGmHYZgRZqjOTpF4XPRjxuISEDpj.ltGjO+D9FV+h05WNqaFy06o0QhQIZdyEzNEB3OpR9ApTep5QB4z4wZGqWAPX9lFfb+4YqYiTTzXCSnywRepu+HfV1rJDgnTB7mnz7GKalBSqWYYeYUiGuTc4wxmGsT0ltkn2miMkIAi3QkKRFCAFQUZF4cSyJ2EvxJIkLTIGHE5GGxkuqdCTdcDnj3bTAlpSIj2LmP55K73QHAv6tFIsHhRAb9MA+5e9l+dWzSGb.USmGFHhPVB4QZgYCfOf+B3dkLd95jC3wS0pvTayO5fM4GLo+bwUOzdytXwuOpGbeWnq3kyQTu+4k+1tnO1Nr6PVfjurNM7qIEcPF.AcMKmDt.yMsm4yzsOc51cHKTKuJnd0+j.PAM7ONqDMD0n2Rnbv3DkWhOUWcFiYRbtB3HpBcyb4sLVnmUdR8+aCd9Xg3sICEZ1jkiwZKAilYZWAXLeb8WQNDdq.SW.v5jid1UyrYzSTIZg77iovrI3vlbRRfK7DGFGxtTx8MsH3ZFxb15Vl0lJfKW5kt3svWtRGyZbtRm4JQATVj54rrV.yCBtdpD.SxzGOsN7JNXsc0qZS+BfIzOmwpFpEbr8p532rpN1YUc79qpiaspNt8p5X2OrilGPsWhVEj01fPGO7vz6mv3CkTfAlxVQ+GmUMX0C
-
@CyberGen said in how do I set the value to an object/component in a different script processor?:
I'm trying to control my UI pitchwheel knob from a different script processor
Keep the two things separate. UI does one job, your other script does another. The two don't need to be able to talk to each other.
In your UI's on controller callback you put the code that handles the UI stuff. In your other script's on controller callback you put the code that handles the realtime stuff.
-
@d-healey Thanks, Wishing you a speedy recovery.
-
@Matt_SF Thank you for this example. My old code worked in this way. The issue is that now I am not declaring knobs in the standard Content.getComponent() way. I'm using objects. As in reg UIObjects = {}; and these do not seem to be added as attributes to their parent script like normal const var do. I was wondering if there was a different way that wouldn't require the use of const var nor global references.