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 Get the remaining element of list variable?

Discussion in 'Skript' started by Scholler, Jun 1, 2019.

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

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    So I am working on an event skript, and currently I am creating the script for the tntrun event. It adds every player to a list variable when they join, and when they fall, it removes them from the list-variable.
    It detects when only 1 player is left (so there is 1 element left in the list variable), and the question is: How can I get its name?
    Thanks
     
  2. Best Answer:
    Post #2 by TPGamesNL, Jun 1, 2019
  3. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,285
    Likes Received:
    72
    Medals:
  4. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    Okay thanks, I will try it and tell you if it worked.
    --- Double Post Merged, Jun 1, 2019, Original Post Date: Jun 1, 2019 ---
    Okay, um.. Can you tell me how to get the number of how many elements are there in a list-variable?
    I wrote ,,It detects when only 1 player is left'' to the question because
    Code (Text):
    1. length of {intntrun::*} is 1
    didn't gave an error.
    But now, I try to add every player when they join (because it didn't work), and it gives an error:
    '::*}' is not a valid item data (event.sk, line 103: set {_length} to number of elements in {intntrun::*}')
    I am trying to get the length of the variable, length of {intntrun::*} didn't work..
    EDIT: When I try length of {intntrun::*} it says {_length} can only be set to one object, not more (event.sk, line 103: set {_length} to length of {intntrun::*}')
     
  5. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,285
    Likes Received:
    72
    Medals:
    You have to use https://skriptlang.github.io/Skript/expressions.html#ExprAmount
     
  6. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    So my code now is set {_length} to number of elements in {intntrun::*} but it gives the same ::* is not a valid item data error.
    EDIT: nvm it's number of {intntrun::*}
    --- Double Post Merged, Jun 1, 2019, Original Post Date: Jun 1, 2019 ---
    So, {intntrun::1} is <none>. {intntrun::0} is <none> too.
    --- Double Post Merged, Jun 1, 2019 ---
    1. Sorry for quoting you too much times
    2. I fixed it somehow..
    3. Thank you so much for helping.
     
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.
Loading...