"puzzletimer = GetGameTime()" appears twice.
Once before your While loop, and then again inside the while loop, near the end of it.
The first one is just initialising it, but you could create an additional delay at this point if you wish, like so:
puzzletimer = GetGameTime() + 5
For a delay of 5 seconds before any seedlings start sending.
Then the second one is the delay you want between each wave. So for example:
puzzletimer = GetGameTime() + 30
That would create a 30 second delay before the next round of seedlings are sent.
So basically the code appears twice.
The first time is to initialise the "puzzletimer" variable, and optionally to add an initial delay before the seeds send for the first time.
The second time is to add on a delay until the next send.
I'll also respond to your questions directly:
So the delay at the start would have been the + 4 am I correct?
Correct. :> In the code I gave you before, I put a 4 second delay by adding "+ 4" to the line that initialises puzzletimer. :>
So this code tells me...
puzzletimer = GetGameTime() + 4
puzzletimer = puzzletimer + 22
puzzletimer = current game time plus 4
That's right. The first time the command is run, puzzletimer is set equal to the game time.
So lets imagine 60 seconds of game time have passed so far... puzzletimer therefore is equal to 60.
If we want to create a delay, we should set puzzletimer to be
greater than the current game time.
Hence puzzletimer = GetGameTime() + 20
The "If" statement then checks if the gametime is greater than puzzletimer.
In this case the puzzletimer was set at 80 (remember, 60 seconds have passed and as per above we're adding a 20 sec delay)
So game time will proceed and the If statement will be checked lots, but each time it discovers that nope, game time is still smaller than puzzletimer.
Eventually, after say 81 sec, it runs the If statement again and discovers that now, finally, GameTime is greater than puzzletimer.
Then it runs the code inside the If statement, which includes a statement to increase puzzletimer again!
So puzzletimer gets another 20 added on and becomes 100, meaning another 20 second delay until the If statement is triggered again.
GetGameTime() > puzzletimer
Would do nothing until GameTime is 22+ yes? which again would do the whole code again and...
Yes.
GameTime = 22 and puzzletimer = 44 per say?
Exactly!
Really sorry if I sound like I can't speak English here, but this is how I work things out haha.
Ah it's all good. You should see my code comments.
-- ahhh seedkkkkkk why doesnt the thing work... i need the PiVariable to be negative.. blah..