PDA

View Full Version : Solution to make Background Script Loop continuously



tfmacz
12-11-2007, 01:34 AM
I am note sure if someone has posted this somewhere or not but if they did I never saw it...

This is how I got the background script to loop continuously. It blinks an led that I use as a "Heart Beat" to kick a watchdog timer and to let me know everything is running ok. Actually it blinks 4 channels of which I only use one.

void Start() {



Off(All);

while(true){

On(Channels(Channel_84, Channel_85, Channel_86, Channel_87),For(1).Second, Wait);

Off(Channels(Channel_84, Channel_85, Channel_86, Channel_87),For(1).Second, Wait);

continue;

WaitOnTimers();

}
Off(All);
}



This probably breaks all kinds of programming rules but it works as of 2.0.4.1

The key is the "while/continue". I guess these are C# but I don't do C# so can't say for sure. The program never "tests" anything so it is always true. Probably should set something true to be sure but not sure how to do that??? Also, Watch the extra set of curly brackers.

As always, This is how I did it. Your milage may vary.

tconley
12-13-2007, 12:02 PM
How do i load this into my vixen?

Josh
12-13-2007, 12:26 PM
sequence>new event sequence> vixen script sequence

paste it in, tab everything between
"void Start() {" and "}
Off(All);
} "

and then hit f6 to compile, and save it

at least i think that is correct

tconley
12-13-2007, 05:34 PM
when i hit F6 I get back a script module needs to be select. if I hit the execute button I get another error

Wayne J
12-13-2007, 05:44 PM
when i hit F6 I get back a script module needs to be select. if I hit the execute button I get another error

click on script / modules and check standard script.dll

Make sure the path to it is correct in Preferences also. (if you have renamed the Vixen folder, the path will need corrected.

Be sure to set the plugin's and import your channels. These are found at the same tab as the Script / Modules.

Josh
12-13-2007, 07:34 PM
opps forgot that part... was going off my memory and have only done this once lol