Solved (kinda solved) How to cut arg1

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

Pykaxe

Member
Jul 26, 2017
32
1
0
23
code_language.skript:
command /lol [<text>]:
    trigger:
        set {_test} to length of "%arg-1%"
        if {_test} is less than 16:
            broadcast "&aYes! arg 1 is bigger than 16"
            broadcast "%arg-1%"
        else:
            broadcast "&cNo! arg1 is less than 16 "
             broadcast "%arg-1%"

How can I make my script "cut" arg-1, so instead of broadcasting this:

Hello there i am Pykaxe And this is a bad script.

It would broadcast this (so in two lines):

Hello there i am Pykaxe
And this is a bad script.
 
i may be wayyyy overthinking this but i got it working with this:
code_language.skript:
command /test [<text>]:
    trigger:
        set {_message} to arg-1
        set {_split_message::*} to {_message} split at " "
        set {_num_of_words} to size of {_split_message::*}
        set {_message_line1} to ""
        set {_message_line2} to ""
        set {_num} to 1
        loop {_num_of_words} times:
            if {_num} is less than ceiling({_num_of_words}/2):
                set {_message_line1} to "%{_message_line1}%%{_split_message::%{_num}%}% "
            else:
                set {_message_line2} to "%{_message_line2}%%{_split_message::%{_num}%}% "
            add 1 to {_num}
        broadcast "%{_message_line1}%"
        broadcast "%{_message_line2}%"
 
Do the same thing but divide num of words by 3 instead of 2 then add the necessary code

If that doesn't make sense I can help more tomorrow
 
this will split it into 3 lines. like i said before, there may be a simpler way to do this but this is all i could think of
code_language.skript:
command /test [<text>]:
    trigger:
        set {_message} to arg-1
        set {_split_message::*} to {_message} split at " "
        set {_num_of_words} to size of {_split_message::*}
        set {_message_line1} to ""
        set {_message_line2} to ""
        set {_message_line3} to ""
        set {_num} to 1
        loop {_num_of_words} times:
            if {_num} is less than ceiling({_num_of_words}/3):
                set {_message_line1} to "%{_message_line1}%%{_split_message::%{_num}%}% "
            else:
                if {_num} is less than ceiling({_num_of_words}*(2/3)):
                    set {_message_line2} to "%{_message_line2}%%{_split_message::%{_num}%}% "
                else:
                    set {_message_line3} to "%{_message_line3}%%{_split_message::%{_num}%}% "
            add 1 to {_num}
        broadcast "%{_message_line1}%"
        broadcast "%{_message_line2}%"
        broadcast "%{_message_line3}%"
 
i may be wayyyy overthinking this but i got it working with this:
code_language.skript:
command /test [<text>]:
    trigger:
        set {_message} to arg-1
        set {_split_message::*} to {_message} split at " "
        set {_num_of_words} to size of {_split_message::*}
        set {_message_line1} to ""
        set {_message_line2} to ""
        set {_num} to 1
        loop {_num_of_words} times:
            if {_num} is less than ceiling({_num_of_words}/2):
                set {_message_line1} to "%{_message_line1}%%{_split_message::%{_num}%}% "
            else:
                set {_message_line2} to "%{_message_line2}%%{_split_message::%{_num}%}% "
            add 1 to {_num}
        broadcast "%{_message_line1}%"
        broadcast "%{_message_line2}%"
what the fuck?
code_language.skript:
broadcast first element out of split arg-1 at "And this" and "And this %last element out of split arg-1 at ""And this""%"
 
what the fuck?
code_language.skript:
broadcast first element out of split arg-1 at "And this" and "And this %last element out of split arg-1 at ""And this""%"
lol i guess im better at over-complicating things than i thought...
[doublepost=1501209302,1501209201][/doublepost]actually what you posted doesnt work unless im using it wrong
 
lol i guess im better at over-complicating things than i thought...
[doublepost=1501209302,1501209201][/doublepost]actually what you posted doesnt work unless im using it wrong
I just missed ()
code_language.skript:
broadcast (first element out of split arg-1 at "And this") and "And this %last element out of split arg-1 at ""And this""%"
 
Status
Not open for further replies.