How can I make it so that once activeOrders = 5, the program waits for activeOrders to become equals to 3?
any code examples you can provide? There are lots of ways to do this.
[I suppose you are using blueprints] You can have a similar behavior than “wait” by using an event dispatcher:
- the code that needs to wait for the value to be reached binds an event to be called to the event dispatcher. This event contains the code that needs to be done after the value is reached.
- the code that update the activeOrders variable simply call the event dispatcher once the value is reached
you could set a loop to do nothing until you get the number you want
so like
Seems to work but when I call the function, I get this error and I believe it has to do with the suspends on the StartAt3 function:
you could try spawning the function like this
spawn{StartAt3()}
or add to the function that your calling StartAt3 in
That works, great! Besides that, could you please explain why it needs to spawn (I’m still learning verse)
spawning might not be the best option i’d need to see the rest of the code but think of it as running an instance of the function almost.
so if you were iterating over an array of something and you have sleep inside of the function, sleep essentially stops and waits.
So if you were calling a function while iterating over an array of players without spawning it would print fallback function started, then sleep for 15 seconds, then whatever arguments you’ve put in place, then it would move to the next player.
When you spawn a function it runs as many times as it’s called at the same time.
(Edit) :
You might not even have to spawn the function if you added suspends to your OnNewOrderTimeFinish Function like :
OnNewOrderTimerFinish(MaybeAgent:?agent):void=