write with argument?

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

Alex2542

New Member
Aug 8, 2017
5
0
0
hi, I need that my skript with a one command write a text in another skript for example:
code_language.skript:
command /test [<text>] [<text>]:
    trigger:
        write " set line 25 in file ""/plugins/Skript/scripts/Test%arg 1%.sk"" to "" player's tool is a %colored arg 2% """ at line 67 to file "/plugins/Skript/scripts/Test%arg 1%.sk"

but I need that the second argument remains unchanged (is this %colored arg 2%) but I would just do so by simply writing a first argument, but skript tells me that the second argument is missing and so doesn't work :emoji_frowning:
Please help me
Obviously I use skUtilities.
 
I'm not sure I understand what you want exactly. Let me know if I'm wrong here. So you want to be able to set that lin in the file using either both arguments in the command OR one argument on it's own, does that sound right?
If so you can add a condition to the command that if arg-2 is not set, write the set line section without %colored arg-2%. Because it is present in the effect, skript is expecting the information to be input into the command despit the fact your [<text>] portions are optional.
To fully pull that off when arg 2 is set, you'll want to save it to a variable( like {arg2.color} for example) so that you can refernce it when you only want to use one argument in the command. It could potentially look like this:
code_language.skript:
command /test [<text>] [<text>]:
    trigger:
        if arg 2 is not set:
            write " set line 25 in file ""/plugins/Skript/scripts/Test%arg 1%.sk"" to "" player's tool is a %{arg2.color}% """ at line 67 to file "/plugins/Skript/scripts/Test%arg 1%.sk"
            stop
        else:
            set {arg2.color} to colored arg 2
            write " set line 25 in file ""/plugins/Skript/scripts/Test%arg 1%.sk"" to "" player's tool is a %colored arg 2% """ at line 67 to file "/plugins/Skript/scripts/Test%arg 1%.sk"
 
I'm not sure I understand what you want exactly. Let me know if I'm wrong here. So you want to be able to set that lin in the file using either both arguments in the command OR one argument on it's own, does that sound right?
If so you can add a condition to the command that if arg-2 is not set, write the set line section without %colored arg-2%. Because it is present in the effect, skript is expecting the information to be input into the command despit the fact your [<text>] portions are optional.
To fully pull that off when arg 2 is set, you'll want to save it to a variable( like {arg2.color} for example) so that you can refernce it when you only want to use one argument in the command. It could potentially look like this:
code_language.skript:
command /test [<text>] [<text>]:
    trigger:
        if arg 2 is not set:
            write " set line 25 in file ""/plugins/Skript/scripts/Test%arg 1%.sk"" to "" player's tool is a %{arg2.color}% """ at line 67 to file "/plugins/Skript/scripts/Test%arg 1%.sk"
            stop
        else:
            set {arg2.color} to colored arg 2
            write " set line 25 in file ""/plugins/Skript/scripts/Test%arg 1%.sk"" to "" player's tool is a %colored arg 2% """ at line 67 to file "/plugins/Skript/scripts/Test%arg 1%.sk"
yes, you understand perfectly, but it doesn't work, this have set <none> instead of %colored arg 2% :emoji_frowning:

code_language.skript:
set line 25 in file "/plugins/Skript/scripts/Testtest.sk" to "        player's tool is <none> "
[doublepost=1502472485,1502400274][/doublepost]Please, can anyone help me?
 
Status
Not open for further replies.