Running a script on a Variable Change

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

Running a script on a Variable Change

Postby chrisr » Thu Oct 19, 2017 5:41 pm

All, This is probably an easy answer, but can not find the solution, how would I go about running a script on a value change inside a variable. I need to write values to 10 other variables via a script which include some math. So basically a script that actively updates on the var update.

Thanks!!! Sorry for the basic question.

Chris

I currently am using TCP traffic and using the Action node. I'd rather use something that watches the Variable

Thanks a bunch for any input.
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev6322
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev15101
chrisr
 
Posts: 133
Joined: Tue Jan 26, 2016 10:50 pm

Re: Running a script on a Variable Change

Postby malkuth23 » Thu Oct 19, 2017 8:01 pm

variable input node -> script output node
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 326
Joined: Tue Apr 20, 2010 7:14 pm
Location: Ventura, CA

Re: Running a script on a Variable Change

Postby chrisr » Thu Oct 19, 2017 8:47 pm

Thanks so I guess I can do the IF Var1 = Var1 would continuously run the script I assume.

Matt, appreciate the input.
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev6322
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev15101
chrisr
 
Posts: 133
Joined: Tue Jan 26, 2016 10:50 pm

Re: Running a script on a Variable Change

Postby malkuth23 » Thu Oct 19, 2017 10:30 pm

The script node will only run once when the if statement changes by default.
There is some checkbox on the bottom that I can not remember the words next to that will cause it to update at the refresh rate of the ui.
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 326
Joined: Tue Apr 20, 2010 7:14 pm
Location: Ventura, CA

Re: Running a script on a Variable Change

Postby Mike Mengen » Fri Oct 20, 2017 6:53 am

You can also display the variable on a Label and use an Actionscript Node to trigger the script on Labelchange.
User avatar
Mike Mengen
 
Posts: 18
Joined: Thu Aug 13, 2015 1:50 pm

Re: Running a script on a Variable Change

Postby chrisr » Fri Nov 03, 2017 1:15 pm

Mike, would that be as a member value type of thing something like label1.labelchange ?

This is what is offered up by the action node, unless I can add things that aren't in the drop down list?

Image

Thanks!!
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev6322
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev15101
chrisr
 
Posts: 133
Joined: Tue Jan 26, 2016 10:50 pm

Re: Running a script on a Variable Change

Postby chrisr » Fri Nov 03, 2017 1:39 pm

There is some checkbox on the bottom that I can not remember the words next to that will cause it to update at the refresh rate of the ui.


Are you talking about the checkbox that says "GUI Delay" by it?
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev6322
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev15101
chrisr
 
Posts: 133
Joined: Tue Jan 26, 2016 10:50 pm

Re: Running a script on a Variable Change

Postby Thomas Mrozek » Fri Nov 03, 2017 5:26 pm

Hi all,
variable change as trigger for action script is already on our internal Feature wish list.
cheers
Thomas Mrozek
Technical Support Engineer
User avatar
Thomas Mrozek
 
Posts: 84
Joined: Mon Apr 20, 2009 11:08 am

Re: Running a script on a Variable Change

Postby Dennis Kuypers » Sat Nov 04, 2017 1:57 am

Hello,

what or who is changing the variable? Maybe you can replace the variable assignment with a function/macro call?

That would be a more appropriate solution.

Regards
Dennis
Dennis Kuypers
Product Developer, Software

Online Manual
User avatar
Dennis Kuypers
coolux Germany
 
Posts: 731
Joined: Thu Jul 05, 2012 12:18 pm

Re: Running a script on a Variable Change

Postby Mike Mengen » Mon Nov 13, 2017 12:15 pm

Hi Chris,

sorry for the late response.
You would need Label1.Text
If the Text changes it will execute the Script.

Regards
User avatar
Mike Mengen
 
Posts: 18
Joined: Thu Aug 13, 2015 1:50 pm

Re: Running a script on a Variable Change

Postby chrisr » Wed Nov 15, 2017 3:28 pm

Mike, No Worries! You got me in the right direction, and it works great. Thank you very much.

Dennis, this is the project where I have a script running layers across a pixel space. (Which are being driven by incoming automation) When they reach the end, they reset to the beginning. I was looking for other alternatives to using the action node. (trying to make it as efficient as possible).

Thank you for all the help everyone!! its always appreciated.

Here is the script I'm using to manage this, this is only one of 2 of the many layers.

Code: Select all
L1 = TTa
IF L1 < L2
{
L2 = L1 + 1804
L2 = Math.Max (L2, 0)
}
ELSE
{
L2 -= 8.146
IF L2 <= 0
{
L2 = 23460
}
}
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev6322
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev15101
chrisr
 
Posts: 133
Joined: Tue Jan 26, 2016 10:50 pm

Re: Running a script on a Variable Change

Postby Dennis Kuypers » Wed Nov 15, 2017 11:50 pm

