I'm working on a map, and I need to know a few things. Is there a way to test for variables? Can you put a=1 and then in another block put "if a=1 then..."
Also, can you make the command block give enchanted items? I can get basic items to work, but not enchanted ones.
There are a few variables possible. Scoreboard variables, location, team, area, gamemode, and a few more.
To test for them, use this base code
/testfor @a[variable]
For scoreboard objectives, it is like this
To test for an exact number on the objective
/testfor @a[score_(objective name)=(Number)
To test if an objective is less than a certain number
/testfor @a[score_(objective name)_max=(number)
And to test if the score is more than a certain number
/testfor @a[score_(objective name)_min=(number)
For teams,
/testfor @a[team=(team name)]
To test for location
/testfor @a[x=*,y=*,z=*]
*Note, '*' symbol means you put the coordinates there
To test if a person is in a certain radius,
/testfor @a[r=(number)]
And to test if they are outside of a radius
/testfor @a[rm=(number)]
To test for gamemode,
/testfor @a[m=(0,1,2)]
To test for the number of levels someone has,
/testfor @a[l=(number)]
and for minimum number of levels
/testfor @a[lm=(number)]
*Post Script - Put a ! before any variable to test if that isn't true. - You can put more than 1 variable in at a time, separate them with commas and no spaces. - Use a comparator facing out of a command block so it will become powered when the testfor is true.
Also, can you make the command block give enchanted items? I can get basic items to work, but not enchanted ones.
http://www.minecraftforum.net/topic/2114709-the-doom-of-the-doctor/
To test for them, use this base code
For scoreboard objectives, it is like this
To test for an exact number on the objective
To test if an objective is less than a certain number
And to test if the score is more than a certain number
For teams,
To test for location
*Note, '*' symbol means you put the coordinates there
To test if a person is in a certain radius,
And to test if they are outside of a radius
To test for gamemode,
To test for the number of levels someone has,
and for minimum number of levels
*Post Script - Put a ! before any variable to test if that isn't true. - You can put more than 1 variable in at a time, separate them with commas and no spaces. - Use a comparator facing out of a command block so it will become powered when the testfor is true.
For enchanting items with command blocks, look here
http://www.minecraftforum.net/topic/1969520-17-using-summon-give-datatags-in-map-making-tutorialswip/