1

I am making a racing minigame in Minecraft in 1.8.9 right now. I seem to have trouble how to figure out how to convert my existing setup into minutes and seconds. Let me explain:

I have an objective, best, which finds the best time of a player once they finish my course. After, the player can check to see if they have reached a personal best by pressing a button. This button just executes a tellraw command that says the objective. The problem is that best is in only seconds, so if their personal best is higher than 59 seconds, it will still display in seconds. How do I convert it to minutes and seconds?

Read the bold to save time and not die of boredom.

1 Answer 1

3

Adding a converter

Since you have one objective that has all the time in seconds, all you want to do is essentially subtract 60 seconds off of the objective and add a minute to a separate score for every 60 seconds. You can do this by adding a clock that does a /testfor to test if the player has at least a score of 60 for the objective best. You can get the output from that command using a comparator and, when that result is true, have two other command blocks that will subtract 60 seconds and add a minute to the player's score. The remaining seconds will be converted to bestsecond and the minutes will be bestminute. That's it!

2
  • 1
    Testfor is bad practise, you should use /execute for direct aiming , then it aims only affected people. In your suggestion, the second cb won't ever know, who was tested positively vs first one. Jun 3, 2016 at 1:30
  • @AntoineHejlík /testfor was part of my edit to this answer. Feel free to make your own edit to fix my assumption (I'm not sure what you mean —and have never used execute— so I can't amend it myself) Sep 11, 2020 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .