Online highscore list

31 replies to this topic
Posted 1+ years ago #26

Ok, for Android I needed the Internet permission. For HTML your Module seems not unusable.

Posted 1+ years ago #27

As far as I know, on HTML5 you have to have the PHP and your MonkeyGame.html on the same domain. It's a protection measure implemented in browsers I think.

Posted 1+ years ago #28

Do you mean in the same folder?

Posted 1+ years ago #29

Ok, tried that. Put both in the same folder, didn't work.

Posted 1+ years ago #30

Ok found out what I still needed. At the beginning of my PHP script, I needed to add this:

header("Access-Control-Allow-Origin: *");

Now Chrome and Firefox will retrieve data in HTML5.

Posted 1+ years ago #31

Hope I'm not bumping an old thread where I shouldn't be :)

Just mucking around with this after talking about using it for multiplayer turn based games - anyway, post #5 -> refers to just getting the data back as a string (i.e. no html) and it wasn't working. With my very very limited PHP skills, I think I've worked out that

printf( "%s,%d,", $i, $row[1], $row[2] );

should actually be

printf( "%s,%s,%d,", $i, $row[1], $row[2] );\

I've found some (over 100 in a series) really good PHP for beginners tutorials, so I will need to watch them to understand a lot of stuff that I don't, from what I see here I'm figuring %s and %d and used as either string (%s)? and numerical (%d)? is that right?

I'm thinking before getting in too deep (card game, multiplayer MySql server hosted) it would be best to start with something real simple - a multiplayer X & O's (naughts and crosses). Hopefully I can get something like that going and then see if we can get some Android or Tablet people to test it out.

Posted 1+ years ago #32

Still working away on this and I've run into a problem which is probably a simple fix. I'm using brl.httprequest and not mnet as in the example below:

Local playerName:String = "xaron"
Local playerScore:Int = 1234
Local scoreString:String = "" + playerName + "&score=" + playerScore
mnet.HttpGet( scoreString )

So my code looks like this:

Local regString:String = "" + user + "&email=" + email + "&password=" + password
Local get_req:HttpRequest = New HttpRequest("GET", regString, Self)

But I get a "Unable to find overload for new (String,String,Game)" error. Any ideas? Can I use HttpRequest instead of mnet used in Xaron's original code?

EDIT: Problem solved, was missing a Implements IOnHttpRequestComplete from my Game Class