1

Is there any way to use scoreboard objectives as arguments for commands?

For example, say I have a command block that should teleport a player to a location based on their score.

tp Notch score_Notch_Deaths 0 0

This should teleport Notch to an x-coordinate based on his Deaths score.

If this is possible, what would the actual syntax be?

2

There is no way to directly use an objective as a command argument. Dinnerbone has said that the reason for this is that he wanted to avoid making commands into a full programming language.

The best you can do is something like this:

tp @a[score_Notch_Deaths_min=1,score_Notch_Deaths=1] 1 0 0
tp @a[score_Notch_Deaths_min=2,score_Notch_Deaths=2] 2 0 0
tp @a[score_Notch_Deaths_min=3,score_Notch_Deaths=3] 3 0 0

In separate command blocks, and then activate them all at once. It would be tedious to do by hand, so I'd suggest using an MCEdit filter such as Texelelf's command block filter to fill out the incrementing values automatically.

  • This is too bad; I like programming languages! – Kendall Frey Apr 5 '14 at 17:25
-3

You need to do it recursively.

do this: /tp Notch 0 0 0

then you need these on a fill clock

/tp @a[name=Notch,score_Deaths_min=1] ~1 ~ ~
/scoreboard players remove Notch Deaths 1
  • 1
    While the idea behind this answer can work, the implementation lacks several commands, such as the one keeping Deaths from decreasing into minus infinity. Furthermore, it is badly described and I could only figure out what you meant by reading the existing answer. – MrLemon Jun 28 '15 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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