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

2012/4/2

Detect scenario exit?

DonaldDuck DonaldDuck

2012/4/2

#
Hi all, Does anyone know of a way to detect when the scenario page has been left/refreshed and run a method when it has been? Alternatively, is there a way to reset PlayerData strings when the scenario has been closed? Thanks!
kiarocks kiarocks

2012/4/2

#
IDK, maybe the stopped method?
bourne bourne

2012/4/2

#
Sounds like you're trying to determine which player/users are currently running the scenario? Just to let you know the content in the beta is not meant for multiplayer interaction (but I hope is a possibility in the future). Its purpose/goal is to save/rank scores among users, and save data for individual use for a user.
DonaldDuck DonaldDuck

2012/4/2

#
With some crafty programming, it's possible to do multiplayer (At least it seems to be, and without even hammering the gallery to hard!). But yes, I am trying to determine which users are currently in the scenario. It's not a problem to set a string when they're running it, but when they stop it without executing the stopped() method, it's a problem.
kiarocks wrote...
IDK, maybe the stopped method?
I don't believe the stopped method is run unless the stop button is hit, but that's a good idea.
bourne bourne

2012/4/2

#
Yes I gave some thought to it as well. But the problem is, the only communication you can use is by changing the states of the data members of a user but that takes too much time saving to be doing it constantly (doing it just once doesn't go without notice). I would imagine only a turn-based game/program would come out alright. And for determining which users are currently in the scenario I thought something like having a data integer to be periodically incremented, which can be observed as being active, but again, updating the data costs too much time.
nccb nccb

2012/4/2

#
Bourne has worked out the implications correctly, I think. Doing cross-user interaction with our design is difficult. That's not because we're mean, it's just that the current system is quite a nice, small design for doing high scores, and adding player interaction would add a whole load of other challenges. It's a possibility for future expansion, but pretty much for 2.2.0, the storage design that's in the beta is what will be in the final release (perhaps plus/minus a method or two). As for knowing who is online, we do actually have that information (more by coincidence than design), but I don't think we want to go to the trouble of exposing it. Again, we have our current design and who's-playing doesn't really add much to the design (since it's intended for long-term storage, not short-term interaction).
kiarocks kiarocks

2012/4/2

#
Looks like you could try to catch the ThreadDeath Error that happens when you refresh/close, not sure how hard it would be.
You need to login to post a reply.