|
| 22 Aug 2014 04:48 PM |
I need help with the OrderedDataStore.
I don't understand the whole page thing. I read this a few times:
http://wiki.roblox.com/index.php?title=Ordered_data_store
And don't really get it fully. I get that it cycles through all the pages of the data, what I don't get is suppose you want to make a top 50 leaderboard with 5 players per page. How would you make the users able to press up/down buttons to go through them using the OrderedDataStore? I do NOT want to move Gui's around, just to replace the text in the Gui's with the current page.
Is this doable with OrderedDataStores, or do I have to use regular DataStores for this? I'd much rather use OrderedDataStores, as since the Wiki says DataStores are more expensive, I will have to update the leaderboard every minute, whereas with OrderedDataStores, I can update it every second.
TL;DR:
So how do you go back a page with the OrderedDataStore? And does a Page mean that you can flip both ways with OrderedDataStores, or something else?
Thanks! |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Aug 2014 09:07 PM |
| I added a TL;DR, someone please help! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 25 Aug 2014 03:40 PM |
I just want to make sure I'm answering your question right...
Like the leader-boards in this? |
|
|
| Report Abuse |
|
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 25 Aug 2014 03:41 PM |
Forgot to post a link!
http://www.roblox.com/Time-trials-Alpha-place?id=132813372 |
|
|
| Report Abuse |
|
|
|
| 25 Aug 2014 03:46 PM |
| I didn't see any leaderboard, but probably thats what I mean. |
|
|
| Report Abuse |
|
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 25 Aug 2014 04:03 PM |
Well, I don't know if this is what you want or not. Hopefully, it is.
As a side note, I'm not sure if storing ODS data in a table is good or bad. So be warned...
local ODS = game:GetService("DataStoreService"):GetOrderedDataStore("Highscores") local PerPage = 20
AddODSTable = function(Data, Tab, Pg) for i, v in pairs(Data) do v.Pos = (Pg * PerPage) + i table.insert(Tab, v) end end
GetODS = function(Key) if not Key then local Pages = ODS:GetSortedAsync(true, PerPage) local Table = {} local Count = 0 AddODSTable(Pages:GetCurrentPage(), Table, Count) if not Pages.IsFinished then repeat Pages:AdvanceToNextPageAsync() Count = Count + 1 AddODSTable(Pages:GetCurrentPage(), Table, Count) until Pages.IsFinished end return Table else return ODS:GetAsync(Key) end end
|
|
|
| Report Abuse |
|
|
|
| 25 Aug 2014 04:13 PM |
Lol Im not sure if this is what I want or not. What I want is the leaderboard to show the top 50 players, starting with the top 10 and then players click up/down buttons to cycle through the players.
Is this doable with OrderedDataStores? Because to me it only goes forward in the pages, not backwards, which is needed for this. Either that or I don't get what the pages do at all xD. |
|
|
| Report Abuse |
|
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 25 Aug 2014 04:20 PM |
Yes, the link I posted above does that.
Select the first map (Has the most data of all the ODS in the game) and you can scroll through all the player's time in order. |
|
|
| Report Abuse |
|
|
|
| 25 Aug 2014 08:21 PM |
| Oh ok. And if you go down to the end of the list, can players scroll back up to the top? |
|
|
| Report Abuse |
|
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 25 Aug 2014 09:08 PM |
| Yes, after using the functions above it's all just table manipulation. |
|
|
| Report Abuse |
|
|
|
| 25 Aug 2014 11:07 PM |
| Ok thanks! Can you explain it more, I don't quite get it, sorry. |
|
|
| Report Abuse |
|
|
|
| 26 Aug 2014 08:48 AM |
| Can you please explain it more in-depth? |
|
|
| Report Abuse |
|
|
|
| 26 Aug 2014 12:48 PM |
| Can you please explain the code in detail? I don't quite get it. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 29 Aug 2014 09:10 AM |
| Last bump before repost I guess :P. |
|
|
| Report Abuse |
|
|