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

2013/12/15

New UserInfo to site?

So I had a thought, is it possible to make a new UserInfo with the possibility to upload stuff to the site? I'm asking because I was thinking of adding something that would allow non-users to play/access scores with other users. I'm guessing I can't make something like that happen (unless I screw around with the source code of Greenfoot). I'd rather do it this way, then the other way I've thought of directing non-users to an unused User (probably one I make) and allowing them to play through that user. And I don't know if that will work completely that way either.
bourne bourne

2013/12/15

#
So you are requesting UserInfo capabilities for those not logged in? The issue with that is what is the point if there is no persistent identity of those not logged in. Something like highscores via only by entering a name might work.
erdelf erdelf

2013/12/15

#
maybe identifying by saving mac adress with an entered name`?
What I want is an extra, anonymous UserInfo, that can access games (maybe do the highscore-name idea), and do stuff in them (for example in your battleship game). And I want to know if it's possible to make a temporary one in game, that will be deleted (hopefully) before leaving the game or after someone else uses it.
bourne bourne

2013/12/15

#
@erdelf, at that point why not just create an account
A temporary UserInfo made from the code, or made from the first user logged in (the person who made it) that is used by the site, and accessible. It would be accessible by having the largest int, or a specific string, for only non-users. If I were to do something like this, and I can't do it with code, I'd just make an extra account that non-users can "play" through.
Really, I just want to know if I can make a "Logged-in" user according to the site, and is accessible, but doesn't really exist on the site. Now that I think about it, it may just be easier to make an extra account to be used by the non-users.
bourne bourne

2013/12/15

#
@FlyingRabidUnicornPig, a temporary UserInfo actually sounds plausible, just to run the scenario among the actual users.
erdelf erdelf

2013/12/15

#
yeah, would be nice (and forget my last idea)
Do you think I'd have to change some of the source code, or just make references to it. And If I'm editing/using the source/background code, I'll have to take a look at it, and figure things out.
bourne bourne

2013/12/15

#
@FlyingRabidUnicornPig, I would suggest do not make a "public" account. Someone could change the password, probably conflict issues with multiple logins on scenarios, issue of who takes responsibility of the actions done with it, etc.
No, it would not be one accessible through the site, but accessible through the scenario. The only person that would be in control of the account, would be me!
Alright, so after doing homework and doing some quick looking around in the greenfoot source, I've found that there is a GreenfootUtil (seems to run everything) and it requires a GreenfootUtillDelegate. The GreenfootUtilDelegate is an interface, so there are two GreenfootUtilDelegate in the platforms folder. One for the IDE, and one for the standalone (almost certain that's the one for the site). In GreenfootUtilDelegateStandalone, it gets the UserName, and if the name as an int is less than 0, they will say the User is not logged in. This is in a method called "ensureStorageConnected()". There's also something about a passcode, and I don't know if that's the user's password, or something else. However, it may be that it's just for the scenario itself (to know what scenario to save the data to?) Alright, with the little I know, I'm going to see if I can make a new user instead of a "Not logged in message". There may be more to it, and I need to know what everything is to make a GreenfootUtilDelegateStandAlone properly. Wish me luck! :D
Before I actually post anything (I'm still not done with it), I need to know if it would be against any rules or policies that the site has about creating new "users". I started thinking of maybe making a completely new user, and not actually delete it at one point. But I don't know if creating a new user permanently would be against anything, and there's also the chance of someone misusing it and taking a lot of space (somehow) from where you guys store the UserInfos. If it's against anything, I will make it that they only take from one code-made user, and non of the stats would be stored permanently. Thanks for the clarification!
davmac davmac

2013/12/16

#
If I understand correctly what it is you want to do, I have to inform you it's not possible.
Really, I just want to know if I can make a "Logged-in" user according to the site, and is accessible, but doesn't really exist on the site. Now that I think about it, it may just be easier to make an extra account to be used by the non-users.
The UserInfo interface doesn't allow you to create new users. It is also doesn't allow you to modify the data for any user other than the currently logged in user, so, even if you did create another user manually, it wouldn't be possible to store data to that user from any other account.
You need to login to post a reply.