Skip to content

Commit 3ddd4ec

Browse files
sovdeethgitbook-bot
authored andcommitted
GITBOOK-63: change request with no subject merged in GitBook
1 parent d084298 commit 3ddd4ec

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core-concepts/variables/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ command /home:
7474
teleport player to {home::%player's uuid%}
7575
```
7676

77+
{% hint style="warning" %}
78+
#### Note on Using Expressions in Variable Names
79+
80+
Notice that in the home example, we're using the expression `player's uuid` in the variable name. Remember, we can't just write that directly in the variable name. Skript would think we literally mean "player's uuid" instead of replacing it with the uuid we actually want.
81+
82+
So we make sure to surround it with `%`, so that Skript know it's an expression, not a literal bit of text.
83+
84+
```applescript
85+
# Correct!
86+
{variable::%player's uuid%} -> {variable::0841f144-e999-42a2-a83e-9ceaf8732de4}
87+
88+
# Incorrect :(
89+
{variable::player's uuid} -> {variable::player's uuid}
90+
```
91+
{% endhint %}
92+
7793
Now each player has a unique home variable that we can get using their uuid. Note the use of `::` in the variable name. This is used to create list variables, which are explained [here](list-basics.md), with a more in- depth explanation [here](../lists/). The main thing to understand is that using `::` means we have much more power over the variable. We can delete all homes at once, we can easily see all the homes that are set, and much more.
7894

7995
```applescript

0 commit comments

Comments
 (0)