Vixen Script Projects: Difference between revisions

From doityourselfchristmas.com
Jump to navigation Jump to search
(From <http://www.doityourselfchristmas.com/forums/showthread.php?t=5263>)
Line 4: Line 4:
Vixen Standard Scrips provide basic on/off, fade/ramp, timed control. To use this, create a New Event Sequence > Script Project.  Then, one must select ''Standard.dll'' from the Script > Modules menu.
Vixen Standard Scrips provide basic on/off, fade/ramp, timed control. To use this, create a New Event Sequence > Script Project.  Then, one must select ''Standard.dll'' from the Script > Modules menu.


====Standard.dll====
===Standard.dll===
'''Note:''' The examples will use this example channel list:
'''Note:''' The examples will use this example channel list:
* Channel_1
* Channel_1
Line 11: Line 11:
* Channel_4
* Channel_4


=====Properties=====
====Properties====
Any of the channels imported into the scripted sequence are available by name.
Any of the channels imported into the scripted sequence are available by name.
Also, there is an additional "All" channel, which is all of the channels.
Also, there is an additional "All" channel, which is all of the channels.


=====Methods=====
====Methods====
All assume to operate asynchronously; the action will return unless the Wait modifier is used (below).
All assume to operate asynchronously; the action will return unless the Wait modifier is used (below).
* void On(channels, modifiers);
* void On(channels, modifiers);
Line 23: Line 23:
* void Chase(channels, modifiers);
* void Chase(channels, modifiers);


======Arguments======
 
=====Arguments=====
"channels" is a ChannelCollection. There are a number of ways to create a ChannelCollection:
"channels" is a ChannelCollection. There are a number of ways to create a ChannelCollection:


Line 44: Line 45:
* Every(int seconds) // Occurs at every time interval.
* Every(int seconds) // Occurs at every time interval.


======Modifier time span======
 
'''Modifier time span'''
The default measure of time is seconds. So For(5) would cause the action to span 5 seconds. The measure of time can be changed with one of the following properties on the modifer:
The default measure of time is seconds. So For(5) would cause the action to span 5 seconds. The measure of time can be changed with one of the following properties on the modifer:
* Millisecond
* Millisecond
Line 53: Line 55:
: Example: To have a chase span 3.7 seconds over the first 10 channels synchronously...
: Example: To have a chase span 3.7 seconds over the first 10 channels synchronously...
:: Chase( ChannelRange(1,10), Over(3700).Milliseconds, Wait )
:: Chase( ChannelRange(1,10), Over(3700).Milliseconds, Wait )
====Example Scripts====
To have certain channels on for a given time range:
<pre>
void Start() {
Off(All);
      DateTime now = DateTime.Now; //get the current time
        //The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);
        //We only want the channels to turn on while the current time is
        //between 5:30 and 11 pm
while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
              On (Channels(Tree_1), At(100));
              On (ChannelRange(1,15), At(100));
              On (ChannelRange(18,7), At(100));
              On (ChannelRange(27,8), At(100));
              Random (ChannelRange(15,2), 50, For(50).Second);
      now = DateTime.Now;  //update the current time
}
Off(All);
}
</pre>

Revision as of 07:29, 7 December 2009

Vixen Script Projects are written in C#, and allow for non-sequential control of displays.

Vixen Standard Scripts

Vixen Standard Scrips provide basic on/off, fade/ramp, timed control. To use this, create a New Event Sequence > Script Project. Then, one must select Standard.dll from the Script > Modules menu.

Standard.dll

Note: The examples will use this example channel list:

  • Channel_1
  • Channel_2
  • Channel_3
  • Channel_4

Properties

Any of the channels imported into the scripted sequence are available by name. Also, there is an additional "All" channel, which is all of the channels.

Methods

All assume to operate asynchronously; the action will return unless the Wait modifier is used (below).

  • void On(channels, modifiers);
  • void Off(channels, modifiers);
  • void Ramp(channels, int startIntensity, int endIntensity, modifiers); // Intensities are 0-100
  • void Random(channels, int saturationLevel, modifiers); // Saturation level is 0-100
  • void Chase(channels, modifiers);


Arguments

"channels" is a ChannelCollection. There are a number of ways to create a ChannelCollection:

  • ChannelCollection ChannelRange(startChannel, endChannel);
Example: ChannelRange(Channel_2, Channel_4)
  • ChannelCollection ChannelRange(startChannel, int count);
Example: ChannelRange(Channel_2, 3)
  • ChannelCollection ChannelRange(int startIndex, int count);
Example: ChannelRange(1, 3)
  • ChannelCollection Channels(...);
The parameters for Channels() is a params list of channel collections. It can be used to create a single set of disjointed channel collections.
Example: Channels( Channel_1, ChannelRange(Channel_3,2) );
Example: Channels( ChannelRange(DateTime.Now.Hour,1), ChannelRange(10,10), Channel_2 );

"modifiers" is a params list made up of 0 or more of the following:

  • At(int level) // Intensity level, 0-100
  • For(int seconds) // Applies the action for the given time period.
  • Over(int seconds) // Same as For(), just makes better sense in some uses.
  • Wait // Wait for the action to complete.
  • Every(int seconds) // Occurs at every time interval.


Modifier time span The default measure of time is seconds. So For(5) would cause the action to span 5 seconds. The measure of time can be changed with one of the following properties on the modifer:

  • Millisecond
  • Second
  • Minute
  • Hour
The plural version of each of those is also valid.
Example: To have a chase span 3.7 seconds over the first 10 channels synchronously...
Chase( ChannelRange(1,10), Over(3700).Milliseconds, Wait )


Example Scripts

To have certain channels on for a given time range:

void Start() {
	Off(All);

       DateTime now = DateTime.Now; //get the current time

        //The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
	DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
	DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);

        //We only want the channels to turn on while the current time is
        //between 5:30 and 11 pm
	while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
	{
               On (Channels(Tree_1), At(100));
               On (ChannelRange(1,15), At(100));
               On (ChannelRange(18,7), At(100));
               On (ChannelRange(27,8), At(100));

               Random (ChannelRange(15,2), 50, For(50).Second);

	       now = DateTime.Now;  //update the current time
	}

	Off(All);
}