Restarting a stopped chart with OptoScript


#1

Hello I am very new to OptoScript and am looking for a way to restart a chart if it stops for any unknown reason. I would also like to have it change a variable when it sees that the chart has been stopped and clear the variable once it it running again so I can log how many times the chart has stopped in Groov.
In OptoScript I found the chart condition “IsChartStopped” but don’t know how to use it to restart the chart.
Sorry in advance for for my lack of knowledge on OptoScript but, if you could help me out on this that would be great because it would save me a lot of space and time to be able to use OptoScript instead of doing multiple blocks in a flow chart.
Thanks.


#2

Not sure exactly why charts would just stop without being commanded, but how about something like this?

if (IsChartStopped(MyChart)) then
  StartChart(MyChart);
  IncrementVariable(ChartStoppedCount);
endif

ChartStoppedCount will increase each time the chart is found stopped. Of course, be sure to run this in a chart that is running.


#3

Thank you for the quick response. I thought I tried that and was getting an error but I will try this tomorrow when I get back in to the office.
And as for why charts sometimes stop without being commanded, we have a couple of people creating charts and sometimes forget to put in connecting arrows in their logic and instead of having the chart stop completely when nobody is present to restart it I would like to have it automatically restart and log it so I know there is a problem and can go into the chart and fix the error.
Thanks again.