1

I am making a redstone computer, and I am done making increment value, decrement value, goto function with index, stop signal, and other small things, and all is working. I am storing the main calculation value in a scoreboard value named Reg1. I would like to add a Reg0/Reg2, and I would like to know if there is any possible way to do something like: /scoreboard players set @p Reg1 Reg2, or anything like that? I want to set one variable equal to another.

I do not want to have a large amount of blocks having /testfor @p[score_Reg1 = 1] and then /scoreboard players set @p Reg2 1 and then doing the same with 2, then 3, etc...

1

This can be accomplished using /scoreboard players operation:

/scoreboard players operation <target1> <objective1> <operation> <target2> <objective2>

The available operations are:

  • += Addition: increase first first score by second
  • -= Subtraction: decrease first first score by second
  • *= Multiplication: multiply the first score by the second
  • /= Integer Division: divide first score by second
  • %= Modular Division: set first score to the remainder when it's divided by the second
  • = Assign: set first score to the second
  • < Min: set first score to the min of either score
  • > Max: set first score to the max of either score
  • >< Swap: swaps the scores around

What you want to do should be:

/scoreboard players operation @p Reg1 = @p Reg2
  • Thank you very much, i solved it by making three command blocks in a chain in this order: 1. "/scoreboard players operation @p Reg0 = @p Reg1" 2. "/scoreboard players operation @p Reg1 = @p Reg2" 3. "/scoreboard players operation @p Reg2 = @p Reg0". I marked your response as accepted. – DriverUpdate Sep 21 '16 at 18:22

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.