This site requires JavaScript, please enable it in your browser!
Greenfoot back
Vellyxenya
Vellyxenya wrote ...

2015/11/4

UserName, Data Storage

Vellyxenya Vellyxenya

2015/11/4

#
Hi, I just added a new functionality to my game, which is to Login/Register. But since, the amount of datas that can be stored is very limited, I wanted to seperate the for each user. Is that possible? Or do I am only allowed to have 10 ints etc.. for my whole game and for all the users?
danpost danpost

2015/11/4

#
Each logged in user whose has data saved will get their own UserInfo data block with a score, ten ints and five 50-character strings. One user's data will be different from another's only in the values saved (not including their user image and name, which are identifying information).
Vellyxenya Vellyxenya

2015/11/4

#
And how do I access one user's data or another? And when I use "store().. etc...", how do i tell Greenfoot that I want these data to be stored to the x-user, not the y-user?
danpost danpost

2015/11/4

#
You can only have each user store their own data. One user cannot store data for another user. The stored data for any user can be acquired while any user is running the scenario; but only the data for the current user can be change. This discussion thread contains a method to list the data for all users. The method came from my Private Messaging scenario.
Vellyxenya Vellyxenya

2015/11/4

#
Oh thank you very much for all this code! :) I have one last question please: what is the string returned when we use getUserName() if we never set a name? there's no method to set the user's name...
danpost danpost

2015/11/4

#
The 'getUserName' method will return the greenfoot member's name -- for you, it will return 'Vellyxenya'; for me, 'danpost'. Obviously, this piece of data cannot be altered. There is hardly ever a need to refer to a user specifically by name. This is the reason one must be loggied in to be able to have their data stored while running a scenario.
Vellyxenya Vellyxenya

2015/11/4

#
Ah okay, I finally understand :) Thank you very much for all your answers!
You need to login to post a reply.