Page 1 of 1

Room Variables Updated not firing

Posted: 24 Feb 2012, 21:50
by Molix
What could cause changes to room variables on the server side to not be sent to clients? It must be some overall setting I have missed, because I have tried a lot of different ways. e.g.

Code: Select all

// 1
RoomVariable var = room.getVariable( "X" );
var.setValue( String.valueOf( "1" ) );
   
// 2
HashMap<String, RoomVariable> vars = room.getVariables( room );
vars.put( "X", new RoomVariable("2", RoomVariable.TYPE_STRING, null, true, false ) );
         
// 3
room.setVariable( "X", RoomVariable.TYPE_STRING, "3", false, true, null, false );

// 4
vars.put( "X", new RoomVariable("4", RoomVariable.TYPE_STRING, null, true, false ) );
extensionHelper.setRoomVariables( room, null, vars, true, true);


They all seem to set the value (as viewed in the admin tool) but no message is sent to the client. I am watching the Debug messages in the Unity client. What have I missed?

Re: Room Variables Updated not firing

Posted: 24 Feb 2012, 22:35
by rjgtav
Hi. Please check this section of the docs, it has an example code for setting RoomVariables of a Room via a Java Extension.

Re: Room Variables Updated not firing

Posted: 29 Feb 2012, 15:00
by Molix
Yes, I reviewed that and did extensive searching before posting. I also tried the method (setRoomVariable) in the example before posting, and it also did not work; I didn't mention it due to it being flagged as deprecated.

Are there options that could be involved in setting up the room that would prevent the variables from being sent? It could be a bug in the Unity/C# client SDK I suppose, though all I am expecting is a debug message, so it seems unlikely.

For now I have just resorted to manually sending the update with an extension response, though that is obviously not ideal.

Re: Room Variables Updated not firing

Posted: 02 Mar 2012, 07:13
by itsmylifesoham
if you are having the problem that client side event is not getting fired on setting a room variable then you can try this :

lets say the room you are setting it on is "modifiedroom"

then use this method :

getApi().setRoomVariables(User user, Room modifiedroom, java.util.List<RoomVariable> variables, boolean fireClientEvent, boolean fireServerEvent, boolean overrideOwnership)

pass user as null which tells the user setting it is the server. pass in the room to modify or set the variable on. pass the new roomvariables as a list. and most importantly set the fireclientevent as true.

hope that works.

Re: Room Variables Updated not firing

Posted: 04 Mar 2012, 17:49
by Molix
Thanks for taking the time to reply. It looks like you are using SFS2X, but we are still using 1x. The call you have indicated looks a lot like my #4 anyway. The problem must be in the client API.

Re: Room Variables Updated not firing

Posted: 04 Mar 2012, 17:58
by itsmylifesoham
oh sorry, thats right i was talking about sfs2x. :)

Re: Room Variables Updated not firing

Posted: 04 Mar 2012, 22:52
by rjgtav
Hi. Well, if your room is a limbo room, then when you update its variables, the update event is not broadcasted to anyone.