Solved Get the remaining element of list variable?

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

Scholler

Active Member
Aug 6, 2018
130
9
0
24
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
 
You can use https://skriptlang.github.io/Skript/expressions.html#ExprElement or simply `{_list::1}` (might work, depends on your code, first one will always work)
Okay thanks, I will try it and tell you if it worked.
[doublepost=1559388974,1559387565][/doublepost]
You can use https://skriptlang.github.io/Skript/expressions.html#ExprElement or simply `{_list::1}` (might work, depends on your code, first one will always work)
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:
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::*}')
 
Okay thanks, I will try it and tell you if it worked.
[doublepost=1559388974,1559387565][/doublepost]
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:
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::*}')
You have to use https://skriptlang.github.io/Skript/expressions.html#ExprAmount
 
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::*}
[doublepost=1559389718,1559389275][/doublepost]
You can use https://skriptlang.github.io/Skript/expressions.html#ExprElement or simply `{_list::1}` (might work, depends on your code, first one will always work)
So, {intntrun::1} is <none>. {intntrun::0} is <none> too.
[doublepost=1559390116][/doublepost]
You can use https://skriptlang.github.io/Skript/expressions.html#ExprElement or simply `{_list::1}` (might work, depends on your code, first one will always work)
1. Sorry for quoting you too much times
2. I fixed it somehow..
3. Thank you so much for helping.
 
Status
Not open for further replies.