Game Login/Register

hi all

what it is im after a game Login Page with a register button, how i want it to work is if someone wants to register they click register then enter a username and password which writes to a file that can be read on the login page, but i do not know how to make it so you can enter text into a field (i know you would use text entry but how do you catch the text entered), or whether you can write the username and password to the same file aswell as the variables that need to be saved. Can any1 help me with this please because i want to be able to save certain variables related to the user that is logged in.

so is it possible to write to a file e.g. username= “scott”, password=“blablabla”, var power=“100”, var defence=“50”

then if username=“scott” but the password isnt “blablabla” bring up message - Incorrect password!

or if the username doesnt exist bring up message - That username does not exist!

but if username and password is a match to load the variables for that person.

Or am i trying to dive into something way over my head :stuck_out_tongue:

any help on this matter would be much appreciated.

i have found how to use the text input and implemented it but for the password is there any way i can change the characters to * like a password on a web page.

i still do not know how to create a file to save things to or whether you can save everything in the same file but i will research it, but can someone please let me know how the file is written e.g. like an array (“scott”,“blablabla”,“var1”,“var2”) or does it write username=“scott”, password=“blablabla” ect.

I think it’s possible, but you’ve to deal with HTTP requests and maye PHP scripts :frowning:
There are conditions and actions to do everything you want, but for local files: there are conditions to check a file (username) exists, actions to get infor from the file (password, power, defense), and of course you can test if the entered password is equal to the file password with variables conditions.
But for external files, really I don’t know, maybe a PHP script can return to the user that the file wasn’t found, or return the file other way, then with the file you can read values like above :confused:

Mats wrote recently a tutorial about this:
[url]Video Tutorial - Saving/Loading (HTML 5)]

OK, anyway I have written this before reading it:
About the text field, I think that a Sprite, a Text Entry and a Text Object will do the trick:
The Sprite will work as a panel/field, with a nice box to put the Text over it. The Sprite will help you to detect when an user start typing, I mean, when an user do a click over the Sprite, activate the Text Entry.
The Text, of course, will display the text saved in the Text Entry while it’s active (there is an expression to get the string saved in the memory of a Text Entry object).
Finally but not least, the Text Entry, it needs to remain active between a click in the Sprite and a click in another place or a key press :slight_smile:

Instead display the text in the Text Entry, show the character “" n times, with n = length of the text entered, there is an expression to get the length of a text, but not sure how to multiply the "”, AFAIK there is no expression to do it, and you just can’t do int*string :confused:

thankyou for that it answers alot, but im trying to implement it using purely the games write to file events as im guessing the file will save to the server, the only way i can think of doing it is with variables where a user will inherit a variable number when he/she registers, that variable number then locates that persons saved file which will be the variable number of the player which i can then save their file to. <<<<<< Dunno if anything like this can be done but i will let you know if it works :slight_smile:

so basically

1.) i register and inherit variable 1 as im the first member (next member inherits 2 ect.)
2.) when i sign in and save the game it creates a file called 1 if their isnt one there
3.) if their is one there it overwrites the file
4.) i then use this variable to save everything related to the user to the file

hopefully im not wasting my time but there must be a way round it

also about *ing the password couldnt i just have a text entry that is not visible that the user puts his password in and get how many key presses there has been to update the text for password as *'s, so the text for password isnt actually doing anything just inputting the *s and the password will be read from the invisible password text field

Of course, but you should check that the key pressed is not any special key (Return, F(1-12), Esc, Ctrl, etc.) :neutral_face:

Another way to do it is updating the text object, everytime a key is pressed (to get it nice, and have a better performance), this way:

Conditions: Any key is pressed Actions: Do = "" the text of PasswordText #clear the text object ........Repeat( StrLength(TextEntry.String()) ) times: #repeat length times ................Do + "*" to the thext of PasswordText #add a * for each call (length times)
You clear the password and add a “*” , “length of the password” times:D

thankyou lizard i shall give this a go, also Matts video tutorial doesnt show how the file is structured also do i have to create a text file with the same name as the file im trying to open to save too or does GD automatically create one for me

Conditions: Any key is pressed Actions: Do = "" the text of PasswordText #clear the text object ........Repeat( StrLength(TextEntry.String()) ) times: #repeat length times ................Do + "*" to the thext of PasswordText #add a * for each call (length times)

i dnt understand how to implement …Repeat( StrLength(TextEntry.String()) ) i done the other 2 but cnt figure out how to repeat it

GD creates one for you when you wrte a value, I think :slight_smile:

Save some values in the file, save child values (tags) too, save some numbers and texts, then check the file :wink:

EDIT:

The “Repeat” event is an especial event, you can find it under the big, green “+” in the events ribbon, it’ll repeat N times its sub events. Note that in the example, the Repeat event is a sub-event (… means sub-event), it’ll run when any key is pressed too :wink:

Please edit your previous posts instead doing double post :slight_smile:

haha it works, thanks again lizard you are a legend, im just mucking around with saving files atm to see if i can work around a way to make a user system, if i do ill make a tutorial then send you the file so you can look it over see if it works efficiently and that the code is good practice and ill post it with the other tutorials :slight_smile:.

Good idea! :smiley:

after reading through all the posts and wiki on how the data is stored, i have found that it cant be done just using GD as when you write to file the data is only temporarily stored in the browser so anything saved will be lost if the user shuts his/her browser down and starts it up again.

The only way to do it is to go into the HTML file and do it yourself, i know quite abit of html/css as iv made my own very basic website before using notepad, but coding user accounts i find really hard to pick up.

anyway im going to ask before i post in the feature request but is it possible that GD would ever be able to implicate some sort of system that can send and receive data from a server? or is it that GD is open source and hasnt got the rights to give away any kind of advanced structures.

If it can be done then it must be done as it will get alot more members as people will also use it as a way to make login accounts for there personal websites which i would absolutely use aswell as making games, im making a big game atm :slight_smile: