Hi, I typed this simple code to try to figure out where was the problem,
in short race is finished but one can still trigger event inside of it, I wonder why?
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
problem<public> := class<concrete>(creative_device):
Break1 : event() = event(){}
Break2 : event() = event(){}
Wait1 : event() = event(){}
Wait2 : event() = event(){}
OnBegin<override>()<suspends> : void =
#if you follow TestRun and AllInOneFunction, you will expect output to be 0,1
#but thats not the case for some reason, here are 2 different ways to write the same thing
#1 style
Print("unreliable")
race:
TestRun()
AllInOneFunction()
#result is wrong 0,1,0,0
#2 style
Print("good")
race:
TestRun()
Part1()
#result is correct 0,1
TestRun()<suspends>:void=
Sleep(0.1)
Wait1.Signal()
Sleep(0.1)
Wait2.Signal()
Sleep(0.1)
Break1.Signal()
Sleep(0.1)
Wait2.Signal()
Sleep(0.1)
Wait2.Signal()
Sleep(0.1)
#1 style
AllInOneFunction()<suspends>:void=
loop:
Wait1.Await()
race:
Break1.Await()
loop:
race:
Break2.Await()
loop:
Wait2.Await()
Print("0")
Print("1")
#2 style
Part1()<suspends>:void=
loop:
Wait1.Await()
race:
Break1.Await()
Part2()
Print("1")
Part2()<suspends>:void=
loop:
race:
Break2.Await()
Part3()
Part3()<suspends>:void=
loop:
Wait2.Await()
Print("0")
#SIMPLE VERSION
Something : event() = event(){}
Smth()<suspends>:void=
#1 style When used within multiple loops/races gives unexpected result
race:
Something.Await()
loop:
Sleep(1.0)
numb := 2+2
block:
Print("ABC")
Sleep(2.0)
#2 style When used within multiple loops/races gives expected result
race:
Something.Await()
Function1()
Function2()
Function1()<suspends>:void=
loop:
Sleep(1.0)
numb := 2+2
Function2()<suspends>:void=
Print("ABC")
Sleep(2.0)