Here is what I have so far. The wait timer works perfectly if you put the message box after the wait for but in the new game sub it immediately says "cool" "yay" without waiting. Any help would be appreciated.
Sub WaitSecs(secs As Int)
Dim WaitTimer As Timer
WaitTimer.Initialize("WaitTimer",0)
WaitTimer.Interval = secs * DateTime.TicksPerSecond
WaitTimer.Enabled = True
Wait For WaitTimer_Tick
WaitTimer.Enabled = False
Sub Test
Log("Wait")
Wait For (WaitSecs(10)) Complete (Result As Boolean)
Log("OK")
End Sub
Sub WaitSecs(secs As Int) As ResumableSub
Sleep(secs*1000)
Return True
End Sub
You may find useful my class xToastMessage, an XUI/B4X class born to take the B4A standard ToastMessage to B4J, but which then turned to a more complete tool.
Source code is provided so you can tailor it to your needs.
you spoke about a game.
a statemaschine will also be useful, a timer will trigger something you do at a current state.
so you can memory the time at state x , next state, condition time1-time2 >= 10 secs then next state