ID:273656
Dec 4 2010, 3:39 pm
|
|
Hey, I know how to do a scoreboard in game but what I want to do is make a scoreboard that would update and place people correctly. For example lets say I'm in first place with like 1000 points 2nd place person has 900 points . Then I do something stupid and lose 200 points the scoreboard still shows me as first cause it doesn't update it just checks for higher scores and doesn't check for lower ones. If you need the code I had used just say so and ill post it
|
In response to Pirion
|
|
I ment ingame not on the byond HUB
|
In response to Inferno L Flames
|
|
Depends on you you have your scoreboard set up... you of all people should know this. You were one of the ones who helped me get started coding. If you have it like most anime games that will be hard to do since the score isn't saved in a file. the best method would be to save and load scores in a scores file using arrays and such. that way you can subtract and add whenever you need it.
|
In response to Leur
|
|
Never been too good at arrays but I've been tinkering with them recently. I don't know why I didnt think of using arrays I mean if I can make a buddy list that shows when people are online and offline i can do a highscore board.
|
In response to Inferno L Flames
|
|
an array like below along with a simple sort function will get you what you need.
mob/var/list/arraytosort = list("item1"=100,"item2"=200,"item3"=900,"item4"=50, "item5"=150) |
In response to Pirion
|
|
Ok I'm starting to get it I got it to order the stuff from highest to lowest instead of the other way around but the problem is not is getting it read every body and not only update for people online if i can get it to do that i can handle the rest
|
In response to Inferno L Flames
|
|
Ok I found a tutorial that pretty much does what I need it to do but I cant figure out how to add more variables. Ugh I'm so bad with arrays
//Scores |
In response to Inferno L Flames
|
|
That is how to do it with params, prob not the best way to do it in my opinion.
Using the below, the add_scores_proc uses a list of lists to add the following for any entry: scores[player name]["rank"] is a rank scores[player name]["points"] are points earned you can add as many as you want of any name, and as long as the first set of brackets are the player name (or something to link them together) scores[player name]["level"] scores[player name]["tiredness"] etc.. to sort this at any time, you would save it and load it, all entries are accessible even when players are not online. The way this is coded, you would have to load all scores every time. To update only existing, you would want to check scores[player name] is a list. If it is, then just update (without adding a new() list.) var/list/scores = list() |
In response to Pirion
|
|
really silly question but then to show it all i would have to do is make a browser with the set HTML right?
|
In response to Inferno L Flames
|
|
Yes, like I added in the example.
src << browse(add_scores_proc(player,points,rank))//send to browser |
"Sending an empty text string for the fields will erase the scores for that key."