Page 1 of 1

Question regarding to onJoinRoom-eventhandler

Posted: 08 Jul 2008, 20:17
by burritos
Hi!

I am trying to set some user variables.

Naturally I tried first to set these variables when not in a room, but the system crashed because it tried to use the current room (which was null) to query User object for the local user. Okay, I joined a room and tried again but it crashed again.

It turned out that if I call SmartFoxClient.setUserVariables in that handler, the user isn't actually in that room (even locally) in case of a Limbo room. Now I changed the room not to be limbo, problem solved.

However, a question raises: Is there a point for requiring user to be in a gameroom before user variables can be set? If I understood correctly, those variables are permanent anyway in a sense that I don't need to set them everytime I join a game room?

Basically I have two choices now:

a) Forget the limbo room feature
b) Handle user variable setting separately after joining a game room, which is pain in the ass because I need to keep track somehow if the variables are set for all users before transactions related to those variables can be done between clients.

I think that the system would also need a bit error handling, it is not very convenient to have the SmartFoxClient crash everytime I do something I am supposed not to. Simple error code or string would be a lot of help for both me and you.

Cheers!

Posted: 10 Jul 2008, 14:22
by Lapo
Okay, I joined a room and tried again but it crashed again.
It shouldn't
It turned out that if I call SmartFoxClient.setUserVariables in that handler
Which handler sorry?
the user isn't actually in that room (even locally) in case of a Limbo room. Now I changed the room not to be limbo, problem solved.
The limbo room simply does not support any broadcast-type message, so public message, user and room variables etc...
However, a question raises: Is there a point for requiring user to be in a gameroom before user variables can be set?
It can be in any room (besides Limbo)
The user must join at least one room before interacting with the server. This allows the server to protect himself from a lot of very basic and very annoying security issues.

The steps should be:
1- connect
2- login
3- request room list
4- join a room
... proceed as you prefer ...
I think that the system would also need a bit error handling, it is not very convenient to have the SmartFoxClient crash everytime I do something I am supposed not to. Simple error code or string would be a lot of help for both me and you.
We're going to enhance error reporting quite a lot in the next releases, including support for multiple languages :)

Posted: 10 Jul 2008, 14:23
by Lapo
Btw, this document goes into all these details and more --> http://www.smartfoxserver.com/docs/docP ... ecture.htm