Jump to content

Help with making countdown timer looping trigger


T-Pap

Recommended Posts

Hi ,

 

Im trying to create the following sequence with triggers .

 

Trigger 1 :

-Both aircrafts enter a trigger zone and receive message they are both in when it happends (done)

-Set a flag to on with a value of 1 (done)

Trigget 2 :

-When time since flag more than 60 seconds , Flag gets assigned a random value between 1-10 (done)

Trigger 3 :

If that value is more than 5 then repeate trigger 1 and 2 ELSE send "Message A" to both groups (problem)

 

I want each time 2 aircraft enter a zone to receive a 60 seconds "countdown" where after that time a random value is set to a flag which wil either reset the 60 seconds and restart the process or send a message to the groups and end the loop .

 

 

Is there a script or trigger that allows the looping of trigger until a criteria is met at which time it stops ?

 

Ive tried adding trigger for the more / less value to the flag but it just runs through it no matter the value and never loops when the value is less than the condition .

Link to comment
Share on other sites

Is not very clear what happens with those two units after 60 seconds, they remain inside trigger zone or they respawn outside?

 

For repetitive actions, you should use SWITCHED CONDITION trigger, and make sure you reset used flags.

 

You can try something like this:

 

Trigger 1

SWITCHED CONDITION > Unit 1 AND Unit 2 inside trigger zone > MESSAGE TO GROUP - flag 1 ON

 

Trigger 2

SWITCHED CONDITION > TIME SINCE FLAG 1 60 seconds > flag 1 OFF (reset flag) - flag 2 set random value 1-10

 

Trigger 3

SWITCHED CONDITION > flag 2 value greater than 5> RESPAWN Groups (?) - flag 2 false (reset flag)

 

Trigger 4

SWITCHED CONDITION > flag 2 value smaller than 5> Message to both groups - flag 2 false (reset flag)

Link to comment
Share on other sites

Hi and thanks for replying ! :)

 

The two units that enter the zone only trigger the repeatative countdown and after that have no further role to play in the conditions of the triggers .

 

They only set off the timer. Once that happens , i want a flag to receive a random value between 0-10 every 60 seconds . If at the end of each 60 second cycle that value is over 5 then the cycle stops , if it is less then 5 , the cycles repeats with a new 60 second timer to next check.

 

I was wondering if there was a way to do it with a loop that checks for the value every 60 seconds instead of creating x amount of flags for as many times as i want it to check.

 

Imagine something like russian roullette . Constantly assigning a value to a flag every 60 seconds and checking the value to see if the loop ends or continues .

 

I'll try what you posted below as well ! Thanks :)

 

 

Is not very clear what happens with those two units after 60 seconds, they remain inside trigger zone or they respawn outside?

 

For repetitive actions, you should use SWITCHED CONDITION trigger, and make sure you reset used flags.

 

You can try something like this:

 

Trigger 1

SWITCHED CONDITION > Unit 1 AND Unit 2 inside trigger zone > MESSAGE TO GROUP - flag 1 ON

 

Trigger 2

SWITCHED CONDITION > TIME SINCE FLAG 1 60 seconds > flag 1 OFF (reset flag) - flag 2 set random value 1-10

 

Trigger 3

SWITCHED CONDITION > flag 2 value greater than 5> RESPAWN Groups (?) - flag 2 false (reset flag)

 

Trigger 4

SWITCHED CONDITION > flag 2 value smaller than 5> Message to both groups - flag 2 false (reset flag)

Link to comment
Share on other sites

For a simple "timer" set a "continuous" trigger, with action "flag XX increase 1" each second this will increase the flag XX. Now set a "flag YY value 60" Next check "switch condition" for "Flag XX = YY" with action set "flag XX value 0" (so the timer starts again from 0) and any trigger/flag you need to execute after 60 seconds.

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

Hi , Thanks this timer works great as a non-stop repeater but i'm looking for a way to break the cycle if a condition is met too .

 

With a basic knowledge of BASIC i'm trying to get the following code to work :

 

 

1 IF (unit1 AND unit2) IN zone1

2 THEN flag1=ON

3 GOTO 5

4 ELSE GOTO 1

5 INCREASE Flag1(1)

6 SET flag2=60

7 SET flag3=Random value (0,10)

8 IF flag1=flag2 AND Flag3 <5

9 SET Flag1=0

10 MESSAGE.TO.ALL=" Timer Reset"

11 GOTO 5

12 ELSE MESSAGE.TO.ALL="Round Complete"

 

 

As long as flag3 keeps randomly being set to a value less than 5 every 60 seconds the loop goes on until flag3 is randomly set to >5

 

For a simple "timer" set a "continuous" trigger, with action "flag XX increase 1" each second this will increase the flag XX. Now set a "flag YY value 60" Next check "switch condition" for "Flag XX = YY" with action set "flag XX value 0" (so the timer starts again from 0) and any trigger/flag you need to execute after 60 seconds.
Link to comment
Share on other sites

Oh man !! I really don't know how to thank you !

 

Yes ! Thanks so much for this !

What i was doing wrong was not turning flag2 off and randomising tit's value again as part of the switched condition actions before it looped !

I was adding this only to the start on the inital trigger and in that sequence it would not reset !

 

Seriously , I cant thank you enough !!!!!!!!!

 

 

 

See attached mission - you can temporary change time since flag to smaller values (15 seconds) if you want to test it faster.
Link to comment
Share on other sites

Hi , Thanks this timer works great as a non-stop repeater but i'm looking for a way to break the cycle if a condition is met too .

 

 

 

With a basic knowledge of BASIC i'm trying to get the following code to work :

 

 

 

 

 

1 IF (unit1 AND unit2) IN zone1

 

2 THEN flag1=ON

 

3 GOTO 5

 

4 ELSE GOTO 1

 

5 INCREASE Flag1(1)

 

6 SET flag2=60

 

7 SET flag3=Random value (0,10)

 

8 IF flag1=flag2 AND Flag3 <5

 

9 SET Flag1=0

 

10 MESSAGE.TO.ALL=" Timer Reset"

 

11 GOTO 5

 

12 ELSE MESSAGE.TO.ALL="Round Complete"

 

 

 

 

 

As long as flag3 keeps randomly being set to a value less than 5 every 60 seconds the loop goes on until flag3 is randomly set to >5

Just add the condition to the timer (increase flag action). E.g. condition to increase Flag XX "Flag 3 less than 6" AND "Flag 3 is more than 0" ( 1 to 5), only then, the timer will increase...

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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