Solved Command arg with more than 1 word

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

MrNygus

Active Member
Jan 28, 2017
116
2
18
26
Hi I want to do this:

/test "more than" "more than two"

command /ttest <text> <text>:
trigger:
if arg 1 isn't empty:
if arg 2 isn't empty:
addSmth(arg 1, arg 2)

I want to add arg-1 to key and arg-2 to value
more than = more than two
 
I want to get by command two strings like this but without " chars:
/test "more than" "more than two"

and I want to add these texts to array like:
more than = more than two

if key have to be one word, i want to split it by char to get text
more_than = more than two
dosplit(array.more_than)
and get:
more than
 
i am not sure if this is what you want.

arg-1 is key
arg-2 is value
Code:
command /test [<text>] [<text>]:
    trigger:
        if arg-1 is set:
            if arg-1 is set:
                add arg-2 to {array::%arg-1%}

and read from array using this command

Code:
command /readarray [<text>]:
    trigger:
        if arg-1 is set:
            if arg-1 is "all":
                loop {array::*}:
                    send "%loop-value%"
                stop
            send "%{array::%arg-1%}%"
 
another
/test "this will be a key" this will be a value
I want to get text between " and replace space to _, and save it like key, the rest of text will be a value
this_will_be_a_key = this will be a value
 
so you mean if arg-1 is this and arg-2 is will

it will replace space with _

and output this_will
 
omg xd I don't understand you now xd

NOW I have:

command /test <text>

/test "this will be a key" this will be a value

I want to get text between ", and set it to {_key} with replaced " " to "_" and remove " chars, rest of text I want to set to {_val}

this_will_be_a_key = this will be a value
 
Code:
command /test <text>:
    trigger:
        if arg 1 isn't empty:
            set {_ar1} to arg-1
            set {_s::*} to split {_ar1} at """"

            set {_key} to {_s::2}
            replace all " " with "_" in {_key}
            send {_key}
            set {_value} to last (length of {_s::3} - 1) characters of {_s::3}
            send {_value} to player
        else:
            send "Nie moga byc puste" to player
done xd
 
Oops! You actually need 2 arguments to be able to put them together into one. At least I think so.
Code:
command /test [<text>] [<text>]:
    trigger:
        if arg 1 isn't empty:
            set {_ar1} to arg-1
            set {_s::*} to split {_ar1} at """"
 
            set {_key} to {_s::2}
            replace all " " with "_" in {_key}
            send {_key}
            set {_value} to last (length of {_s::3} - 1) characters of {_s::3}
            send {_value} to player
        else:
            send "Nie moga byc puste" to player
 
Last edited:
Status
Not open for further replies.