Page 1 of 1

Intro into Variable - Using Vision Net and triggering looks

Posted: Fri Dec 12, 2008 3:49 pm
by JohnGrimshaw
I used the following macro on an installation where an 8 button Vision Net panel was used to simply trigger a macro on the console.

The below code "looks" at the level of a particular submaster, and if it is greater then 0, fades it out over time. Else, if it is already zero, fades it up over time. The time is "set" by the eighth fader. The eighth fader is always a value between 0 and 100, so I divided this by 10, and added 3. That made the slowest fade 3 secs.

Code: Select all

PageName = "Sub Page 1"
SubNum = 1
SubTime = HC.LookGetValue(PageName,8) /10 +3

if
HC.LookGetValue(PageName,SubNum) > 0 

then
HC.LookFade(PageName, SubNum,0,SubTime)

else
HC.LookFade(PageName, SubNum,100,SubTime)

end
The vision net panels were setup with "Smart" buttons, so that there would be an LED indication of whether the Button was on or off.

Because I could see at the console if the button was "ON" (the button value was 1), or "OFF" (the button Value was zero) I later changed the code to be a little more specific about the action, putting two separate scripts in for each Variable button...

On Value 1

Code: Select all

PageName = "Sub Page 1"
SubNum = 1
SubTime = HC.LookGetValue(PageName,8) /10+3

HC.LookFade(PageName, SubNum,100,SubTime)


On Value 0

Code: Select all

PageName = "Sub Page 1"
SubNum = 1
SubTime = HC.LookGetValue(PageName,8) /10+3

HC.LookFade(PageName, SubNum,0,SubTime)

Re: Intro into Variable - Using Vision Net and triggering looks

Posted: Fri Dec 12, 2008 5:30 pm
by RobertBell
Don't forget:

Code: Select all

(HC.GetScriptSource('number')
Can be used in place of SubNum = 1 like this:

Code: Select all

SubNum = HC.GetScriptSource('number')
That way you can copy and paste macros on variables and you don't need to edit the code.