Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

[EN] Minecraft Pro 3

No description
by

My Logiscool

on 7 July 2017

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of [EN] Minecraft Pro 3

Day 3
Variables
Variables are used to store values. There are no variables in Minecraft, but
scoreboards can be used as such.
Declaring variables
/scoreboard objectives add [name] [type] [displayName]
Variables are managed through the scoreboard command. Creating can be done with scoreboard objectives.
this is the variable's name.
When we want to use the variable, we use this name, which represents it.
The type of the variable. There are variables which change their values automatically, e.g. eaten golden apples, killed chickens etc...These begin with the word "stat", thus called
stat
variables.

Then there are standard variables, which is untouched by the game, left for the user to manage, these are
dummy
variables
If we want to display it, we can add a display name. This is limited to 16 characters, and if we don't set it, the variable's name is used.
defining variables
/scoreboard players set [entity] [variable] [value]
With the objectives, we can declare variables, so we tell the world that this variable exists. However, it does not have any value until we define it with the players command. Each entity has their own different value for an objective.
The entity who will have the variable. This can be a
selector, or better to say that this should be one.
The variables name which should be added to the player. This is the name itself, not the display name of the variable.
The value of the variable (an integer)
Displaying variables
/scoreboard objectives setdisplay [slot] [variable]
There are several places (called "slots") to display a variable. The most common is the sidebar. Keep in mind that displaying an objective is global, so applies to everybody.
The slot where the variable should be displayed.
The variable to be displayed.
Variable operations
/scoreboard players operation [player] [variable] [op] [source] [sourceVar]
Limited operations can be done with variables (not counting adding a constant to a variable, that's a different command), and requires the following command:
The player, whose variable should be changed.
the variable, which is to be used.
The variable, which should be changed
The operation sign
The other entity, whose variable should be used as an operand
Testing a variable
We can check if a variable's value is between a lower and an upper bound. THis can be done by using a specific filter in a selector. Specifically, the testfor command is used to check for entities with a specific score.
@e[score_test_min=0,score_test=5]
For example, if we want to check entities who has a "test" variable value of at least 0, but at most 5, we use the following filter:
Of course, the upper and lower bound's value can be the same, which will result in an exact value check. So we will check if it's at least, and at most a given value. The previous example for the "test" variable to check if it's exactly 8 at any entity would require this selector filter:
@e[score_test_min=8,score_test=8]
Operation signs:
+= (add), -= (subtract), *= (multiply), /= (divide), %= (modulo)
Let's build a combination lock
if...else condition
/testforblock x y z command_block -1 {SuccessCount:1}
The well known if-else from programming can be done with Command Blocks. With the knowledge of command blocks, NBT tags and the testforblock command, we can check if the command block at a location is successfully executed.
With this command, we can check if the command block at the given coordinates have successfully executed the last time it attempted to execute the command.
The "-1" states that we don't care about the block's facing. We could define that we only care about command blocks facing north, south e.g..
It was a pleasure programming with you today!
Chicken hunt!
Full transcript