2

I've been messing around with command blocks recently, and I need to be able to 'log' my command block output.

I can see the last output it had

'Gave 1 diamond to JackOBoi04' (example)

but I am trying to find a way to take said output, and log it in a book, or something like so even when I'm offline, when I come back online I can look back at the list of said command block's output, from when I was offline.

2 Answers 2

1

You can't. Besides for a simple succeeded or failed, you cannot read output from a command block.

Perhaps you could use the /clone command to clone a ton of different command blocks so you can go and look through all the copies but that is pretty unreasonable.

2
  • But does the /clone command keep the command block's previous output? Or do you mean make a copy of the command block 10 times, and run each command block at a 6 minute interval of each other, going back to the beginning of the line every hour? It's not a bad idea but setting up a 6 minute timer in between each command block could be complicated...
    – JackOBoi04
    Commented Feb 1, 2021 at 18:00
  • @JackOBoi04 /cloneing the command block will keep its data, so I just meant copy it to a storage spot and have it never run
    – Penguin
    Commented Feb 1, 2021 at 18:23
1

If you construct your command blocks to increment a scoreboard its a form of logging:

/scoreboard objectives add diamond
/scoreboard players set diamond diamond 0

The above commands creates a scoreboard objective 'diamond' then sets a fake player's score to 0 (as long as the name doesn't match the name of someone on the server you can make as many fake players as you want).

At the end of a chain of command logic, you could put the following command to 'log' the example you gave.

/scoreboard players add diamond diamond 1

Then when you want to view the results you could list the objectives of your fake player

/scoreboard players list diamond

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.