How do I let player email their high score to friends

Get help using Construct 2

Post » Wed May 28, 2014 3:42 pm

Hi,

I'm hoping to have the game automatically bring up their default email software and pre-populate the subject and body of the email, with "I just scored so many points in GameX"

Anyone know if there's any way I can go about this, and if so, how?

thanks

Mike
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Thu May 29, 2014 8:28 am

No one?
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Thu May 29, 2014 1:50 pm

Using the browser object open url : "mailto:[email protected]" , and any of the regular html flags should work there in.
Note: It will open the email client, and on mobiles that may mean stopping the game completely.
Image ImageImage
B
172
S
50
G
182
Posts: 8,432
Reputation: 115,083

Post » Thu May 29, 2014 2:49 pm

Thanks so much newt... I'll give it a shot.

cheers,
Mike
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Thu May 29, 2014 3:18 pm

That worked, thanks!

My final URL WAS: mailto:?subject=MYGAME score!&body=I just scored ____ points on MYGAME. Can you beat that? http://www.MYGAME.com

I use the replace text feature to replace the ____ with the actual score before using that text as a URL.

cheers,
Mike
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Thu May 29, 2014 8:57 pm

Update! This wasn't working on IOS devices, so I needed to encode the text for the subject and body AND IOS DEMANDS AN EMAIL ADDRESS!!!, like so:
mailto:[email protected]?subject=MYGAME%20score!&body=I%20just%20scored%20one%20POINT%20on%20MYGAME.%20Can%20you%20beat%20that%3F%20http%3A%2F%2Fwww.MYGAME.com


This format seems to work on all platforms
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Thu May 29, 2014 9:07 pm

Ok, I guess you could let the user add the email via a text box, and add it using "mailto:"&myvariable.myvalue.
I know you can even add an image, but that doesn't work for all clients.
Image ImageImage
B
172
S
50
G
182
Posts: 8,432
Reputation: 115,083

Post » Fri May 30, 2014 9:37 am

Hi newt,

This is indeed turning into a ridiculously difficult project.. you'd think something so basic would be universal after all these decades... :(

Currently my mailto URL works on the device in chrome, or as an app (cocoonjs) BUT refuses to work now in safari even though it did once, but never again even though I changed nothing...sigh...

Also, It seems the MUST HAVE EMAIL ADDRESS rule is no longer true, as it worked at least on chrome and as an app with no email.

I'll report back if I figure out a truly universal solution.

Can you please explain how to include an image?!? That would be cool... but of course, if it then breaks on many of the platforms its most likely not worth it...I'd still like to give it a shot though.,
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Fri May 30, 2014 11:10 am

Wouldn't it be easier to just handle this with an AJax request and a PHP on a webserver to send the email?
B
15
S
4
G
5
Posts: 42
Reputation: 3,617

Post » Fri May 30, 2014 11:19 am

dsarchy wrote:Wouldn't it be easier to just handle this with an AJax request and a PHP on a webserver to send the email?


It is, and it works on every device.
B
32
S
10
G
3
Posts: 310
Reputation: 6,101

Next

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 6 guests