Top leaderboard using Arrays.

Howdy, this is a thread regarding top leaderboard. This implemented code is using arrays.


Player event( Join) -> If variable NOT exists( %player%_arrIndex(saved)) -> Increment variable( GlobalIndex(saved)) -> Set variable( %player%_arrIndex(saved) = GlobalIndex) -> Insert element( arr(TopLeaderboard(saved)), index = GlobalIndex, Value = "0, %player%")

Player event( Kill) -> Increment variable( %player%-kills) -> Combine text( "%player%-kills kills by " + "%player%", %player%-combined-text) -> Replace element( TopLeaderboard, %player%_arrIndex, "%player%-combined-text") -> Call function( Leaderboard.Refresh)

Function( Leaderboard.Refresh) -> Sort array( *descending*, TopLeadeboard, TLBsorted(saved)) -> Get element( TLBsorted, 1, Top#1(saved)) -> Get element( TLBsorted, 2, Top#2(saved)) -> Get element( TLBsorted, 3, Top#3(saved)) -> Create hologram( TOPLB, var(Top#1, Top#2, Top#3)


Python:
# Player Join Event
Player event(Join) -> If variable NOT exists(%player%_arrIndex(saved))
    -> Increment variable(GlobalIndex(saved))
    -> Set variable(%player%_arrIndex(saved) = GlobalIndex)
    -> Insert element(arr(TopLeaderboard(saved)), index = GlobalIndex, Value = "0, %player%")

# Player Kill Event
Player event(Kill) -> Increment variable(%player%-kills)
    -> Combine text("%player%-kills kills by " + "%player%", %player%-combined-text)
    -> Replace element(TopLeaderboard, %player%_arrIndex, "%player%-combined-text")
    -> Call function(Leaderboard.Refresh)

# Leaderboard Refresh Function
Function(Leaderboard.Refresh)
    -> Sort array(*descending*, TopLeaderboard, TLBsorted(saved))
    -> Get element(TLBsorted, 1, Top#1(saved))
    -> Get element(TLBsorted, 2, Top#2(saved))
    -> Get element(TLBsorted, 3, Top#3(saved))
    -> Create hologram(TOPLB, var(Top#1, Top#2, Top#3))


This code isn't fit for a large scaled game due to array size limitations & load. This is my implementation using arrays and can be found working in /ad oshot(hope so). There is another method w/o arrays and involves comparing player kills var to top 1,2,3 if they aren't in top 1,2,3 and set them as top player if there kills are more than them.

Read this far? Consider liking the post <3
 

Dhritiman_Kunti

New member
Joined
May 19, 2024
Messages
2
Howdy, this is a thread regarding top leaderboard. This implemented code is using arrays.





Python:
# Player Join Event
Player event(Join) -> If variable NOT exists(%player%_arrIndex(saved))
    -> Increment variable(GlobalIndex(saved))
    -> Set variable(%player%_arrIndex(saved) = GlobalIndex)
    -> Insert element(arr(TopLeaderboard(saved)), index = GlobalIndex, Value = "0, %player%")

# Player Kill Event
Player event(Kill) -> Increment variable(%player%-kills)
    -> Combine text("%player%-kills kills by " + "%player%", %player%-combined-text)
    -> Replace element(TopLeaderboard, %player%_arrIndex, "%player%-combined-text")
    -> Call function(Leaderboard.Refresh)

# Leaderboard Refresh Function
Function(Leaderboard.Refresh)
    -> Sort array(*descending*, TopLeaderboard, TLBsorted(saved))
    -> Get element(TLBsorted, 1, Top#1(saved))
    -> Get element(TLBsorted, 2, Top#2(saved))
    -> Get element(TLBsorted, 3, Top#3(saved))
    -> Create hologram(TOPLB, var(Top#1, Top#2, Top#3))


This code isn't fit for a large scaled game due to array size limitations & load. This is my implementation using arrays and can be found working in /ad oshot(hope so). There is another method w/o arrays and involves comparing player kills var to top 1,2,3 if they aren't in top 1,2,3 and set them as top player if there kills are more than them.

Read this far? Consider liking the post <3
didn't worked
 

deefer

Active member
Joined
May 22, 2023
Messages
39
Appreciate the effort! But you made a simple code appear so complicated and confusing by writing it in Python
only idiots would say ml code written in codeblock complicated. Goodluck translating this code in the so-called ml style:
Player event join -> Set variable Dynamic Variable: %player%joined = Text: "True"
Loop -> Select object player variable Dynamic Variable: %selected%joined = Text: "True" -> Set variable increment += Dynamic Variable %selected%score Number variable 1 -> Set variable combine texts Dynamic Variable on top slot %selected%text Dynamic Variable %selected%score Number 1 -> Player action send message %selected%text Shift+Right Click on sign set it to selected
 

deefer

Active member
Joined
May 22, 2023
Messages
39
btw the comment is pythonic but the rest of veddnt's guide isnt. This proves my point that this aalus dude doesnt know irl coding, he is too smart for this
 

deefer

Active member
Joined
May 22, 2023
Messages
39
The rest of veddnt's guide isn't useful and are easy to code + when tf did I say I didn't understand what he was trying to do, I just said he made it look complicated
irl coding, learn how to read. Never said you dont understand
 

deefer

Active member
Joined
May 22, 2023
Messages
39
Watch me coding absolutely epic stuff:

CLS
Print "Kkkkk"
END

Oh you want more?

<HTML>
<Head> <Title> Deefer trash at kkkk </title> </head>
<Body> Deefer trash at everything </BODY>
</HTML>

More?

#include <iostream>

int main()
std::cout << "Deefer is trash" << std::endl;
return 0;}

More?

public class PrintDeefer {
public static void main(String[] args) {
System.out.println("Deefer is trash");
}
}
so basically you are iust outputting the same message. What does this prove dude? Every intern knows that
 

deefer

Active member
Joined
May 22, 2023
Messages
39
dude is the type of guy to spam elif in every coding interview. No assortment, no cleaniness, just goofy ahhh style
 

Eternox

New member
Joined
Aug 4, 2024
Messages
2
Howdy, this is a thread regarding top leaderboard. This implemented code is using arrays.





Python:
# Player Join Event
Player event(Join) -> If variable NOT exists(%player%_arrIndex(saved))
    -> Increment variable(GlobalIndex(saved))
    -> Set variable(%player%_arrIndex(saved) = GlobalIndex)
    -> Insert element(arr(TopLeaderboard(saved)), index = GlobalIndex, Value = "0, %player%")

# Player Kill Event
Player event(Kill) -> Increment variable(%player%-kills)
    -> Combine text("%player%-kills kills by " + "%player%", %player%-combined-text)
    -> Replace element(TopLeaderboard, %player%_arrIndex, "%player%-combined-text")
    -> Call function(Leaderboard.Refresh)

# Leaderboard Refresh Function
Function(Leaderboard.Refresh)
    -> Sort array(*descending*, TopLeaderboard, TLBsorted(saved))
    -> Get element(TLBsorted, 1, Top#1(saved))
    -> Get element(TLBsorted, 2, Top#2(saved))
    -> Get element(TLBsorted, 3, Top#3(saved))
    -> Create hologram(TOPLB, var(Top#1, Top#2, Top#3))


This code isn't fit for a large scaled game due to array size limitations & load. This is my implementation using arrays and can be found working in /ad oshot(hope so). There is another method w/o arrays and involves comparing player kills var to top 1,2,3 if they aren't in top 1,2,3 and set them as top player if there kills are more than them.

Read this far? Consider liking the post <3
there is a slight problem with it, the array will sort by the first digit which causes for example the score of 100 to be ranked lower than 20 because it sees that 2 is bigger than 1, it will only sort properly if all the scores are the same magnitude
 
Top