oh wait i misinterpreted your question
To tie keyvalues together(username+clicks) just use an array
setKeyValue('clickData',[[name,clicks],[name,clicks],[name,clicks]]);
and then access the clicks whenever you need to save or load clicks using the array
function loadClicks(){
getKeyValue('clickData',function(e){
for(var i = 0; i < e.length; i++){
if(e[i][0] === username){
clicks = e[i][1];
}
}
});
}
you could alternatively just name the keyvalue your getUserId()
, so each user has their own keyvalue but the above version offers advantages such as:
easier to access all clicks at once(leaderboard),
store more info than just clicks [name,clicks,level,prestige]
,
and some other stuff that i dont want to have to come up with