Variables

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

FabricioSouza

Well-Known Member
Mar 15, 2018
267
3
0
25
Good, I eat there is not a section here of taking away doubts. I wanted to know what it is a Constant Variable and temporary variable. I know that it is a stupid question but I am thinking that all my variables lose the value. For example I seto a location in the variable {Lobby. Lobby}. In the same moment I use it to be able if teleportar for the location that is in this variable. Only that after ten days the variable loses his value and I do not get myself teleportar for the location that is inside this variable. In other words inside the variable nothing was setado.

Therefore that I wonder what it is a Constant Variable and temporary variable.
 
Probably gonna be wrong a bit here but

Constant:

Will never change :/

Skript: {yeet}
Java: public/private static final <type> = yeet;
NodeJS: CONST yeet = blah;

Temporary:

(Local variable)

Skript: {_oof}



Ok also just do this:

/setlobby:
set {lobby} to player’s location
message “Lobby set! Location: %{lobby}%”

/lobby:
teleport player to {lobby}
message “teleported to lobby!”


This should work, it’ll never reset lol
 
Good, I eat there is not a section here of taking away doubts. I wanted to know what it is a Constant Variable and temporary variable. I know that it is a stupid question but I am thinking that all my variables lose the value. For example I seto a location in the variable {Lobby. Lobby}. In the same moment I use it to be able if teleportar for the location that is in this variable. Only that after ten days the variable loses his value and I do not get myself teleportar for the location that is inside this variable. In other words inside the variable nothing was setado.

Therefore that I wonder what it is a Constant Variable and temporary variable.
D0XY did a pretty good explanation, but I'm just gonna say when you need to use them.

Temporary variables will be deleted after a command/trigger. You use these if you only need the variable in that trigger. Example how to and how not to use local vars:

Good:
code_language.skript:
every second:
    set {_slot} to 0
    loop 10 times:
        set slot {_slot} of player to iron bars
        add 1 to {_slot}

Bad:
code_language.skript:
command /set lobby:
    trigger:
        set {_lobby} to location of player

on join:
    teleport player to {_lobby}
^ why is that bad? Because after you do the command /set lobby, the var gets deleted.

Normal variables are stored in the 'variables.csv' file in your Skript plugin folder. If you delete this file, all your variables will be gone, so maybe you did that accidently.
 
Good, I eat there is not a section here of taking away doubts. I wanted to know what it is a Constant Variable and temporary variable. I know that it is a stupid question but I am thinking that all my variables lose the value. For example I seto a location in the variable {Lobby. Lobby}. In the same moment I use it to be able if teleportar for the location that is in this variable. Only that after ten days the variable loses his value and I do not get myself teleportar for the location that is inside this variable. In other words inside the variable nothing was setado.

Therefore that I wonder what it is a Constant Variable and temporary variable.
If you remove the world which the location was in, you can't teleport to that location.
 
Status
Not open for further replies.