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 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.

KarimAKL

Active Member
Apr 20, 2018
50
2
0
29
Hey, i wanna know if it's possible to change the text in script on command/event kinda like this:
Code:
Options:
    type: type1
and then on command "/whatever change type type2" would then change type to type2 so that it would say:
Code:
Options:
    type: type2
I wanna know if doing that is possible in skript and if it is possible then i wanna know how, thanks for the attention. :emoji_slight_smile:
 
:emoji_raised_hands: variables :emoji_raised_hands:

code_language.skript:
command /test <text>:
    trigger:
        set {type} to arg-1
 
:emoji_raised_hands: variables :emoji_raised_hands:

code_language.skript:
command /test <text>:
    trigger:
        set {type} to arg-1
Wouldn't it be "{@type}" instead of "{type}"? Anyway, thanks for the answer, i'll try testing it now and see if it works, if it does work i'll change this to solved. :emoji_slight_smile:
 
you cant set an option which is why i said to use variables
I can't set options? That sounds weird, then what would i do instead? (i'm trying to make a script for people who can't make scripts themselves so that's why i wanna make options for them to change and then i thought it would be easier if they could use a command aswell :emoji_stuck_out_tongue: )
 
ok i guess i described that poorly. you can set a option once in the option section but you cannot change it later in a command like you want. For that you have to use variables which you can dynamically set in commands and stuff
 
ok i guess i described that poorly. you can set a option once in the option section but you cannot change it later in a command like you want. For that you have to use variables which you can dynamically set in commands and stuff
Okay, i don't think i quite understand that, i'll just try setting the option and see how it goes and then i'll come back. :emoji_stuck_out_tongue:
EDIT: I just tried but it seems
Code:
set {@type} to arg-2
doesn't work. :emoji_stuck_out_tongue: I also tried
Code:
set "{@type}" to arg-2
And
Code:
set "{@type}" to "%arg-2%"
But those didn't work either. :/
What would you do if you wanted to create an option for this? :?
[doublepost=1524412252,1524410525][/doublepost]You still there?
 
as i said about 5 times, you cant set an option. use variables
If i can't do it with options(at all) then i just think i'll have them need to change it manually instead of using a command. :7 Anyway, thanks. :emoji_stuck_out_tongue:
 
Are you going for something like this, where you can change the skript manually?

code_language.skript:
options:
    type: type1
    
on right click:
    if "{@type}" is "type1":
        send "Boom"
    if "{@type}" is "type2":
        send "Da":

Or are you trying to make it so they could change the skript type in game?
 
Are you going for something like this, where you can change the skript manually?

code_language.skript:
options:
    type: type1
   
on right click:
    if "{@type}" is "type1":
        send "Boom"
    if "{@type}" is "type2":
        send "Da":

Or are you trying to make it so they could change the skript type in game?
I'm trying to make it so that instead of going into the script and change it manually from "type: type1" to "type: type2" they can just type it in a command and it'll change it for them. :emoji_stuck_out_tongue:
 
I'm trying to make it so that instead of going into the script and change it manually from "type: type1" to "type: type2" they can just type it in a command and it'll change it for them. :emoji_stuck_out_tongue:
I'm not sure if it is possible to set options in game, but like Karim said, it is possible to do a similar thing with variables.
code_language.skript:
command /setskripttype <text>:
    trigger:
        player has permission "skript.changetype"
        if arg 1 is "type1":
            set {type} to "type1"
            send "&eSuccessfully changed Skript type to type 1!"
        if arg 1 is "type2":
            set {type} to "type2"
            send "&eSuccessfully changed Skript type to type 2!"
on right click:
    if {type} is "type1":
        send "Boom"
#YOUR CODE HERE
    if {type} is "type2":
        send "Da"
#YOUR CODE HERE
 
I'm not sure if it is possible to set options in game, but like Karim said, it is possible to do a similar thing with variables.
code_language.skript:
command /setskripttype <text>:
    trigger:
        player has permission "skript.changetype"
        if arg 1 is "type1":
            set {type} to "type1"
            send "&eSuccessfully changed Skript type to type 1!"
        if arg 1 is "type2":
            set {type} to "type2"
            send "&eSuccessfully changed Skript type to type 2!"
on right click:
    if {type} is "type1":
        send "Boom"
#YOUR CODE HERE
    if {type} is "type2":
        send "Da"
#YOUR CODE HERE
Then, why not just use a variable? It is the simplest way to do it.
Then how would i do it? Maybe like this?:
code_language.skript:
Variables:
    type = type1
Command /setskripttype [<text>]:
    Trigger:
        if arg-1 is set:
            set {type} to "%arg-1%"
Or is that wrong? Or maybe:
code_language.skript:
Variables:
    {type} = type1
Also, would i be able to do this?:
code_language.skript:
Command /setskripttype [<text>]:
    Trigger:
        if {type} is "type1":
            #Do something
 
Heres my feedback.
Several people have tried to explain to you, do not use options.
Options are a ONE TIME set thing at the top of your skript to call upon in your skript multiple times, kinda like a mini function, rather than having to type out said option each and every time, you can call upon it multiple times.
Use variables. You can set them, change them etc with commands, and constantly keep updating them with a multitude of events.

Based on what Ive read here, and all the suggestions people have given you and the fact you dont understand any of it, I would suggest reading THIS .... a quick read from the original creator of Skript on how variables work. I think this would be worth your while.
 
Well, if I understood correctly, the OP wanted to use options since he wanted people to be able to change it in the script but also able to do it using a command so I can understand why he's trying to stick on options. Although this problem could have been solved in two or three posts if you explained your issue correctly, I'd like you to keep that in mind.

As for your question in your last post, yeah, the first example is just fine and should work for what you want to achieve.
 
Heres my feedback.
Several people have tried to explain to you, do not use options.
Options are a ONE TIME set thing at the top of your skript to call upon in your skript multiple times, kinda like a mini function, rather than having to type out said option each and every time, you can call upon it multiple times.
Use variables. You can set them, change them etc with commands, and constantly keep updating them with a multitude of events.

Based on what Ive read here, and all the suggestions people have given you and the fact you dont understand any of it, I would suggest reading THIS .... a quick read from the original creator of Skript on how variables work. I think this would be worth your while.
I have read that already but did again just now just to be sure i didn't miss anything.
Well, if I understood correctly, the OP wanted to use options since he wanted people to be able to change it in the script but also able to do it using a command so I can understand why he's trying to stick on options. Although this problem could have been solved in two or three posts if you explained your issue correctly, I'd like you to keep that in mind.

As for your question in your last post, yeah, the first example is just fine and should work for what you want to achieve.
Yeah, you understand what i'm trying to do and okay i'll try that then, thanks. :emoji_slight_smile:
[doublepost=1524422641,1524422163][/doublepost]
I have read that already but did again just now just to be sure i didn't miss anything.

Yeah, you understand what i'm trying to do and okay i'll try that then, thanks. :emoji_slight_smile:
I just tried this:
code_language.skript:
Variables:
    type = type1
But it says: Can't understand the value 'type1'
 
Status
Not open for further replies.