Jump to content

Moose - increase flag value +1 after certain time


xXMustangXx

Recommended Posts

what I need is: at mission start a flag "StartFlag" is created and set to 0

said flag to be increased by 1 every 600 seconds 4 times.

 

I don't know the function to increase the flag so I invented that part.

 

this is what I would come up with...

 

StartFlag = USERFLAG:New(" Start Flag ")

StartFlag:Set(0)

 

FlagIncrease = SCHEDULER:New( nil,

 

function()

StartFlag:increase(1) ---made this up but i need something like this

end,

{}, 600 , 4

)

 

Any Help please

Link to comment
Share on other sites

Take another look at the Moose Scheduler documentation. Your Scheduler will not achieve your objective. Where you have 600, 4 the parameters are:

 

Start, Repeat, RandomizeFactor, Stop

 

The number 4 (which is an invalid value) would set the randomization, not number of repetitions. So the Scheduler parameters should be:

 

{}, 0, 600, 1, 2500

-- 2500 sec.should stop the Scheduler after 4 repetitions.

 

You could also write a conditional statement to do Scheduler:Stop() after 4 repetitions.

Link to comment
Share on other sites

StartFlag = USERFLAG:New(" Start Flag ")

StartFlag:Set(0)

FlagIncrease = SCHEDULER:New( nil, function()

 

StartFlag:Set(StartFlag:Get() + 1)

 

end,

{},600, 600, nil, 2500 )

No more pre-orders

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...