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 3 Quick Questions

Discussion in 'Skript' started by A248, Aug 6, 2017.

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

    A248 Member

    Joined:
    Jan 31, 2017
    Messages:
    43
    Likes Received:
    3
    1. Can a function (SkQuery) return a list variable?
    Code (Skript):
    1. function getList(path: text, file: text) :: list:
    2.     set {_list::*} to yml list "%{_path}%" of file "%{_file}%"
    3.     return {_list::*}
    2. Does deleting a yml path delete all subpaths as well?
    Code (Skript):
    1. on load:
    2.     set yml value "Value.First" of file "{@file}" to {first}
    3.     set yml value "Value.Second" of file "{@file}" to {second}
    4.     delete yml value "Value" of file "{@file}" #Does this delete both values specified above?
    3. UUID of player returns a text, correct?
    Code (Skript):
    1. on join:
    2.     if "%UUID of player%" = UUID of player:
    3.         set join message to "This message will always be broadcasted. &a%name of player% &7joined the game."
    4.     else:
    5.         set join message to "this message will never been seen. &a%name of player% &7joined the game."
     
  2. Best Answer:
    Post #2 by ShaneBee, Aug 6, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    1. Just put the plural form of the returned type. If you're returning string objects you'd use:
    Code (Skript):
    1. function getList(path: text, file: text) :: texts:
    2.  
    3.     return yml list {_path} of file {_file}
    4.  
    5. #By the way, this function is utterly useless and pointless. Never do functions for something that's just one line.
    2. Yes, it does, you should try it instead of ask.

    3. Yes, again, you should try it instead of ask.
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Thanks!

    I need to return a list for something else, not yml.

    So, 'texts' should replace 'list' for the returned type?
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Yes.
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Thank you so much.


    Will mark as solved.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...