email game to user set text string

Get help using Construct 2

Post » Sat Mar 02, 2013 9:51 am

Hi everyone,
Ive searched the forums for several hours and have found a couple useful tips on piecing together what I am trying to do,
but am going nuts to figure out the best way to do this
or if its even at all possible.

Im basically trying to take a simple layout do the following:

1- have a textbox accept user text and a name
   (in this case an email and the name of the person its sent to)
2- have it send the game to the email set by the textbox
   with the name of the person as a text set in the game

essentially, what I am after,
is like an over glorified e-card
in which the person enters the name of the person's email, their name, & their own email, so that both receive notification of the "personalized" game sent, or perhaps a link to the site with the "personalized" game for the recipient. Kind of giving a game as a gift with the recipients name embedded in their gift.

also, if I have the game residing on a site,
how can that text string be stored so that when the user receives it,
it displays his/her name specifically?

i hope i didnt make my request for help on this too confusing,
but im totally lost on how to accomplish this.

many thanks in advance for any and all help
& kind regards,
Carlos
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
12
S
2
Posts: 56
Reputation: 1,528

Post » Sat Mar 02, 2013 10:51 am

@cjuliao

For sending email, you've got two options.

If you are running on your own server and have access to php or any other scripting language that has the ability to format and send emails, that is the best way to go. You put all the user info (name, email, person being sent to, their email, etc...) in an ajax call to your server which then will format and send the email. This allows you complete control over what you're sending and doesn't rely on the user having an email client that is configured and working correctly. If you have this option available to you at all, use it.

If you don't have the above option, you can still pull this off if the circumstances are right. You can use the browser object's "go to url" to go to a "mailto:" string. If the user has a mail client that is configured correctly, it will open it up and start a new email. You can pass all normal email options via a mailto: cc, bcc, subject, body...etc. So you could in theory format a mail message based on text boxes in your game and throw it out there hoping they have a mail client that knows how to hand it. For more info on this, do a google search for "mailto:".

As for returning...you can use the browser object to get the query and hash from the URL that called the game, so if you sent them the link www.yourgame.com/index.html?name=john%20doe you could use the query string to get the name=john%20doe part and parse that into John Doe for use in your game. Or if you wanted to use the hash tag you could use www.yourgame.com/index.html#brian which would give you the string "brian" for the hash. Either way is a viable way to customize your game based on the URL that called it.

tl;dr: The browser is your friend.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Mon Mar 04, 2013 4:05 am

@theubie

man, thanks so much for your time & consideration!

you make it sound so easy, i *kinda followed you,
but got lost at the ajax call part.

Im an animator, and am finishing my first game with construct.
its been a great learning experience & highly rewarding to be able to build my own game from scratch
but when it gets that technical, im kind of lost.

would you be interested in a small job?
I have a small budget,
and if your willing,
I would be happy to pay.

if so, please contact me at:
cjuliao@gmail.com

essentially,
if you could help me with building just a basic framework & .capx,
for me to build the game on top of.

Please let me know if you would be interested
and we can discuss the details further if you'd like.
Im also available most of the time on skype:
cjuliao.skype

many thanks again & best regards,
Carlos
cjuliao
- Father
- Tree Hugger
- Designer, Animator & Game Developer
B
12
S
2
Posts: 56
Reputation: 1,528

Post » Wed May 08, 2013 9:30 am

Hi, I'm also trying to make a simple email form. I have a working php on a web server, I also know that browsers block AJAX requests across domains.

I want my players to fill out some radio buttons and a text box. So when in the parameters for AJAX: post to URL I wonder where i capture the info and send it to the URL? We have Tags, URL and Data. I tried simply to add the name of the text box under Data but with no luck.
My game Petrolhead Tactics is now on Steam Greenlight. I could not have done this without C2 ? Please rate, if you like!

Steam client already open: petrolheadtactics.com/steam
Web: petrolheadtactics.com/greenlight
B
19
S
4
G
4
Posts: 132
Reputation: 4,095


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests