Highscores for apps

Previous topic - Next topic

MrPlow

Hi Guys,

I am looking to see if I need to incorp keyboard features to my app or use some internal value to identify the username for a highscore table?

I want to send the scores online...My main issue is getting the name saved in a userfriendly manner.

Any ideas?

Also, I tried openfile on android and my program crashed...any ideas there?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Ok not crashing now that I error check the openfile command...but whats best practice for creating files in android Media folder?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

mentalthink

IF i can help, I think in the sample folders you have something for make an High Score tables into a remote Server...
About Keyboard I always I do my keyboard, it's very easy to do.

PS: If you need I think I have the code in fantasy Bricks for do all this tasks.   :good:

MrPlow

My main issue at the moment is trying to store highscore in text file locally...
for some reason its not working...

Code (glbasic) Select

FUNCTION gethighscore:

LOCAL test$ = GETCURRENTDIR$()+"Media/data/scr.txt"
LOCAL hsc% = 0
LOCAL ok

ok= OPENFILE(1, test$, TRUE)

IF ok=TRUE
READLONG 1,hsc%
IF hsc% > 0 THEN RETURN hsc%
CLOSEFILE 1
ENDIF



ENDFUNCTION


FUNCTION sethighscore:sc%
LOCAL test$ = GETCURRENTDIR$()+"Media/data/scr.txt"
LOCAL ok=TRUE

//KILLFILE test$
ok=OPENFILE(1,test$,FALSE)
IF ok=TRUE

WRITELONG 1,sc%
CLOSEFILE 1
ENDIF


ENDFUNCTION
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Got the create file to work with platforminfo documents setting...but would have preferred the Media/data folder setup...is it a permissions write issue?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

OK...how does netwebget$ work and does it work correctly on Android...?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

matchy

Recently I have been thinking about how to store high score online but as an simple alternative, if you don't mind me sharing. In the olden days when sending in high score to game magazines, we'd take a Polaroid photo screen shot as proof.  :zzz:

For a modern version, I would like to add QR codes for high scores. The idea is that the score can be saved as a photo offline, without having to write anything down or just scanned whilst online. The QR code would consist of the player and game details perhaps unique to that session and it's just a replacement for netwebget$. Now if only we had QR code in GLB.  :P

Moru

What stops you from writing your own qr-code generator? :-)

MrPlow

Guys,

Netwebget$ should work perfectly for me and i have the online database and php page made. But I am thinking, is my ISP blocking the connection?
The php code works when done manually but not when done by the App.

So is there a permissions problem for Internet access from the app itself (for Android)?

  :blink:
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

All good now...got it working ;-)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Moru

Even when fixing your own problems: If you posted the question already, please enlighten us to the solution too, for the next poor sod having the same problem :-)

(Usually it's because of mixing up the domain name and the url path in the strings) :-)

MrPlow

You're right Moru!

My first issue was the name recording using Android Extras...
Once I separated the startVKText() from getVKText via a Showscreen and a delay of 500ms I was able the get the value required for the Name value.

Then using netwebget$ works perfectly now...with a condition to prevent false sending...

Code (glbasic) Select
IF nme$<>"" THEN scoretable$=NETWEBGET$("www.gazzapper.com",pathloc$,80,512,5000)
(Note: using forward slash "/" in the start of the pathloc$ str

I setup my own mysql db online and php to save the results...I now have the following...

sending to server and save (Y)
get from server and parse data using a splitstr function (Y)

Hope this helps others down the line...

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Moru

Looks very nice :-)
Are you using any sort of encryption for the transfer?

MrPlow

Thanks Moru.
Not yet, just a security code. Will add better encryption soon.
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs