Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Easy to do leaderboards

Author
Message
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 12th Nov 2012 15:18
In my program there will be a few leaderboards or points tables really and I wondered what's the easiest way of doing this in my tier 1 program. Basically I want up to 26 ever changing variables printed using Createtext command in order from highest to lowest. Thanks for any help
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 12th Nov 2012 17:04
Are you asking for a complete design? Your request is somewhat vague.

This post has a good starting point for the basics of a leader board. You would want to do some mods to support the detail you want in your leader board.

Cheers,
Ancient Lady
AGK Community Tester
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 12th Nov 2012 17:36
Sorry if my post was a bit confusing, to try and put it simple.. Say I have 20 variables called driver1ptstotal, driver2ptstotal, driver3ptstotal etc up to 20, and each variable can have a different value, how can I get my program to list them in order highest first from top to bottom using Createtext,str to print each variable. All I can think of doing is checking whether one variable is higher then rest using if > then but this would be so long winded
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 12th Nov 2012 17:52
It would easier to use an array of UDTs, where the UDT has two entities, one is the score and the other is the name. Then, whenever a score changes, you can do a simple sorting of the array, look up boolean sorting. Then you just display starting with the first element in your array until the end.

Cheers,
Ancient Lady
AGK Community Tester
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 12th Nov 2012 18:29
You really need to use an array or a list. Using simple variables like this makes it hard do sorts. As you say, it would pages of code, but just a few lines with an array.

You need to do a sort. Sorts can ONLY be done on arrays or lists, unless you have a trivial case of three or four elements.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-05-07 11:34:39
Your offset time is: 2024-05-07 11:34:39