Discuss Scratch

D1N0_the_animator
Scratcher
4 posts

HELP ME PLEASE!!!

I REALLY NEED HELP I'm trying to make a leaderboard so I tried a simple script that you can find right here I would really appreciate some help
ITS_DINO_XD
Scratcher
100+ posts

HELP ME PLEASE!!!

bump
ITS_DINO_XD
Scratcher
100+ posts

HELP ME PLEASE!!!

bump
RokCoder
Scratcher
1000+ posts

HELP ME PLEASE!!!

It looks like you're trying to implement a bubble sort. This is how I would approach that -

set [index v] to (1) // start at the top of the leaderboard
repeat until <(index) = (length of [leaderboard v])> // stop when we've reached the bottom of the leaderboard
set [score v] to (item (index) of [leaderboard v]) // get the score at the current index
set [nextScore v] to (item ((index) + (1)) of [leaderboard v]) // get the score at the next index
if <(nextScore) > (score)> then // if the next score is larger than the current one, swap them over
replace item (index) of [leaderboard v] with (nextScore)
replace item ((index) + (1)) of [leaderboard v] with (score)
if <(index) > (1)> then
change [index v] by (-1) // need to step towards the top of the board in case this value is bubbling up further
end
else
change [index v] by (1) // if they were in the correct order, then move to the next index

ITS_DINO_XD
Scratcher
100+ posts

HELP ME PLEASE!!!

RokCoder wrote:

It looks like you're trying to implement a bubble sort. This is how I would approach that -

set [index v] to (1) // start at the top of the leaderboard
repeat until <(index) = (length of [leaderboard v])> // stop when we've reached the bottom of the leaderboard
set [score v] to (item (index) of [leaderboard v]) // get the score at the current index
set [nextScore v] to (item ((index) + (1)) of [leaderboard v]) // get the score at the next index
if <(nextScore) > (score)> then // if the next score is larger than the current one, swap them over
replace item (index) of [leaderboard v] with (nextScore)
replace item ((index) + (1)) of [leaderboard v] with (score)
if <(index) > (1)> then
change [index v] by (-1) // need to step towards the top of the board in case this value is bubbling up further
end
else
change [index v] by (1) // if they were in the correct order, then move to the next index

tysmmmm

Powered by DjangoBB