Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #31  
Old 12-12-2014, 05:13 PM
prozacboy666 prozacboy666 is offline
Registered User
Join Date: Mar 2002
Posts: 130
prozacboy666 will become famous soon enough
Quote:
Originally Posted by xAndrewx View Post
You'd need three queries.
1,) Find the minimum score
2,) Add the score
3,) Delete old score


I guess it's what you want to store.
I just find it easier because when you want to display the top20 scores, in SQL is does all the work for you and faster than getting all the results and then do some type of sorting function.

Did you use another solution? I am curious on how you did it.
Reply With Quote
  #32  
Old 12-14-2014, 05:49 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Using SQL when you have a small fixed number of rows that you're not even performing real queries on doesn't make any sense.

If all you want is a list of the top 25 players, store them in an array in a DB NPC flag. There are built-in (fast) functions for sorting arrays, and performance is not an issue here anyway (but I'd be willing to bet this is faster than constantly shuffling things in/out of SQLite, anyway).

The only way I see the code being simpler is if you store all players in a table, and use a query (SELECT .. ORDER BY .. LIMIT 25), which is how I would recommend doing it.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:46 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.