'global_send' / How can I 'getValue() ?
-
I need to get this value from my ScriptNode 'global_send' cable within a script in onInit.
// I need to be able to: Slot.DelayLeft.getValue(); // How do I do this?
This is what i've been trying so far...
const var globalRouting = Engine.getGlobalRoutingManager(); const var SlotFxDelayLeft = globalRouting.getCable("Slot.DelayLeft"); Console.print(SlotFxDelayLeft.getValue()); const var delayTimer = Engine.createTimerObject(); delayTimer.setTimerCallback(function() { if (SlotFxDelayLeft.getValue() == 1.0); { //Console.print("ONNNN"); } }); delayTimer.startTimer(20);
Im trying to get an LED animation to respond to the delay signals so I need to get the signal value and this was how I thought to do it. You can let me know if this is not a good approach.
Thanks!
-
@Chazrox you don't need to poll the value with a timer, just attach a asynchronous callback to the cable and it will do the same thing.
-
@Chazrox Try a Global Cable instead! There's a few posts on this, I know I shared one very recently which I believe will answer your question.
-
@Christoph-Hart I found one of your examples in docs, I've been trying this but getting an error I cant figure out.
const var globalRouting = Engine.getGlobalRoutingManager(); const var SlotFxDelayLeft = globalRouting.getCable("Slot.DelayLeft"); Console.print(SlotFxDelayLeft.getValue()); // Register the callback SlotFxDelayLeft.registerDataCallback(function(data) { Console.print("DATA: " + trace(data)); });
-
UPDATE:
I figured it out...
const var globalRouting = Engine.getGlobalRoutingManager(); const var SlotFxDelayLeft = globalRouting.getCable("Slot.DelayLeft"); Console.print(SlotFxDelayLeft.getValue()); // Register the callback SlotFxDelayLeft.registerCallback(function(value) { Console.print(value); }, AsyncNotification); // Values print =)
@Christoph-Hart @HISEnberg Thank You!
-
C Chazrox has marked this topic as solved