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 our 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 - Lists not working!

Discussion in 'Skript' started by Jay_2004, Apr 8, 2017.

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

    Jay_2004 Member

    Joined:
    Feb 21, 2017
    Messages:
    13
    Likes Received:
    1
    Hi!
    Look at this:
    Code (Text):
    1. command /sounds [<text>] [<text>]:
    2.     trigger:
    3.         if arg 1 is not set:
    4.             send "&d&m---------------------[ &9Sounds &d&m]---------------------"
    5.             send "&a&o/sounds &7- &6&oShow this help page."
    6.             send "&a&o/sounds list &7- &6&oList every sound in the database."
    7.             send "&a&o/sounds search (sound)"
    8.             send "&aFor an example: '&6/sounds search zombie&a' this will search for all the sounds that a zombie makes."
    9.         if arg 1 is "search":
    10.             if arg 2 is set:
    11.                 loop {sound.database::*}:
    12.                     if loop-value contains "%arg-2%":
    13.                         add "%loop-value%" to {output::*}
    14.                 send "{@P} &aSearch found results for &6%arg-2%&a;"
    15.                 loop {output::*}:
    16.                     send "&6%loop-value%"
    This part:
    Code (Text):
    1.  
    2.         if arg 1 is "search":
    3.             if arg 2 is set:
    4.                 loop {sound.database::*}:
    5.                     if loop-value contains "%arg-2%":
    6.                         add "%loop-value%" to {output::*}
    7.                 send "{@P} &aSearch found results for &6%arg-2%&a;"
    8.                 loop {output::*}:
    9.                     send "&6%loop-value%"
    Doesn't work...
    What I am trying to do is to make a script with all Minecraft sounds and you can search for them, but it doesn't work. This part:
    Code (Text):
    1.  
    2.                 loop {sound.database::*}:
    3.                     if loop-value contains "%arg-2%":
    4.                         add "%loop-value%" to {output::*}
    to me I think is not working. It won't put the 'loop-value' that matches 'arg-2' (search query). For an example I type in '/sounds search zombie' it should bring up all the sounds that CONTAIN 'zombie' so 'mob.zombie.remedy' should show up in the {output::*} but it doesn't.
    --- Double Post Merged, Apr 9, 2017, Original Post Date: Apr 8, 2017 ---
    bump
    --- Double Post Merged, Apr 9, 2017 ---
    Download:
    https://www.mediafire.com/?3jn15txq1iqg856
    (Mega isn't working sorry if it's against the rules to use Mediafire but there's no direct upload button.)

     
  2. Best Answer:
    Post #4 by ShaneBee, Apr 9, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    the expresión "contains" is a bit buggy, try 'if loop-value is %arg-2%'
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Works, but doesn't do what I want it to do. If I type in /sounds search zombie it comes up with nothing. But if I type /sounds search mob.zombie.remedy it works which is not what I want.
    (Nice grammar I have there...)
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Try this (Not tested)
    Code (Skript):
    1. loop {sound.database::*}:
    2.     set {_text} to loop-value parsed as text
    3.     if {_text} contains "%arg-2%":
    4.         add "%loop-value%" to {output::*}
     
    • Useful Useful x 1
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Worked! Thank you so much!! :emoji_grinning:
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    I recomend you use a temp variable for "{output::*}" -> {_output::*}
     
Thread Status:
Not open for further replies.
Loading...