online scoreboard help

Posted By: DLively

online scoreboard help - 04/30/14 19:54

Hi, I think this is more for people who have used fogman's online scoreboard - but maybe not so please keep reading laugh

I have successfully implemented fogman's online scoreboard into my game, and it works fine -> If I don't use an important feature.

Code:
webscore_send(name_1_str,"textfile",str_for_num(NULL,score_count),str_for_num(NULL,stage_count));



What you see here ^^ is what I would like to send (score and stage)

When returning values
Code:
return_code=webscore_get("temp.txt","textfile");



Both Score and Stage return as stage.

If However, I set only one or the other
Code:
webscore_send(name_1_str,"textfile",str_for_num(NULL,score_count),"");



This returns the score.

and if I swap "" with stage_count it gives the proper stage.

Never both frown

Both gives me 2 stage counts
Posted By: Ch40zzC0d3r

Re: online scoreboard help - 04/30/14 20:29

Some more code would be helpful xD
IDK this fogman code, I did it myself since my friend loves php^^
EDIT: Would be nice to know whats in return_code and how you split the information (code)
Posted By: DLively

Re: online scoreboard help - 04/30/14 21:04

can be found here wink
http://aum.conitec.net/aum94code.zip
Posted By: Ch40zzC0d3r

Re: online scoreboard help - 04/30/14 23:05

Look at this:
Code:
STRING* webscore_get_index(STRING* line,var index)
{
STRING* temp=str_create("");
str_for_asc(temp,1);
return explode(temp,line,index);
}



This is splitting your return string. Maybe wrong splitter or something. Just debug a little laugh
Posted By: DLively

Re: online scoreboard help - 05/01/14 00:28

Im so sorry, but I just don't understand frown

Quote:
This is splitting your return string. Maybe wrong splitter or something. Just debug a littl

Are you suggesting that you see the answer to the problem? tongue
Posted By: Ch40zzC0d3r

Re: online scoreboard help - 05/01/14 08:45

Well your splitting your string wrong or something, just print out what your php script returns and then print out how it looks after each splitting func call.
Posted By: DLively

Re: online scoreboard help - 05/02/14 01:36

Does anyone know of an online scoreboard tutorial?
Posted By: DLively

Re: online scoreboard help - 05/02/14 05:47

BTW, with further research I've discovered this was not fogmans script.
Posted By: Ch40zzC0d3r

Re: online scoreboard help - 05/02/14 09:31

You dont need a tutorial lol.
Just think what you need.
A server with some scripts (mainly php) + a SQL databank to save your servers.
Now you just need to connect to your php script, use the 3DGS "get" functions to read the return of your php script.
Posted By: Realspawn

Re: online scoreboard help - 05/02/14 18:25

I would like to see a clear example how this all works laugh
as a non coder it would be great to create a little workshop out of it after all many people would like a good working high score in this way laugh

so if someone can enlight me,Dlively and all others who are curious laugh plz don't be shy
Posted By: DLively

Re: online scoreboard help - 05/02/14 18:57

Okay I've looked into this more - I've noted that it is not the splitter. the splitter works fine.

It seems to be the webscore_send:
I know this because If I open the .txt file stored in my server after its been created the score is 50 and the time is 50.

50 = stage 50.

Code:
var webscore_send(STRING* name,STRING* scores_file,STRING* score,STRING* time)
{
if(!load_web_dll()) return -1;
STRING* send=str_create(WEBSCORE_SCRIPT);
str_cat(send,"?action=add&key=");
str_cat(send,webscore_clean(WEBSCORE_KEY));
str_cat(send,"&name=");
str_cat(send,webscore_clean(name));
str_cat(send,"&scores_file=");
str_cat(send,webscore_clean(scores_file));
str_cat(send,"&score=");
str_cat(send,webscore_clean(score));
str_cat(send,"&time=");
//str_cat(send,time); // This is the original line
str_cat(send,webscore_clean(time));//I tried to replace it with this
var r=DownloadToFile(_chr(send),_chr("score_temp"));
if(!r) return -2;
STRING* res=file_get_contents("score_temp");
if(str_cmp(res,"")) r=-2;
else if(str_cmp(res,"0") || str_cmp(res,"2")) r=0;
else if(str_cmp(res,"1")) r=-3;
else r=-4;
file_delete("score_temp");
return r;
}



Perhaps someone else can see the error here?
Posted By: DLively

Re: online scoreboard help - 05/02/14 19:15

I figured it out laugh

When sending strings, str_for_num should be done prior to the struct wink
© 2024 lite-C Forums