Hey,

Can you explain the values L1, L2, 8.146, 1804 and 23460 ?

You can use variables for constant values, this makes reading the script easier (and also allows you to change values in a lot of places at once)

Compare
Code: Select all
var x = y + 3840
VS
Code: Select all
var newPosition = oldPosition + SCREEN_WIDTH


(note that ALL_CAPS_SNAKECASE ist a convention that i like to use for constant values that are not supposed to be changed)

Regards
Dennis
Dennis Kuypers
Product Developer, Software

Online Manual
User avatar
Dennis Kuypers
coolux Germany
 
Posts: 731
Joined: Thu Jul 05, 2012 12:18 pm

Re: Running a script on a Variable Change

Postby chrisr » Thu Nov 16, 2017 6:53 pm

Dennis, I wrote some notes into this. Thank you for the other notes you gave as well.

Code: Select all
JUST a note on this, the layers are moving right to left. 
TTa is incoming automation value
Variables L1 - L13 are the X values in the Device layers in Pandora 1 - 13



L1 = TTa               // L1 is varible that holds x value of layer 1 in manager.  TTa is incoming automation value
IF L1 < L2
{
L2 = L1 + 1804            // +1804 is L2's offset from L1 (Master layer), each layer size is 1804 pixels, this offsets each device layer so they edge butt each other. L3's offset would be +3608
L2 = Math.Max (L2, 0)      // I was trying to keep the layers from going into negative space with this. not sure I need it now.
}
ELSE
{
L2 -= 8.146            // once L1 resets its self (its driven by incoming automation) L2 - L13 will keep moving but now at an incremental value that matches the automation resolution
IF L2 <= 0               // Once the individual layer hits zero, it is reset to the beginning of the pixel space. 
{
L2 = 23460            // If zero, it resets layer to far right of pixel space to start over again.
}
}
                  // Process repeats itself for another 11 layers.

IF L1 < L3
{
L3 = L1 + 3608
L3 = Math.Max (L3, 0)
}
ELSE
{
L3 -= 8.146
IF L3 <= 0
{
L3 = 23460
}
}

IF L1 < L4
{
L4 = L1 + 5412
L4 = Math.Max (L4, 0)
}
ELSE
{
L4 -= 8.146
IF L4 <= 0
{
L4 = 23460
}
}

IF L1 < L5
{
L5 = L1 + 7216
L5 = Math.Max (L5, 0)
}
ELSE
{
L5 -= 8.146
IF L5 <= 0
{
L5 = 23460
}
}
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev6322
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev15101
chrisr
 
Posts: 133
Joined: Tue Jan 26, 2016 10:50 pm

Re: Running a script on a Variable Change

Postby Dennis Kuypers » Fri Nov 17, 2017 12:55 am

Hello Chris,

if you have values constantly coming in and you have to send them out constantly you should probably be using the node system. This is more performant...at least I got a feeling that nodes are better suited ;)

A couple of Add nodes and using the Modulo node to wrap around will probably do.

Regards
Dennis
Dennis Kuypers
Product Developer, Software

Online Manual
User avatar
Dennis Kuypers
coolux Germany
 
Posts: 731
Joined: Thu Jul 05, 2012 12:18 pm

Re: Running a script on a Variable Change

Postby chrisr » Wed Dec 20, 2017 6:46 pm

All,
As usual, I was way over thinking this process. There were a few things I thought I had to build via a script that would create a scenario that would move device layers very specifically on the x axis. I wanted to move from left to right or right to left inside a pixel space, then when the layer reached a defined space it would start its move over again that the beginning of the pixel space. I had written a script that was being fired by a Script Output node that was watching an action node watching the Label attached to the incoming automation value. Everytime the label updated it would run the script.

Code: Select all
L1 = TTa
IF L1 < L2
{
L2 = L1 + 1804
L2 = Math.Max (L2, 0)
}
ELSE
{
L2 -= 8.146
IF L2 <= 0
{
L2 = 23460
}
}


After Speaking with Dennis and support team, via the forum and via email. Team described how a node structure would be way more efficient and way more performant. This was the node structure for the first two X-axis control layers The Master layer, and the second layer.

Image

These nodes allowed me to accomplish the above script only using three nodes. The Script nodes you see after are there to dissolve the layer off and on at the start and end of its movement. The incoming automation via Artnet, Modulo, and layer control accomplished the meat of what I was needing. I could plug in the values inside the modulo node to define the finish position which then would restart the layer at the start of the pixel space. Thanks everyone for chiming in on this. It was a brain twister for me. It really showed me how powerful the node structures are and how much more simple you can achieve your goal.... (though I'm sure not simple on the back end)...

Have a great Holiday everyone, thanks again!!
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev6322
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev15101
chrisr
 
Posts: 133
Joined: Tue Jan 26, 2016 10:50 pm


Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 2 guests

cron