ID:140974
 
Code:
mob/proc/Kills()
spawn(-1)
var/list/records
var/result = world.GetScores(key, "")
if(isnull(result))
src << "Sorry, the hub could not be contacted to record your score."
return
records = params2list(result)
var/list/new_records = new
new_records["Kills"] = max(kills, text2num(records["Kills"]| "0")) + 1


Problem description:

The problem im having is getting the score to add one for the score it is supposed to be for. I renamed the proc for just the one score to test it out but it counted it once and never again. i followed the guide on how to do it and what i want to know is after you make a proc what do you put to make it count for what your trying to get it to count for.

Example: Kills Level Arena Challenges Won

You need to set the scores on the hub.
new_records["Kills"] = max(kills, text2num(records["Kills"])) + 1
world.SetScores(key,list2params(new_records))
In response to Ruben7
ni i mean i gogt it to record befor but it only did it once i wanna know what i have to put where for it to constantly record like a proc or what cause if i do i can just make seperate procs
In response to Dbar910
Hum...what?
In response to Ruben7
what i mean is i have it exactly how the code looks but before it was exactly how the tutorial said but i changed it into a proc for one only and it counted my kills one time and now it wont work so what i want to know is how do i do it to where i can have them all in the same proc then add the value to make it count for the score it should count for
In response to Dbar910
"how do i do it to where i can have them all in the same proc"

What do you mean by all?
In response to Ruben7
I had the code have all my scores in the same proc but i had to take it out and make it one proc to one score what i wanna know how to do is have all the scores in the same proc and have the scores show on the hub and keep track of

i mean if i have all the scores in one proc how do i get them to count what they are supposed to do
In response to Dbar910
Oh, here's an example.
var/new_records[0]
new_records["Kills"]=src.kills
new_records["Deaths"]=src.deaths
new_records["Points"]=src.points
world.SetScores(src.key,list2params(new_records))
In response to Ruben7
still dosent work right
In response to Dbar910
It should..
mob/proc/UpdateScoreboard()
var/records[]=params2list(world.GetScores(key, ""))
if(!records)
src << "Sorry, the hub could not be contacted to record your score."
return
var/list/new_records=new
new_records["Kills"] = max(kills, text2num(records["Kills"])) + 1
new_records["Level"] = "level var here"
new_records["Arena"] = "arena var here"
new_records["Challenges"] = "challenges var here"
new_records["Challenges"] = "won var here"
if(world.SetScores(src.key,list2params(new_records)))
src<<"score set" // text string for testing purposes
else src<<"failed"


Edit: If you get "failed" that means for some reason the game couldn't contact the hub.

Edit2: Ok 1 space = 1 tab
In response to Ruben7
yea i have been testing when i put it there it says inconsenstant indentation and when i fix it it says if statement has no effect
In response to Dbar910
Indentation is still messed up, fix it. I'll help you, I'm going to edit my previous post, 1 space = 1 tab, ok?
In response to Ruben7
i think it might be working but is there anywhere i have to add the proc for it to record the scores
In response to Dbar910
Nope. What records the scores is SetScores()
In response to Ruben7
mob/proc/UpdateScoreboard()
var/records[]=params2list(world.GetScores(key, ""))
if(!records)
src << "Sorry, the hub could not be contacted to record your score."
return
var/list/new_records=new
new_records["Kills"] = src.kills
new_records["Level"] = src.Level
new_records["Deaths"] = src.deaths
if(world.SetScores(src.key,list2params(new_records)))
src<<"score set" // text string for testing purposes
else src<<"failed"



thats exactly how i have it