Login

Fancade Wiki

Updated Introduction to Editor Scripting.md (markdown)

... ...
@@ -34,7 +34,7 @@ You can once again see a function, but this one is called `findBlock`. In contra
34 34
let myBlock = findBlock("My Block");
35 35
setBlock(0, 0, 0, myBlock);
36 36
```
37
This line is different, because it doesn't start with the name of a function. Instead, we can see the `let` instruction, which tells JavaScript to create a new variable for us. The name of the variable is determined by the next word, `myBlock`. To store a value in the new variable, we follow the variable name with a `=` and the value to store, similar to a [[Set Variable]] block. In this case, this value is the output of the function we have used before.\\
37
This line is different, because it doesn't start with the name of a function. Instead, we can see the `let` keyword, which creates a new local variable for us. The name of the variable is determined by the next word, `myBlock`. To store a value in the new variable, we follow the variable name with a `=` and the value to store, similar to a [[Set Variable]] block. In this case, this value is the output of the function we have used before.\\
38 38
The next line looks familiar and it once again places a block at the coordinates `0, 0, 0`. But this time we don't directly input the id of our block, but instead we use the value stored in the variable which we have created before. This allows us to not only store the id of our block, but also use it in multiple other places.\\
39 39
After we have created the variable, we can change its value by adding following code in order to add a Brick next to our previous block:
40 40
```js
Fancade Wiki