function crops(t: text):
loop {%{_t}%.break::}:
add index of loop-value to {_top::}
set {_s} to "%size of {_top::}%" parsed as integer
#set {_st} to 1
loop {_s} times:
set {_1} to {_top::%{_s}%}
set {_2} to {_top::%{_s} - 1%}
if {%{_t}%.break::%{_1}%} > {%{_t}%.break::%{_2}%}:
set {_top::%{_s} - 1%} to {_1}
set {_top::%{_s}%} to {_2}
remove 1 from {_s}
loop {_top::}:
set {%{_t}%.position::*} to index of loop-value
#Whats wrong with this function
1 messages · Page 1 of 1 (latest)
please format it properly
```vb
code here
```
` is the top left of american keyboards
same key as tilde ~
function crops(t: text):
loop {%{_t}%.break::}:
add index of loop-value to {_top::}
set {_s} to "%size of {_top::}%" parsed as integer
#set {_st} to 1
loop {_s} times:
set {_1} to {_top::%{_s}%}
set {_2} to {_top::%{_s} - 1%}
if {%{_t}%.break::%{_1}%} > {%{_t}%.break::%{_2}%}:
set {_top::%{_s} - 1%} to {_1}
set {_top::%{_s}%} to {_2}
remove 1 from {_s}
loop {_top::}:
set {%{_t}%.position::*} to index of loop-value
i copied your symbols
oh kk
function crops(t: text):
loop {%{_t}%.break::*}:
add index of loop-value to {_top::*}
set {_s} to "%size of {_top::*}%" parsed as integer
#set {_st} to 1
loop {_s} times:
set {_1} to {_top::%{_s}%}
set {_2} to {_top::%{_s} - 1%}
if {%{_t}%.break::%{_1}%} > {%{_t}%.break::%{_2}%}:
set {_top::%{_s} - 1%} to {_1}
set {_top::%{_s}%} to {_2}
remove 1 from {_s}
loop {_top::*}:
set {%{_t}%.position::*} to index of loop-value
here
oh i think i found an error
nvm
so what exactly is this meant to do
a leaderboard
it should check the amount of broken crops from every player and say which position u are
i assume %{_t}%.break is a list of player uuids and break counts?
yep
What about leaderbroards
then just use sorted indices of {%{_t}%.break::*}
could u send the skript here
eg:
loop sorted indices of {%{_t}%.break::*}:
broadcast "%loop-index% - %loop-value% with {%{_t}%.break::%loop-value%} blocks broken"
instead of the whole function
huh
assuming {%{_t}%.position::*} is a list of players in order of breaks:
set {%{_t}%.position::*} to sorted indices of {%{_t}%.break::*}
it shouldnt be broadcasted also it should be a lore of an item
yeah that's what you can do with this
i am a bit confused bec i didnt make this skript could u send me a whole working version if thats ok
sorted indices just gives you the list of players in order
no
sadge
given this, you can easily construct a lore leaderboard
ill try stuff out
@winter river i got an error "There is no loop that matches 'loop-index' "
oh yeah that would happen
you can either
set {_l::*} to sorted indices of {%{_t}%.break::*}
loop {_l::*}:
broadcast "%loop-index% - %loop-value% with {%{_t}%.break::%loop-value%} blocks broken"
or
loop sorted indices of {%{_t}%.break::*}:
add 1 to {_i}
broadcast "%{_i}% - %loop-value% with {%{_t}%.break::%loop-value%} blocks broken"
ill try both