Solved Changing script on command/event

  • 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 community!

    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.
hm... im stumped i have never set variables that way.
I have just always dont thinks like
code_language.skript:
on load:
    set {type} to "type1"
[doublepost=1524423947,1524423902][/doublepost]scratch that, i just figured it out
try
code_language.skript:
variables:
    type = "type1"
 
The first example was good except one thing. As it is a variable, you'll have to surround the text with quotes. Like this:
code_language.skript:
variables:

  type = "type1"

Edit: sniped
 
hm... im stumped i have never set variables that way.
I have just always dont thinks like
code_language.skript:
on load:
    set {type} to "type1"
[doublepost=1524423947,1524423902][/doublepost]scratch that, i just figured it out
try
code_language.skript:
variables:
    type = "type1"
I just tried that and it seems to be working for now, thanks for the help. :emoji_slight_smile:
[doublepost=1524424360][/doublepost]
The first example was good except one thing. As it is a variable, you'll have to surround the text with quotes. Like this:
code_language.skript:
variables:

  type = "type1"

Edit: sniped
Oh okay, thanks. :emoji_stuck_out_tongue:
[doublepost=1524430017][/doublepost]
I just tried that and it seems to be working for now, thanks for the help. :emoji_slight_smile:
[doublepost=1524424360][/doublepost]
Oh okay, thanks. :emoji_stuck_out_tongue:
I just tried this but using the command doesn't seem to change the variable in the file. :/ It even acted as if the variable was not set at first, did i do something wrong?
 
  • Like
Reactions: Deleted member 5254
Could you give an example of the code you are using to change said variable?
 
Could you give an example of the code you are using to change said variable?
code_language.skript:
Variables:
    type = "type1"
Command /setskripttype [<text>] [<text>]:
    Permission: {@setskripttype-use-perm}
    Permission message: {@setskripttype-no-use-perm}
    Trigger:
        if command sender is player:
            if arg-1 is set:
                if arg-1 is "type":
                    if arg-2 is set:
                        if arg-2 is "type1":
                            if {type} is "type1":
                                message "{@type-already-type1}"
                            else:
                                set {type} to "type1"
                                message "{@you-set-type-type1}"
                        else if arg-2 is "type2":
                            if {type} is "type2":
                                message "{@type-already-type2}"
                            else:
                                set {type} to "type2"
                                message "{@you-set-type-type2}"
                        else:
                            message "{@invalid-type-value}"
                    else:
                        message "{@setskripttype-value-not-set}"
                else:
                    message "{@invalid-setting}"
            else:
                message "{@setskripttype-setting-not-set}"
        else if command sender is console:
            #I'll spare you for almost the same code(just some extra messages and stuff)
On load:
    if {type} is not set:
        set {type} to "type1"
When i use the command it does change the way my script works as it should but it doesn't change what is typed at this part:
code_language.skript:
Variables:
    type = "type1"
Example:
code_language.skript:
Variables:
    type = "type1"
Then i execute the command /setskripttype type type2
code_language.skript:
Variables:
    type = "type2"
But instead it just changes the way it works but not the text at that part. :/
 
It won't actually change what is written in your skript itself, it will just change the variable that is saved in the CSV file
 
It won't actually change what is written in your skript itself, it will just change the variable that is saved in the CSV file
I see, does that mean i can just remove the "Variables = "type1"" part? The on load should still set it to type1 if it is not set so it should work, right?
 
Status
Not open for further replies.