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

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Help with some characters can't replaced.

Discussion in 'Skript' started by blackid512, Apr 25, 2020.

Thread Status:
Not open for further replies.
  1. blackid512

    blackid512 Member

    Joined:
    May 8, 2017
    Messages:
    23
    Likes Received:
    0
    Can someone help me with color format isn't replaced

    Method 1: #looping
    Code (Skript):
    1.  
    2. command /acac [<text>]:
    3.     trigger:
    4.         if arg is not set:
    5.             set {_arg} to "null"
    6.             set {_name} to "null"
    7.         if arg is set:
    8.             set {_arg} to "%arg%"
    9.             set {_name} to "%arg%"
    10.         add "&a" to {_color::*}
    11.         add "&b" to {_color::*}
    12.         add "&c" to {_color::*}
    13.         add "&d" to {_color::*}
    14.         add "&e" to {_color::*}
    15.         add "&f" to {_color::*}
    16.         add "&r" to {_color::*}
    17.         add "&0" to {_color::*}
    18.         add "&1" to {_color::*}
    19.         add "&2" to {_color::*}
    20.         add "&3" to {_color::*}
    21.         add "&4" to {_color::*}
    22.         add "&5" to {_color::*}
    23.         add "&6" to {_color::*}
    24.         add "&7" to {_color::*}
    25.         add "&8" to {_color::*}
    26.         add "&9" to {_color::*}
    27.         loop {_color::*}:
    28.             replace all "%loop-value%" in {_name} with ""
    29.         set {_l} to length of {_name}
    30.         set {_l} to {_l} parsed as integer
    31.         send "&bArgument: &a%{_arg}% => %length of {_arg}%"
    32.         send "&bVar: &a%{_name}% => %{_l}%"
    33.         send "&bHashed Argument: &a%hashed {_arg}%"
    34.         send "&bHashed Var: &a%hashed {_name}%"
    35.         stop
    36.  
    Method 2: #Manual set (double "&&")
    Code (Skript):
    1.  
    2. command /acac [<text>]:
    3.     trigger:
    4.         if arg is not set:
    5.             set {_arg} to "null"
    6.             set {_name} to "null"
    7.         if arg is set:
    8.             set {_arg} to "%arg%"
    9.             set {_name} to "%arg%"
    10.         replace all "&&a" in {_name} with ""
    11.         replace all "&&b" in {_name} with ""
    12.         replace all "&&c" in {_name} with ""
    13.         replace all "&&d" in {_name} with ""
    14.         replace all "&&e" in {_name} with ""
    15.         replace all "&&f" in {_name} with ""
    16.         replace all "&&r" in {_name} with ""
    17.         replace all "&&0" in {_name} with ""
    18.         replace all "&&1" in {_name} with ""
    19.         replace all "&&2" in {_name} with ""
    20.         replace all "&&3" in {_name} with ""
    21.         replace all "&&4" in {_name} with ""
    22.         replace all "&&5" in {_name} with ""
    23.         replace all "&&6" in {_name} with ""
    24.         replace all "&&7" in {_name} with ""
    25.         replace all "&&8" in {_name} with ""
    26.         replace all "&&9" in {_name} with ""
    27.  
    28.             set {_l} to length of {_name}
    29.             set {_l} to {_l} parsed as integer
    30.         send "&bArgument: &a%{_arg}% => %length of {_arg}%"
    31.         send "&bVar: &a%{_name}% => %{_l}%"
    32.         send "&bHashed Argument: &a%hashed {_arg}%"
    33.         send "&bHashed Var: &a%hashed {_name}%"
    34.         stop
    35.  
    Method 3: #Manual (Single "&")
    Code (Skript):
    1.  
    2. command /acac [<text>]:
    3.     trigger:
    4.         if arg is not set:
    5.             set {_arg} to "null"
    6.             set {_name} to "null"
    7.         if arg is set:
    8.             set {_arg} to "%arg%"
    9.             set {_name} to "%arg%"
    10.         replace all "&a" in {_name} with ""
    11.         replace all "&b" in {_name} with ""
    12.         replace all "&c" in {_name} with ""
    13.         replace all "&d" in {_name} with ""
    14.         replace all "&e" in {_name} with ""
    15.         replace all "&f" in {_name} with ""
    16.         replace all "&r" in {_name} with ""
    17.         replace all "&0" in {_name} with ""
    18.         replace all "&1" in {_name} with ""
    19.         replace all "&2" in {_name} with ""
    20.         replace all "&3" in {_name} with ""
    21.         replace all "&4" in {_name} with ""
    22.         replace all "&5" in {_name} with ""
    23.         replace all "&6" in {_name} with ""
    24.         replace all "&7" in {_name} with ""
    25.         replace all "&8" in {_name} with ""
    26.         replace all "&9" in {_name} with ""
    27.         set {_l} to length of {_name}
    28.         set {_l} to {_l} parsed as integer
    29.         send "&bArgument: &a%{_arg}% => %length of {_arg}%"
    30.         send "&bVar: &a%{_name}% => %{_l}%"
    31.         send "&bHashed Argument: &a%hashed {_arg}%"
    32.         send "&bHashed Var: &a%hashed {_name}%"
    33.         stop
    34.  
    All the method above isn't working.
    I still have one more method, but I don't know the syntax.
    Like this: set {_var} to first character after "&"
    Can somebody help me?
     
  2. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    344
    Likes Received:
    21
    %uncolored {_var}%
     
  3. blackid512

    blackid512 Member

    Joined:
    May 8, 2017
    Messages:
    23
    Likes Received:
    0
    Plz read the skript code with very detailed.
    The length is still contains the color characters :/
    --- Double Post Merged, Apr 26, 2020, Original Post Date: Apr 25, 2020 ---
    Can someone help me?
    @ShaneBee
     
  4. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    344
    Likes Received:
    21
    Wait, i'm testing a method
     
  5. blackid512

    blackid512 Member

    Joined:
    May 8, 2017
    Messages:
    23
    Likes Received:
    0
    Okay thx, it already fixed by myself.
    The method is like this, by replacing all the loop-value to uncolored loop-value, I used double "&&" and double character.
    Code (Skript):
    1.  
    2. command /acac [<text>]:
    3.     trigger:
    4.         if arg is not set:
    5.             set {_arg} to "null"
    6.             set {_name} to "null"
    7.         if arg is set:
    8.             set {_arg} to "%arg%"
    9.             set {_name} to "%arg%"
    10.         add "&&aa" to {_color::*}
    11.         add "&&bb" to {_color::*}
    12.         add "&&cc" to {_color::*}
    13.         add "&&dd" to {_color::*}
    14.         add "&&ee" to {_color::*}
    15.         add "&&ff" to {_color::*}
    16.         add "&&rr" to {_color::*}
    17.         add "&&00" to {_color::*}
    18.         add "&&11" to {_color::*}
    19.         add "&&22" to {_color::*}
    20.         add "&&33" to {_color::*}
    21.         add "&&44" to {_color::*}
    22.         add "&&55" to {_color::*}
    23.         add "&&66" to {_color::*}
    24.         add "&&77" to {_color::*}
    25.         add "&&88" to {_color::*}
    26.         add "&&99" to {_color::*}
    27.         loop {_color::*}:
    28.             set {_color} to "%uncolored loop-value%"
    29.             #send "%{_color}%"
    30.             replace all "%uncolored loop-value%" in {_name} with ""
    31.         set {_l} to length of {_name}
    32.         set {_l} to {_l} parsed as integer
    33.         send "&bArgument: &a%{_arg}% => %length of {_arg}%"
    34.         send "&bVar: &a%{_name}% => %{_l}%"
    35.         send "&bHashed Argument: &a%hashed {_arg}%"
    36.         send "&bHashed Var: &a%hashed {_name}%"
    37.         stop
    38.  
    --- Double Post Merged, Apr 26, 2020, Original Post Date: Apr 26, 2020 ---
    Bro, I forget where's the place to close threads?
     
  6. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    344
    Likes Received:
    21
    You can't close threads but to mark it as solved click edit thread and Click "(No Prefix)" you'll see Solved click it and click Save Thread
     
  7. blackid512

    blackid512 Member

    Joined:
    May 8, 2017
    Messages:
    23
    Likes Received:
    0
    Already.
     
  8. Dave

    Dave Active Member

    Joined:
    Jul 20, 2018
    Messages:
    228
    Likes Received:
    9
    add "&a", "&b", "&c", "&d", "&f", "&r", "&0", "&1", "&2", "&r", "&4", "&5", "&6", "&7", "&8" and "&9" to {_color::*}


    replace every "" with "" in {_name}
     
  9. blackid512

    blackid512 Member

    Joined:
    May 8, 2017
    Messages:
    23
    Likes Received:
    0
    Thx, it's already fixed by myself.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...