onRoomListUpdate does not send vars!
onRoomListUpdate does not send vars!
Hello again, sorry for my massive list of topics.
Is it just me or does onRoomListUpdate does not send any variables?
Is it just me or does onRoomListUpdate does not send any variables?
By default the list is not populated with variables in order to save bandwidth. If you need to receive the variables for each room you can activate it by adding:
Note: using many variables in many rooms could lead to a very large data transfer while receiving the room list.
hope it helps
in your Zone definition.roomListVars="true"
Note: using many variables in many rooms could lead to a very large data transfer while receiving the room list.
hope it helps
I'm trying like crazy to get a variable from the room i am trying to connect to, but the variables are not send. I tried setting the config like you said above, but nothing helps.
What i want to do:
1. connect
2. get all rooms
3. find the first room where there is a spot open AND the room variable "GameStarted" is false
Whe i login and receive the onRoomListUpdate, i receive no RoomVariables
What i want to do:
1. connect
2. get all rooms
3. find the first room where there is a spot open AND the room variable "GameStarted" is false
Whe i login and receive the onRoomListUpdate, i receive no RoomVariables
Maybe this helps:
Actionscript (summary, not in detail):
The problem is that arrRooms[room].getVariable("GameStarted") returns undefined....
Actionscript (summary, not in detail):
Code: Select all
m_SmartFoxClient.login(m_strZoneName, m_strUserName, null);
private function onRoomListUpdate(arrRooms) : Void
{
// Join the first Room which is not full
for (var room in arrRooms)
{
if (!arrRooms[room].getVariable("GameStarted"))
{
if (arrRooms[room].getMaxUsers() >= arrRooms[room].getUserCount())
{
m_SmartFoxClient.joinRoom(arrRooms[room].getId());
return;
}
}
}
check the docs. getVariable("name") returns an object and not the actuall value
I don't have sfs here, but if I remember corectly you can retrieve the var's value like
arrRooms[room].getVariable("GameStarted").getValue();
Hope this helps
I don't have sfs here, but if I remember corectly you can retrieve the var's value like
arrRooms[room].getVariable("GameStarted").getValue();
Hope this helps
function onJoin(usr) {if (usr.getName() == "Lapo") trace ("All Hail Lapo");}
I would probably suggest to use a server side extension to perform these tasks.What i want to do:
1. connect
2. get all rooms
3. find the first room where there is a spot open AND the room variable "GameStarted" is false
One problem you may encounter is that you find an available room but when you try to join it, it will refuse saying that the room is full.
This is because the "room-checking" operation is done on the client side, and if another similar request is done simultaneously by another client, the one with the faster conneciont will enter and the other one may not be able to do so. (if the room has only 1 "slot" free)
Back to your problem:
1- did you set the roomListVars="true" on the Zone definition?
2- are those variables that you expect specified in the <Rooms> config?
Tx, yeah i am already using an extension (actionscript) for everything. I also tried setting the roomListVars="true" to every line in the config i could find (after adding it to the Zone tag had no effect) but it didn't help either.Lapo wrote:I would probably suggest to use a server side extension to perform these tasks.What i want to do:
1. connect
2. get all rooms
3. find the first room where there is a spot open AND the room variable "GameStarted" is false
One problem you may encounter is that you find an available room but when you try to join it, it will refuse saying that the room is full.
This is because the "room-checking" operation is done on the client side, and if another similar request is done simultaneously by another client, the one with the faster conneciont will enter and the other one may not be able to do so. (if the room has only 1 "slot" free)
Back to your problem:
1- did you set the roomListVars="true" on the Zone definition?
2- are those variables that you expect specified in the <Rooms> config?
No, please that's not necessary.Tx, yeah i am already using an extension (actionscript) for everything. I also tried setting the roomListVars="true" to every line in the config i could find (after adding it to the Zone tag had no effect) but it didn't help either.
NOTE: after you make that change, please restart the server (stop and then start). This will make the change effective
Humm... as far as I know there's no know bug with that feature.BenSmeets wrote:Jup, making it server side as much as i could did the trick. The problem should still exist, but this is a (better) way around it. Tnx for the help guys.
Ben
I've done a quick test with a fresh copy of SFS 1.4 and it works without problems.