Structure of a repeating task ?

Discussion in 'Plugin Development' started by ThunderWaffeMC, Feb 22, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ThunderWaffeMC

    Hi, I'm having a little trouble structuring an ongoing task. I have all the code but my first structure didn't work out so I will need to use a better one (which I can't find). Here's the structure I need:

    1. On Enable, start the repeating task and print a message.
    2. 5 seconds after, run something (print a message).
    3. 5 seconds after step 2, run another message.
    4. 3 seconds after step 3, run 1 more task.
    5. Repeat steps 1-4

    Should look like this if the messages were the steps:

    Code:
    onEnable: 1
    Wait 100 ticks: 2
    Wait 100 ticks: 3
    Wait 60 ticks: 4
     
    Wait 100 ticks & Repeat task: 1
    Wait 100 ticks: 2
    Wait 100 ticks: 3
    Wait 60 ticks: 4
     
    and so on....
    
    I'm just really confused on how to do this. When I tried, all the timing was off (most likely because I was using the wrong runnables).

    Thank you! Any help is greatly appreciated!
     
  2. Offline

    CubieX

    You could run the timer every second and use a counter variable which gets increased within the timer in each run and resetted whenever you want to restart the messages.
     
Thread Status:
Not open for further replies.

Share This Page