Scripting Timers

Discuss issues and ideas you have to configuring displays with PowerVision
cconner_aie
Posts: 93
Joined: Thu Jun 11, 2015 10:12 am

Scripting Timers

Post by cconner_aie » Tue Feb 16, 2016 1:55 pm

Hello,

I would like to use timers in for the glow and start sequence on our engine, however, I'd like to keep it all in a script if possible. I've looked through some examples and they all seem to use state machines.

In a perfect world I'd love to be able to just call,

Code: Select all

Delay(1000); // stop script for 1 sec
but I don't see anything.

I found this,

Code: Select all

ScreenPanMapData panInfo;
panInfo.XValue = 450.0f;
panInfo.YValue = 123.0f;
panInfo.PanType = 0; // 0 = Pixels, 1 = Degrees, 2 = Lon (x) / Lat (y) Direct
SendActionObject(ApplicationIDs.Screen, ActionIDs.Screen_PanMap, @panInfo);
SendAction(ApplicationIDs.Screen, ActionIDs.Screen_Process, ActionData.Empty );
So in theory, I would assume I can use SendAction() to the CCM and use the timer with this,

Code: Select all

ActionData data;
... // assign action data here
SendAction(ApplicationIDs.CCM, ActionIDs.CCM_Start_Timer, @data);
I have a timer created,
Image

And I can access it using TimerIDs.tmr_wait, but I don't know the proper syntax to bind that with ActionData.

Also, is there a way to have this pause the script or do I have to specify a callback function (or whatever AngelScripts equivelant is) and have that handle the code after the timer runs out?

Thank you,
Coleby Conner
Controls Engineer, Anderson Industrial Engines
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: Scripting Timers

Post by stalley » Wed Feb 17, 2016 2:17 pm

Hello,

With the release of 2.8 PowerVision, we have the ability to change the duration of timer times and we can start/cancel event timers in scripts.

The syntax is:
  • Given an event timer - TimerVar
    SendAction(ApplicationIDs.CCM, ActionIDs.CCM_Start_Timer, TimerIDs.TimerVar);
When the TimerVar time has elapsed, the event associated with the TimerVar will be fired. This is not the same as delay();, the control is different but you should be able work off of the fired event.

You just need to make friends with the state machines... ;-)
Sara Talley
Software Engineer
Enovation Controls