Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved setDuration()

Comments in 'Plugin Development' started by Andrey Nazarchuk, Sep 29, 2015.

  1. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Hello,
    I am confused about how setDuration() in Effect works, I often see setDuration(200 * 200), but what are there two numbers in there for, and why are they multiplied? The pocketmine docs say setDuration(ticks) but it is very confusing, please explain.
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    What's 200 x 200? Answer that and you'll find out. 20 ticks = 1 second
  3. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    You don't need 200 x 200, just put how much ticks. BTW 20 ticks = One second
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    20 TICKS === 1 seconds
    200 * 200 is a typo? So 20 seconds of effects is 20 * 20.
  5. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    People do it for convenience. I'd rather put 4 than 2 * 2.
    Nothing about those two digits are typos. You're just lazy because you can't solve 200 * 200, can't you, so you made it 20 * 20. :p
  6. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Same.
  7. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    I'm still confused...
  8. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    ahh ok I get it... so I put 20 * (however many seconds I want?)
  9. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Why are you so....
    Its ok to have php solve things for you, that's what its for....
  10. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    As you can see, I wasn't talking to you, I was talking to @Legoboy0215. Stay out of it.
  11. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    No. you can put anything, really.
    But the count is in ticks and 20 ticks = 1 second.
    so for example, if you wanted the effect to last for 5 seconds, the duration would be "100" because 20 x 5 = 100.
  12. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Exactly, thank you.
    Its my thread...
    @Intyre please lock this thread, we are done here.
  13. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    No I cant, I can delete it but it still may be useful to people with the same question.
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That has nothing to do with laziness. You know how much 200×200 is without barely thinking. The point is, it is unreasonable to use 200 as the base as 200 does not stand for any reasonable values.
  15. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    True, but I understand now that multiplying by 20 makes it so you don't have to convert seconds to ticks by yourself.

Share This Page

Advertisement